예제 #1
0
	def __init__(
		self,
		sep,
		fields,
		spacing=0,
		is_hbox=False,
		hist_size=10,
		**kwargs
	):
		if not is_hbox:
			gtk.HBox.__init__(self, spacing=spacing)
		self.spin = MultiSpinButton(sep, fields, **kwargs)
		pack(self, self.spin, 1, 1)
		self.hist_size = hist_size
		self.option = gtk.Button()
		self.option.add(gtk.Arrow(gtk.ArrowType.DOWN, gtk.ShadowType.IN))
		pack(self, self.option, 1, 1)
		self.menu = gtk.Menu()
		#self.menu.show()
		self.option.connect("button-press-event", self.option_pressed)
		self.menuItems = []
		#self.option.set_sensitive(False) #???????
		#self.spin._entry_activate = self._entry_activate
		self.spin.connect("activate", self._entry_activate)
		self.get_value = self.spin.get_value
		self.set_value = self.spin.set_value
예제 #2
0
 def __init__(self, hm=None, **kwargs):
     MultiSpinButton.__init__(self, ':', (
         HourField(),
         Z60Field(),
     ), **kwargs)
     if hm == None:
         hm = localtime()[3:5]
     self.set_value(hm)
예제 #3
0
 def __init__(self, date=None, **kwargs):
     MultiSpinButton.__init__(self, "/", (
         YearField(),
         MonthField(),
     ), **kwargs)
     if date is None:
         date = localtime()[:2]
     self.set_value(date)
예제 #4
0
 def __init__(self, hms=None, **kwargs):
     MultiSpinButton.__init__(self, ":", (
         HourField(),
         Z60Field(),
         Z60Field(),
     ), **kwargs)
     if hms is None:
         hms = localtime()[3:6]
     self.set_value(hms)
예제 #5
0
 def __init__(self, date=None, **kwargs):
     MultiSpinButton.__init__(
         self,
         '/',
         (
             YearField(),
             MonthField(),
         ),
         **kwargs
     )
     if date==None:
         date = localtime()[:2]
     self.set_value(date)
예제 #6
0
 def __init__(self, hm=None, **kwargs):
     MultiSpinButton.__init__(
         self,
         ':',
         (
             HourField(),
             Z60Field(),
         ),
         **kwargs
     )
     if hm==None:
         hm = localtime()[3:5]
     self.set_value(hm)
예제 #7
0
파일: time_b.py 프로젝트: ilius/starcal
	def __init__(self, hms=None, **kwargs):
		MultiSpinButton.__init__(
			self,
			":",
			(
				HourField(),
				Z60Field(),
				Z60Field(),
			),
			**kwargs
		)
		if hms is None:
			hms = localtime()[3:6]
		self.set_value(hms)
예제 #8
0
 def __init__(self, date_time=None, **kwargs):
     MultiSpinButton.__init__(
         self,
         ' ',
         (
             ContainerField(
                 '/',
                 YearField(),
                 MonthField(),
                 DayField(),
             ),
             ContainerField(
                 ':',
                 HourField(),
                 Z60Field(),
                 Z60Field(),
             ),
         ),
         #StrConField('seconds'),
         **kwargs)
     if date_time == None:
         date_time = localtime()[:6]
     self.set_value(date_time)
예제 #9
0
파일: date_time.py 프로젝트: ilius/starcal
 def __init__(self, date_time=None, **kwargs):
     MultiSpinButton.__init__(
         self,
         " ",
         (
             ContainerField(
                 "/",
                 YearField(),
                 MonthField(),
                 DayField(),
             ),
             ContainerField(
                 ":",
                 HourField(),
                 Z60Field(),
                 Z60Field(),
             ),
         ),
         #StrConField("seconds"),
         **kwargs)
     if date_time is None:
         date_time = localtime()[:6]
     self.set_value(date_time)
예제 #10
0
class MultiSpinOptionBox(gtk.HBox):
	signals = [
		('activate', [])
	]
	def _entry_activate(self, widget):
		#self.spin.update() #?????
		#self.add_history()
		self.emit('activate')
		return False
	def __init__(self, sep, fields, spacing=0, is_hbox=False, hist_size=10, **kwargs):
		if not is_hbox:
			gtk.HBox.__init__(self, spacing=spacing)
		self.spin = MultiSpinButton(sep, fields, **kwargs)
		pack(self, self.spin, 1, 1)
		self.hist_size = hist_size
		self.option = gtk.Button()
		self.option.add(gtk.Arrow(gtk.ArrowType.DOWN, gtk.ShadowType.IN))
		pack(self, self.option, 1, 1)
		self.menu = gtk.Menu()
		#self.menu.show()
		self.option.connect('button-press-event', self.option_pressed)
		self.menuItems = []
		#self.option.set_sensitive(False) #???????
		#self.spin._entry_activate = self._entry_activate
		self.spin.connect('activate', self._entry_activate)
		self.get_value = self.spin.get_value
		self.set_value = self.spin.set_value
	def option_pressed(self, widget, gevent):
		#x, y, w, h = self.option.
		self.menu.popup(None, None, None, None, gevent.button, gevent.time)
	def add_history(self):
		self.spin.update()
		text = self.spin.get_text()
		found = -1
		n = len(self.menuItems)
		for i in range(n):
			if self.menuItems[i].text==text:
				found = i
				break
		if found>-1:
			self.menu.remove(self.menuItems.pop(found))
		else:
			n += 1
		#m.prepend([text])#self.combo.prepend_text(text)
		item = MenuItem(text)
		item.connect('activate', lambda obj: self.spin.set_text(text))
		item.text = text
		self.menu.add(item)
		self.menu.reorder_child(item, 0)
		if n > self.hist_size:
			self.menu.remove(self.menuItems.pop(n-1))
		self.menu.show_all()
		#self.option.set_sensitive(True) #???????
	def clear_history(self):
		for item in self.menu.get_children():
			self.menu.remove(item)
예제 #11
0
	def __init__(self, date_time=None, **kwargs):
		MultiSpinButton.__init__(
			self,
			' ',
			(
				ContainerField(
					'/',
					YearField(),
					MonthField(),
					DayField(),
				),
				ContainerField(
					':',
					HourField(),
					Z60Field(),
					Z60Field(),
				),
			),
			#StrConField('seconds'),
			**kwargs
		)
		if date_time==None:
			date_time = localtime()[:6]
		self.set_value(date_time)
예제 #12
0
파일: date_time.py 프로젝트: ilius/starcal
	def __init__(self, date_time=None, **kwargs):
		MultiSpinButton.__init__(
			self,
			" ",
			(
				ContainerField(
					"/",
					YearField(),
					MonthField(),
					DayField(),
				),
				ContainerField(
					":",
					HourField(),
					Z60Field(),
					Z60Field(),
				),
			),
			#StrConField("seconds"),
			**kwargs
		)
		if date_time is None:
			date_time = localtime()[:6]
		self.set_value(date_time)
예제 #13
0
class MultiSpinOptionBox(gtk.HBox):
    signals = [
        ('activate', [])
    ]
    def _entry_activate(self, widget):
        #self.spin.update() #?????
        #self.add_history()
        self.emit('activate')
        return False
    def __init__(self, sep, fields, spacing=0, is_hbox=False, hist_size=10, **kwargs):
        if not is_hbox:
            gtk.HBox.__init__(self, spacing=spacing)
        self.spin = MultiSpinButton(sep, fields, **kwargs)
        pack(self, self.spin, 1, 1)
        self.hist_size = hist_size
        self.option = gtk.Button()
        self.option.add(gtk.Arrow(gtk.ArrowType.DOWN, gtk.ShadowType.IN))
        pack(self, self.option, 1, 1)
        self.menu = gtk.Menu()
        #self.menu.show()
        self.option.connect('button-press-event', self.option_pressed)
        self.menuItems = []
        #self.option.set_sensitive(False) #???????
        #self.spin._entry_activate = self._entry_activate
        self.spin.connect('activate', self._entry_activate)
        self.get_value = self.spin.get_value
        self.set_value = self.spin.set_value
    def option_pressed(self, widget, gevent):
        #x, y, w, h = self.option.
        self.menu.popup(None, None, None, None, gevent.button, gevent.time)
    def add_history(self):
        self.spin.update()
        text = self.spin.get_text()
        found = -1
        n = len(self.menuItems)
        for i in range(n):
            if self.menuItems[i].text==text:
                found = i
                break
        if found>-1:
            self.menu.remove(self.menuItems.pop(found))
        else:
            n += 1
        #m.prepend([text])#self.combo.prepend_text(text)
        item = MenuItem(text)
        item.connect('activate', lambda obj: self.spin.set_text(text))
        item.text = text
        self.menu.add(item)
        self.menu.reorder_child(item, 0)
        if n > self.hist_size:
            self.menu.remove(self.menuItems.pop(n-1))
        self.menu.show_all()
        #self.option.set_sensitive(True) #???????
    def clear_history(self):
        for item in self.menu.get_children():
            self.menu.remove(item)
예제 #14
0
class HourMinuteButton(MultiSpinButton):
    def __init__(self, hm=None, **kwargs):
        MultiSpinButton.__init__(self, ':', (
            HourField(),
            Z60Field(),
        ), **kwargs)
        if hm == None:
            hm = localtime()[3:5]
        self.set_value(hm)

    get_value = lambda self: MultiSpinButton.get_value(self) + [0]

    def set_value(self, value):
        if isinstance(value, int):
            value = [value, 0]
        else:
            value = value[:2]
        MultiSpinButton.set_value(self, value)
예제 #15
0
 def set_value(self, value):
     if isinstance(value, int):
         value = [value, 0]
     else:
         value = value[:2]
     MultiSpinButton.set_value(self, value)
예제 #16
0
 def get_value(self):
     return MultiSpinButton.get_value(self) + [0]
예제 #17
0
	def get_value(self):
		return MultiSpinButton.get_value(self) + [0]
예제 #18
0
 def set_value(self, value):
     if isinstance(value, int):
         value = [value, 0]
     else:
         value = value[:2]
     MultiSpinButton.set_value(self, value)