Exemplo n.º 1
0
	def __init__(self):
		gtk.HBox.__init__(self)
		#########
		hbox = gtk.HBox()
		pack(hbox, gtk.Label(_('Category')+':'))
		#####
		ls = gtk.ListStore(GdkPixbuf.Pixbuf, str)
		combo = gtk.ComboBox()
		combo.set_model(ls)
		###
		cell = gtk.CellRendererPixbuf()
		pack(combo, cell, False)
		combo.add_attribute(cell, 'pixbuf', 0)
		###
		cell = gtk.CellRendererText()
		pack(combo, cell, True)
		combo.add_attribute(cell, 'text', 1)
		###
		ls.append([None, _('Custom')])## first or last FIXME
		for item in ui.eventTags:
			ls.append([
				GdkPixbuf.Pixbuf.new_from_file(item.icon) if item.icon else None,
				item.desc
			])
		###
		self.customItemIndex = 0 ## len(ls)-1
		pack(hbox, combo)
		self.typeCombo = combo
		self.typeStore = ls

		###
		vbox = gtk.VBox()
		pack(vbox, hbox)
		pack(self, vbox)
		#########
		iconLabel = gtk.Label(_('Icon'))
		pack(hbox, iconLabel)
		self.iconSelect = IconSelectButton()
		pack(hbox, self.iconSelect)
		tagsLabel = gtk.Label(_('Tags'))
		pack(hbox, tagsLabel)
		hbox3 = gtk.HBox()
		self.tagButtons = []
		for item in ui.eventTags:
			button = gtk.ToggleButton(item.desc)
			button.tagName = item.name
			self.tagButtons.append(button)
			pack(hbox3, button)
		self.swin = gtk.ScrolledWindow()
		self.swin.set_policy(gtk.PolicyType.ALWAYS, gtk.PolicyType.NEVER)## horizontal AUTOMATIC or ALWAYS FIXME
		self.swin.add_with_viewport(hbox3)
		pack(self, self.swin, 1, 1)
		self.customTypeWidgets = (iconLabel, self.iconSelect, tagsLabel, self.swin)
		#########
		self.typeCombo.connect('changed', self.typeComboChanged)
		self.connect('scroll-event', self.scrollEvent)
		#########
		self.show_all()
		hideList(self.customTypeWidgets)
Exemplo n.º 2
0
	def typeComboChanged(self, combo):
		i = combo.get_active()
		if i is None:
			return
		if i == self.customItemIndex:
			showList(self.customTypeWidgets)
		else:
			hideList(self.customTypeWidgets)
Exemplo n.º 3
0
 def typeComboChanged(self, combo):
     i = combo.get_active()
     if i is None:
         return
     if i == self.customItemIndex:
         showList(self.customTypeWidgets)
     else:
         hideList(self.customTypeWidgets)
Exemplo n.º 4
0
 def showStep(self, stepIndex, *args):
     step = self.steps[stepIndex]
     step.run(*args)
     hideList(self.steps)
     step.show()
     self.stepIndex = stepIndex
     ###
     bbox = self.buttonBox
     for child in bbox.get_children():
         child.destroy()
     for label, func in step.buttons:
         #print(label, func)
         button = gtk.Button(label)
         button.connect('clicked', func)
         bbox.add(button)
         #pack(bbox, button)
     bbox.show_all()
Exemplo n.º 5
0
 def showStep(self, stepIndex, *args):
     step = self.steps[stepIndex]
     step.run(*args)
     hideList(self.steps)
     step.show()
     self.stepIndex = stepIndex
     ###
     bbox = self.buttonBox
     for child in bbox.get_children():
         child.destroy()
     for label, func in step.buttons:
         #print(label, func)
         button = gtk.Button(label)
         button.connect("clicked", func)
         bbox.add(button)
         #pack(bbox, button)
     bbox.show_all()
Exemplo n.º 6
0
    def __init__(self):
        gtk.HBox.__init__(self)
        #########
        hbox = gtk.HBox()
        pack(hbox, gtk.Label(_('Category') + ':'))
        #####
        ls = gtk.ListStore(GdkPixbuf.Pixbuf, str)
        combo = gtk.ComboBox()
        combo.set_model(ls)
        ###
        cell = gtk.CellRendererPixbuf()
        pack(combo, cell, False)
        combo.add_attribute(cell, 'pixbuf', 0)
        ###
        cell = gtk.CellRendererText()
        pack(combo, cell, True)
        combo.add_attribute(cell, 'text', 1)
        ###
        ls.append([None, _('Custom')])  ## first or last FIXME
        for item in ui.eventTags:
            ls.append([
                GdkPixbuf.Pixbuf.new_from_file(item.icon)
                if item.icon else None, item.desc
            ])
        ###
        self.customItemIndex = 0  ## len(ls)-1
        pack(hbox, combo)
        self.typeCombo = combo
        self.typeStore = ls

        ###
        vbox = gtk.VBox()
        pack(vbox, hbox)
        pack(self, vbox)
        #########
        iconLabel = gtk.Label(_('Icon'))
        pack(hbox, iconLabel)
        self.iconSelect = IconSelectButton()
        pack(hbox, self.iconSelect)
        tagsLabel = gtk.Label(_('Tags'))
        pack(hbox, tagsLabel)
        hbox3 = gtk.HBox()
        self.tagButtons = []
        for item in ui.eventTags:
            button = gtk.ToggleButton(item.desc)
            button.tagName = item.name
            self.tagButtons.append(button)
            pack(hbox3, button)
        self.swin = gtk.ScrolledWindow()
        self.swin.set_policy(
            gtk.PolicyType.ALWAYS,
            gtk.PolicyType.NEVER)  ## horizontal AUTOMATIC or ALWAYS FIXME
        self.swin.add_with_viewport(hbox3)
        pack(self, self.swin, 1, 1)
        self.customTypeWidgets = (iconLabel, self.iconSelect, tagsLabel,
                                  self.swin)
        #########
        self.typeCombo.connect('changed', self.typeComboChanged)
        self.connect('scroll-event', self.scrollEvent)
        #########
        self.show_all()
        hideList(self.customTypeWidgets)