def init_main_page(self): self.box_main = gtk.VBox() self.window.add(self.box_main) self.box_combos = gtk.VBox() self.box_main.pack_start(self.box_combos, False, False, 0) self.box_combo_your = gtk.HBox() self.box_combos.pack_start(self.box_combo_your) self.label_your = gtk.Label("Your language: ") self.box_combo_your.pack_start(self.label_your) self.combo_your = gtk.combo_box_entry_new_text() self.box_combo_your.pack_start(self.combo_your) self.box_combo_learn = gtk.HBox() self.box_combos.pack_start(self.box_combo_learn) self.label_learn = gtk.Label("Language to learn: ") self.box_combo_learn.pack_start(self.label_learn) self.combo_learn = gtk.combo_box_entry_new_text() self.box_combo_learn.pack_start(self.combo_learn) self.box_buttons = gtk.HBox() self.box_main.pack_start(self.box_buttons, False, False, 10) self.button_start = gtk.Button('Start') self.box_buttons.pack_start(self.button_start, False, False, 10) self.button_start.connect('clicked', self.start_quiz) self.button_about = gtk.Button('About') self.box_buttons.pack_start(self.button_about, False, False, 10) self.button_about.connect('clicked', self.about_win)
def btnHelloWorld_clicked(self, widget): global i global button global buttond global cbestop global cbezone if i >0: button[i].hide() buttond[i].show() i = i + 1 cbezone[i]=gtk.combo_box_entry_new_text() cbezone[i].set_model(listzone) cbezone[i].child.set_completion(completzone) cbezone[i].connect('focus-out-event',self.sins,i) cbestop[i]=gtk.combo_box_entry_new_text() #~ cbestop[i].set_model(liststop) #~ cbestop[i].child.set_completion(completstop) button[i] = gtk.Button(stock=gtk.STOCK_ADD) button[i].connect('clicked',self.zins,i) buttond[i] = gtk.Button(stock=gtk.STOCK_DELETE) buttond[i].connect('clicked',self.dell,i) self.wTree.get_widget("table1").attach(cbezone[i],0,1,i,i+1,yoptions=gtk.FILL) self.wTree.get_widget("table1").attach(cbestop[i],1,2,i,i+1,yoptions=gtk.FILL) self.wTree.get_widget("table1").attach(button[i],2,3,i,i+1,yoptions=gtk.FILL) self.wTree.get_widget("table1").attach(buttond[i],2,3,i,i+1,yoptions=gtk.FILL) cbezone[i].show() cbestop[i].show() button[i].show()
def __init_comboboxes(self): tgcm.debug("init comboboxes") self.state_combobox = gtk.combo_box_entry_new_text() self.city_combobox = gtk.combo_box_entry_new_text() self.type_combobox = gtk.combo_box_entry_new_text() self.zipcode_combobox = gtk.combo_box_entry_new_text() foo = ((self.state_vbox, self.state_combobox, self.hs_service.get_states_list), (self.city_vbox, self.city_combobox, self.hs_service.get_cities_list), (self.type_vbox, self.type_combobox, self.hs_service.get_types_list), (self.zipcode_vbox, self.zipcode_combobox, self.hs_service.get_zipcodes_list)) for vbox, combobox, function in foo: vbox.add(combobox) combobox.show() for row in function(): combobox.append_text(row) combobox.set_active(0) tgcm.debug("end comboboxes")
def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_size_request(600, 200) self.window.connect("destroy",self.destroy) self.window.set_title("WSD TOOL") self.label1 = gtk.Label("WSD TOOL") self.label2 = gtk.Label("User Name:") self.label3 = gtk.Label("Key:") self.label4 = gtk.Label(" ") self.combo = gtk.combo_box_entry_new_text() self.combo1 = gtk.combo_box_entry_new_text() self.button1 = gtk.Button("Quit") self.button2 = gtk.Button("Next") self.button1.connect("clicked",self.destroy) self.button2.connect("clicked",self.login) self.box1 = gtk.VBox() self.box2 = gtk.HBox() self.box2.pack_start(self.button2) self.box2.pack_start(self.button1) self.box1.pack_start(self.label1) self.box1.pack_start(self.label4) self.box1.pack_start(self.label2) self.box1.pack_start(self.combo) self.box1.pack_start(self.label3) self.box1.pack_start(self.combo1) self.box1.pack_start(self.box2) self.window.add(self.box1) self.window.show_all()
def register(self): self.device = {} self.device['lock'] = threading.Lock() self.dacstate = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] try: self.device['lock'].acquire() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.device['serverip'] = socket.gethostbyname( devname.split(':')[0]) self.device['serverport'] = int(devname.split(':')[1]) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) finally: self.device['lock'].release() if self.ui_target: self.speedchoice1 = gtk.combo_box_entry_new_text() for string in ['NORM', 'FAST', 'SLOW']: self.speedchoice1.append_text(string) iter = self.speedchoice1.get_model().get_iter_first() self.speedchoice1.set_active_iter(iter) self.speedchoice1.connect("changed", self.set_speed_clicked, 1) dmmspeed1 = gtk.Label("%s_ADC1" % (self.alias)) self.speedchoice2 = gtk.combo_box_entry_new_text() for string in ['NORM', 'FAST', 'SLOW']: self.speedchoice2.append_text(string) iter = self.speedchoice2.get_model().get_iter_first() self.speedchoice2.set_active_iter(iter) self.speedchoice2.connect("changed", self.set_speed_clicked, 2) dmmspeed2 = gtk.Label("%s_ADC2" % (self.alias)) hbox1 = gtk.HBox(False, 5) hbox1.pack_start(dmmspeed1, True, True, 5) hbox1.pack_start(self.speedchoice1, True, True, 5) hbox2 = gtk.HBox(False, 5) hbox2.pack_start(dmmspeed2, True, True, 5) hbox2.pack_start(self.speedchoice2, True, True, 5) self.topvbox = gtk.VBox(False, 5) self.topvbox.pack_start(hbox1, True, True, 5) self.topvbox.pack_start(hbox2, True, True, 5) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() # sync up the ADCs to us self.set_speed(1, "NORM") self.set_speed(2, "NORM")
def register(self): self.device = {} self.device['lock'] = threading.Lock() self.dacstate = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] try: self.device['lock'].acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.device['serverip'] = socket.gethostbyname(devname.split(':')[0]) self.device['serverport'] = int(devname.split(':')[1]) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) finally: self.device['lock'].release() if self.ui_target: self.speedchoice1 = gtk.combo_box_entry_new_text() for string in ['NORM','FAST', 'SLOW']: self.speedchoice1.append_text(string) iter = self.speedchoice1.get_model().get_iter_first() self.speedchoice1.set_active_iter(iter) self.speedchoice1.connect("changed", self.set_speed_clicked, 1) dmmspeed1 = gtk.Label("%s_ADC1"%(self.alias)) self.speedchoice2 = gtk.combo_box_entry_new_text() for string in ['NORM','FAST', 'SLOW']: self.speedchoice2.append_text(string) iter = self.speedchoice2.get_model().get_iter_first() self.speedchoice2.set_active_iter(iter) self.speedchoice2.connect("changed", self.set_speed_clicked, 2) dmmspeed2 = gtk.Label("%s_ADC2"%(self.alias)) hbox1 = gtk.HBox(False, 5) hbox1.pack_start(dmmspeed1, True, True, 5) hbox1.pack_start(self.speedchoice1, True, True, 5) hbox2 = gtk.HBox(False, 5) hbox2.pack_start(dmmspeed2, True, True, 5) hbox2.pack_start(self.speedchoice2, True, True, 5) self.topvbox = gtk.VBox(False, 5) self.topvbox.pack_start(hbox1, True, True, 5) self.topvbox.pack_start(hbox2, True, True, 5) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() # sync up the ADCs to us self.set_speed(1, "NORM") self.set_speed(2, "NORM")
def __init__(self): self.janela = gtk.Window() self.janela.set_title("The Wakemanduino - 0.1") self.janela.set_position(gtk.WIN_POS_CENTER) self.janela.set_border_width(15) self.janela.connect('destroy', lambda w: gtk.main_quit()) self.conteudo = gtk.VBox(False, 1) #Box para Modificação/ Envio de acordes self.boxChord = gtk.HBox(False, 1) self.btnSend = gtk.Button("Send") self.btnSend.connect('clicked', self.on_send_chord_clicked) self.boxChord.pack_start(self.btnSend) self.chordChange = gtk.combo_box_entry_new_text() self.chordChange.append_text('') self.boxChord.pack_start(self.chordChange) self.chords = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'] for chord in self.chords: self.chordChange.append_text(chord) self.chordChange.set_active(1) self.typeChordChange = gtk.combo_box_entry_new_text() self.typeChordChange.append_text('') self.boxChord.pack_start(self.typeChordChange) self.typeChords = ['Major', 'Minor'] for typeChord in self.typeChords: self.typeChordChange.append_text(typeChord) self.typeChordChange.set_active(1) self.conteudo.pack_start(self.boxChord) #Box com outras configurações. self.confChord = gtk.HBox(False, 1) self.onoff = False self.btOnOff = gtk.Button('off') self.btOnOff.set_size_request(37, 25) self.btOnOff.connect('clicked', self.on_onoff_clicked) self.confChord.pack_start(self.btOnOff, False, False, 0) self.actualChord = gtk.Label() self.set_actual_chord() self.confChord.pack_start(self.actualChord, False, False, 0) self.conteudo.pack_start(self.confChord) self.janela.add(self.conteudo) self.janela.show_all()
def btnHelloWorld_clicked(self, widget): global i global button global buttond global cbestop global cbezone if i > 0: button[i].hide() buttond[i].show() i = i + 1 cbezone[i] = gtk.combo_box_entry_new_text() cbezone[i].set_model(listzone) cbezone[i].child.set_completion(completzone) cbezone[i].connect('focus-out-event', self.sins, i) cbestop[i] = gtk.combo_box_entry_new_text() #~ cbestop[i].set_model(liststop) #~ cbestop[i].child.set_completion(completstop) button[i] = gtk.Button(stock=gtk.STOCK_ADD) button[i].connect('clicked', self.zins, i) buttond[i] = gtk.Button(stock=gtk.STOCK_DELETE) buttond[i].connect('clicked', self.dell, i) self.wTree.get_widget("table1").attach(cbezone[i], 0, 1, i, i + 1, yoptions=gtk.FILL) self.wTree.get_widget("table1").attach(cbestop[i], 1, 2, i, i + 1, yoptions=gtk.FILL) self.wTree.get_widget("table1").attach(button[i], 2, 3, i, i + 1, yoptions=gtk.FILL) self.wTree.get_widget("table1").attach(buttond[i], 2, 3, i, i + 1, yoptions=gtk.FILL) cbezone[i].show() cbestop[i].show() button[i].show()
def register(self): self.lock = threading.Lock() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) self.dmm = Gpib.Gpib(devname) self.dmm.clear() time.sleep(.1) self.dmm.range = .1 self.set_speed(self.dmm, 'NORM') if self.ui_target: self.speedchoice = gtk.combo_box_entry_new_text() for string in ['NORM', 'FAST', 'SLOW']: self.speedchoice.append_text(string) iter = self.speedchoice.get_model().get_iter_first() self.speedchoice.set_active_iter(iter) self.speedchoice.connect("changed", self.set_speed_clicked) dmmspeed = gtk.Label("%s" % (self.alias)) self.tophbox = gtk.HBox(False, 5) self.tophbox.pack_start(dmmspeed, True, True, 5) self.tophbox.pack_start(self.speedchoice, True, True, 5) self.ui_target.pack_start(self.tophbox, False, False, 5) self.ui_target.show_all()
def __init__(self): f = open("words.txt","r") r = f.read() r = r.split() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_size_request(600, 200) self.window.connect("destroy",self.destroy) self.window.set_title("WSD TOOL") self.label1 = gtk.Label("WSD TOOL") self.label2 = gtk.Label("Write your word or select from the dropdown:") self.combo = gtk.combo_box_entry_new_text() a_conn.execute("select word from words") r = a_conn.fetchall() for i in r: for j in i: self.combo.append_text(j) self.button1 = gtk.Button("Quit") self.button2 = gtk.Button("Next") self.button2.connect("clicked",self.screen2) self.button1.connect("clicked",self.destroy) self.box1 = gtk.VBox() self.box2 = gtk.HBox() self.box2.pack_start(self.button2) self.box2.pack_start(self.button1) self.box1.pack_start(self.label1) self.box1.pack_start(self.label2) self.box1.pack_start(self.combo) self.box1.pack_start(self.box2) self.window.add(self.box1) self.window.show_all() f.close()
def __init__(self): #put the sementics in array r r = ['Animate','Inanimate','Human','Place','Time'] self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy",self.destroy) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_size_request(600,300) self.window.set_title("WSD TOOL") self.label = gtk.Label("WSD TOOL") self.label1 = gtk.Label("Enter the additional information:") self.combo = gtk.combo_box_entry_new_text() for i in r: self.combo.append_text(i) self.button = gtk.Button('Quit') self.button.connect("clicked",self.destroy) self.button2 = gtk.Button('Done') self.button2.connect("clicked",self.done) self.box1 = gtk.HBox() self.box2 = gtk.VBox() self.box2.pack_start(self.label) self.box2.pack_start(self.label1) self.box2.pack_start(self.combo) self.box1.pack_start(self.button2) self.box1.pack_start(self.button) self.box2.pack_start(self.box1) self.window.add(self.box2) self.window.show_all()
def __init__(self): self.__gobject_init__() self.light = gtk.combo_box_entry_new_text() #self.sim_mode.set_size_request(-1, 20) sun_values=["0.0","0.01","0.1","1.0","10"] token=inp_get_token_value("light.inp", "#Psun") if sun_values.count(token)==0: sun_values.append(token) for i in range(0,len(sun_values)): self.light.append_text(sun_values[i]) liststore = self.light.get_model() for i in xrange(len(liststore)): if liststore[i][0] == token: self.light.set_active(i) self.light.child.connect('changed', self.call_back_light_changed) lable=gtk.Label(_("Light intensity (Suns):")) lable.show hbox = gtk.HBox(False, 2) hbox.pack_start(lable, False, False, 0) hbox.pack_start(self.light, False, False, 0) self.add(hbox) self.show_all()
def __init__( self, parent, title, text, options=[], okbutton=gtk.STOCK_OPEN): super(GetStringDialog, self).__init__(title, parent) self.set_border_width(6) self.set_has_separator(False) self.set_resizable(False) self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, okbutton, gtk.RESPONSE_OK) self.vbox.set_spacing(6) self.set_default_response(gtk.RESPONSE_OK) box = gtk.VBox(spacing=6) lab = gtk.Label(text) box.set_border_width(6) lab.set_line_wrap(True) lab.set_justify(gtk.JUSTIFY_CENTER) box.pack_start(lab) if options: self._entry = gtk.combo_box_entry_new_text() for o in options: self._entry.append_text(o) self._val = self._entry.child box.pack_start(self._entry) else: self._val = UndoEntry() box.pack_start(self._val) self.vbox.pack_start(box) self.child.show_all()
def createMountPointCombo(request, excludeMountPoints=[]): mountCombo = gtk.combo_box_entry_new_text() mntptlist = [] if request.type != REQUEST_NEW and request.fslabel: mntptlist.append(request.fslabel) idx = 0 for p in defaultMountPoints: if p in excludeMountPoints: continue if not p in mntptlist and (p[0] == "/"): mntptlist.append(p) map(mountCombo.append_text, mntptlist) mountpoint = request.mountpoint if request.fstype and request.fstype.isMountable(): mountCombo.set_sensitive(1) if mountpoint: mountCombo.get_children()[0].set_text(mountpoint) else: mountCombo.get_children()[0].set_text("") else: mountCombo.get_children()[0].set_text(_("<Not Applicable>")) mountCombo.set_sensitive(0) mountCombo.set_data("saved_mntpt", None) return mountCombo
def __init__(self, name, parent, attrs={}): wid_int.wid_int.__init__(self, name, parent, attrs) self.widget = gtk.combo_box_entry_new_text() self.widget.child.set_editable(False) self.set_popdown(attrs.get('selection', []))
def __init__(self,a): self.a =a self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy",self.destroy) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_size_request(600,200) self.window.set_title("WSD TOOL") self.label0 = gtk.Label("WSD TOOL") self.label1 = gtk.Label("Write your own english sentence or select a English Sentence by the drop down:") self.combo = gtk.combo_box_entry_new_text() a_conn.execute("select sentences.esentence from sentences,words where words.word='"+self.a+"' and sentences.id=(select links.sid from links where links.wid=words.id)") word_selected = a_conn.fetchall() for i in word_selected: for j in i: self.combo.append_text(j) self.label2 = gtk.Label("Enter the Hindi Sentence:") self.textbox2 = gtk.Entry() self.button2 = gtk.Button("Next") self.button3 = gtk.Button("Exit") self.button3.connect("clicked",self.destroy) self.button2.connect("clicked",self.screen3) self.box1 = gtk.VBox() self.box2 = gtk.HBox() self.box3 = gtk.VBox() self.box1.pack_start(self.label0) self.box1.pack_start(self.label1) self.box1.pack_start(self.combo) self.box1.pack_start(self.label2) self.box1.pack_start(self.textbox2) self.box2.pack_start(self.button2) self.box2.pack_start(self.button3) self.box3.pack_start(self.box1) self.box3.pack_start(self.box2) self.window.add(self.box3) self.window.show_all()
def __init__(self, app, folder=None, handler='latex'): buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK) action = gtk.FILE_CHOOSER_ACTION_OPEN gtk.FileChooserDialog.__init__(self, _("Open..."), app.gui.win, action, buttons) # Window self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.set_modal(True) self.set_destroy_with_parent(True) # Encoding hb = gtk.HBox() l = gtk.Label(_("Character encoding:")) l.set_alignment(1, 0.5) l.set_padding(7, 0) hb.pack_start(l, True, True) cb = gtk.combo_box_entry_new_text() for e in ENCODINGS: cb.append_text(e) cb.set_active(0) hb.pack_start(cb, False, True) self.set_extra_widget(hb) hb.show_all() # Files self.set_local_only(False) if folder is not None: self.set_current_folder_uri(folder) self.filters = {} for h in app.gui.file_handlers: f = gtk.FileFilter() f.set_name(h[1]) for e in h[2]: f.add_pattern(e) self.add_filter(f) self.filters[h[0]] = f self.set_filter(self.filters[handler]) self.set_select_multiple(True)
def __init__(self, app): self.app = app self.wTree = gtk.glade.XML("glade/mail_pref.glade") self.w = self.wTree.get_widget("window1") table1 = self.wTree.get_widget("table1") self.e_smpt_server = gtk.combo_box_entry_new_text() self.e_smpt_server.show() table1.attach(self.e_smpt_server, 1, 2, 0, 1) self.e_port = self.wTree.get_widget("e_port") self.cbox_use_auth = self.wTree.get_widget("cbox_use_auth") self.e_username = self.wTree.get_widget("e_username") self.e_passwd = self.wTree.get_widget("e_passwd") self.cbox_use_ssl = self.wTree.get_widget("cbox_use_ssl") self.cbox_forked_mail = self.wTree.get_widget("cbox_forked_mail") self.bt_del_imap = self.wTree.get_widget("bt_del_imap") self.cbox_is_imap_server = self.wTree.get_widget("cbox_is_imap_server") self.bt_cancel = self.wTree.get_widget("bt_cancel") self.bt_del_imap.set_sensitive(False) evtmap = { "on_bt_save_clicked": self.on_bt_save_clicked, "on_button1_clicked": self.on_button1_clicked, "destroy": lambda o: self.destroy(), "on_cbox_is_imap_server_toggled": self.on_cbox_is_imap_server_toggled, "on_bt_del_imap_clicked": self.on_bt_del_imap_clicked, "on_bt_set_port_default_clicked": self.on_bt_set_port_default_clicked, } self.load_smtp_config() self.response = 1 self.combo_handler_id = None self.combo_handler_id1 = None self.wTree.signal_autoconnect(evtmap)
def searchcombo(self): """ Create and return a ToolItem with an entry combobox. """ cbentry = gtk.combo_box_entry_new_text() cbentry.append_text(_("Search term")) cbentry.set_active(0) cbentry.remove_text(0) # remove "Search Term" from searchcombo cbentry.child.connect('key-press-event', self.comboentry_press) cbentry.show() btn_search = gtk.Button(stock=gtk.STOCK_FIND) btn_search.connect('clicked', self.perform_search, cbentry.child) btn_search.show() lbl = btn_search.get_children()[0].get_children()[0].get_children()[1] lbl.set_label("") self.tooltips.set_tip(btn_search, _("Find devices")) box = gtk.HBox() box.pack_start(cbentry, True, True, 0) box.pack_end(btn_search, False, False, 0) item = gtk.ToolItem() item.add(box) item.set_expand(True) return item
def _add_dropdown(self, vbox, title, tooltip, opt_lst, option, width_char=-1): """Add a drop down box.""" hbox = gtk.HBox() label = gtk.Label(title) label.set_tooltip_text(tooltip) hbox.pack_start(label, expand=False, fill=False) combo = gtk.combo_box_entry_new_text() combo.child.set_width_chars(width_char) for opt in opt_lst: combo.append_text(str(opt)) val = getattr(self.settings.options, option) if isinstance(val, float): str_val = '%0.3g' % val else: str_val = val try: index = opt_lst.index(str_val) except ValueError: index = 0 combo.set_active(index) combo.set_tooltip_text(tooltip) hbox.pack_start(combo, expand=False, fill=False, padding=10) logging.info('got option %s as %s', option, val) combo.connect('changed', self._combo_changed, option) vbox.pack_start(hbox, expand=False, fill=False) return combo
def show_edit_dialog(self, widget): window = gtk.Window() window.set_title("GtkWeather") #window.set_default_size(250, 200) #window.set_icon_from_stock(gtk.STOCK_PREFERENCES,10) window.set_border_width(10) box1 = gtk.VBox(gtk.TRUE, 5) window.add(box1) box1.show() comboboxentry = gtk.combo_box_entry_new_text() #window.add(comboboxentry) comboboxentry.set_tooltip_text("Choose your sity") f = open("city-id.txt", "r") s = f.readline() while s: s = f.readline() item = s.split(' ')[0] if item != '': comboboxentry.append_text(item) comboboxentry.child.connect('changed', self.changed_city) comboboxentry.set_active(0) box1.pack_start(comboboxentry, gtk.FALSE, gtk.FALSE, 0) window.show_all()
def __init__(self, matches=None, choices=None, default=None): gtk.HBox.__init__(self) DynamicWidget.__init__(self, default) self.set_border_width(0) self.set_spacing(0) if choices: self.combo = gtk.combo_box_entry_new_text() self.text = self.combo.child self.combo.show() self.pack_start(self.combo) for choice in choices: self.combo.append_text(choice) else: self.text = gtk.Entry() self.text.show() self.pack_start(self.text) self.matches = None self.last_valid = None self.valid = False self.send_signal = True self.text.connect("changed", self._textChanged) if matches: if type(matches) is str: self.matches = re.compile(matches) else: self.matches = matches self._textChanged(None)
def __init__(self, window, instance): super(CreateDialog, self).__init__(self.TITLE, window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) self.instance = instance docs = self.instance.get_data(self.TYPES_URL) self.types = docs["types"] table = gtk.Table(2, 1) self.vbox.pack_start(table) self.type_entry = gtk.combo_box_entry_new_text() for t in docs["types"]: self.type_entry.append_text(t) self.type_entry.child.set_text(self.TYPE) self.type_entry.connect("changed", self.type_entry_activate_cb) self.fields = [("type", self.type_entry), ] for i, (text, entry) in enumerate(self.fields): table.attach(gtk.Label(_(text.capitalize()+":")), 0, 1, i, i+1) table.attach(entry, 1, 2, i, i+1) self.advanced_table = gtk.Table(2, 3) self.advanced_fields = [] self.vbox.pack_start(self.advanced_table) self.display_fields(self.TYPE) self.unlock_button = gtk.CheckButton(_("Unlock ?")) self.vbox.pack_start(self.unlock_button) self.vbox.show_all()
def _init_ui(self, title, line, length, readonly, combo, button): self.set_size_request(WDLG_WIDTH, WDLG_HEIGHT) self.set_position(gtk.WIN_POS_CENTER) self.connect("delete-event", self.on_delete_event) self.set_title(title) self.set_resizable(False) self._button = gtk.Button(button) self._button.set_size_request(WDLG_BUTTON_WIDTH, WDLG_BUTTON_HEIGHT) self._button.connect("clicked", self.on_clicked) if not combo: self._line = gtk.Entry(max=length) self._line.set_text(line) else: self._line = gtk.combo_box_entry_new_text() self._line.append_text(line) self._line.set_active(0) self._line.connect('changed', self.on_changed) self._line.set_size_request(WDLG_LINE_WIDTH, WDLG_LINE_HEIGHT) if readonly: self._line.set_property("editable", False) self._line.set_sensitive(False) fixed = gtk.Fixed() fixed.put(self._button, WDLG_BUTTON_LEFT, WDLG_BUTTON_TOP) fixed.put(self._line, WDLG_LINE_LEFT, WDLG_LINE_TOP) self.add(fixed) self.hide() self._closed = True self._wait = False self._readonly = readonly self._combo = combo
def __init__(self, controls, collback): self.collback = collback FControl.__init__(self, controls) ChildTopWindow.__init__(self, _("Equalizer")) self.eq_lines = [] for label in EQUALIZER_LABLES: self.eq_lines.append(EqLine(label, self.on_collback)) lbox = gtk.VBox(False, 0) lbox.show() self.combo = gtk.combo_box_entry_new_text() self.combo.connect("changed", self.on_combo_chage) lbox.pack_start(self.top_row(), False, False, 0) lbox.pack_start(self.middle_lines_box(), False, False, 0) self.add(lbox) self.models = [] self.default_models = []
def load_kernel(self, w, data=None): if isinstance(w, int): data, w = w, data for i in self.table: self.table.remove(i) self.ke = self.editors[data]() self.set_title("Loading...") self.table.resize(len(self.ke.std_keys), 2) self.boxes = {} c = 0 #for name,key in self.ke.std_keys.iteritems(): for x in self.ke.data: key = x[self.ke.key] name = self.ke.std_keys[key] lab = gtk.Label(name) lab.show() combo=gtk.combo_box_entry_new_text() for i in range(len(self.linux_keys.values())): combo.append_text(self.linux_keys.values()[i]) test=False j=-1 while test==False & j<len(self.linux_keys.values()): j+=1 if self.linux_keys.values()[j]==self.linux_keys[self.ke.table[key]]:test=True combo.set_active(j) combo.show() self.table.attach(lab, 0, 1, c, c+1) self.table.attach(combo, 1, 2, c, c+1) self.boxes[key] = combo c += 1 self.table.show() self.set_title("Editing...")
def get_body(self, vbox): self.prevtarget = None # layout table self.table = table = gtklib.LayoutTable() vbox.pack_start(table, True, True, 2) ## revision combo self.combo = gtk.combo_box_entry_new_text() self.combo.child.set_width_chars(28) self.combo.child.connect('activate', lambda b: self.response(gtk.RESPONSE_OK)) if self.initrev == '': self.combo.append_text(WD_PARENT) else: self.combo.append_text(str(self.initrev)) self.combo.set_active(0) for b in self.repo.branchtags(): self.combo.append_text(b) tags = list(self.repo.tags()) tags.sort() tags.reverse() for t in tags: self.combo.append_text(t) table.add_row(_('Archive revision:'), self.combo) self.opt_files_in_rev = gtk.CheckButton( _('Only files modified/created in this revision')) table.add_row('', self.opt_files_in_rev, ypad=0) ## dest combo & browse button self.destentry = gtk.Entry() self.destentry.set_width_chars(46) destbrowse = gtk.Button(_('Browse...')) destbrowse.connect('clicked', self.browse_clicked) table.add_row(_('Destination path:'), self.destentry, 0, destbrowse) ## archive types self.filesradio = gtk.RadioButton(None, _('Directory of files')) self.filesradio.connect('toggled', self.type_changed) table.add_row(_('Archive types:'), self.filesradio, ypad=0) def add_type(label): radio = gtk.RadioButton(self.filesradio, label) radio.connect('toggled', self.type_changed) table.add_row(None, radio, ypad=0) return radio self.tarradio = add_type(_('Uncompressed tar archive')) self.tbz2radio = add_type(_('Tar archive compressed using bzip2')) self.tgzradio = add_type(_('Tar archive compressed using gzip')) self.uzipradio = add_type(_('Uncompressed zip archive')) self.zipradio = add_type(_('Zip archive compressed using deflate')) # signal handler self.combo.connect('changed', lambda c: self.update_path()) # prepare to show self.update_path(hglib.toutf(self.repo.root))
def __init__(self, library): _ComicFileChooserDialog.__init__(self) self._library = library self.set_transient_for(library) self.filechooser.set_select_multiple(True) self.filechooser.connect('current_folder_changed', self._set_collection_name) self._collection_button = gtk.CheckButton( '%s:' % _('Automatically add the books to this collection'), False) self._collection_button.set_active( prefs['auto add books into collections']) self._comboentry = gtk.combo_box_entry_new_text() self._comboentry.child.set_activates_default(True) for collection in self._library.backend.get_all_collections(): name = self._library.backend.get_collection_name(collection) self._comboentry.append_text(name) collection_box = gtk.HBox(False, 6) collection_box.pack_start(self._collection_button, False, False) collection_box.pack_start(self._comboentry, True, True) collection_box.show_all() self.filechooser.set_extra_widget(collection_box) filters = self.filechooser.list_filters() try: # When setting this to the first filter ("All files"), this # fails on some GTK+ versions and sets the filter to "blank". # The effect is the same though (i.e. display all files), and # there is no solution that I know of, so we'll have to live # with it. It only happens the second time a dialog is created # though, which is very strange. self.filechooser.set_filter( filters[prefs['last filter in library filechooser']]) except Exception: self.filechooser.set_filter(filters[1])
def addReferencedVariable(self, event, rootVariable, rootEntry): # Display the form for the creation of a word variable dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK, None) dialog.set_markup(_("Definition of the ReferencedVariable")) # Create the ID of the new variable variableID = str(uuid.uuid4()) mainTable = gtk.Table(rows=3, columns=2, homogeneous=False) # parent id of the variable variablePIDLabel = gtk.Label(_("Parent ID:")) variablePIDLabel.show() variablePIDValueLabel = gtk.Label(str(rootVariable.getID())) variablePIDValueLabel.set_sensitive(False) variablePIDValueLabel.show() mainTable.attach(variablePIDLabel, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) mainTable.attach(variablePIDValueLabel, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) # id of the variable variableIDLabel = gtk.Label(_("ID:")) variableIDLabel.show() variableIDValueLabel = gtk.Label(variableID) variableIDValueLabel.set_sensitive(False) variableIDValueLabel.show() mainTable.attach(variableIDLabel, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) mainTable.attach(variableIDValueLabel, 1, 2, 1, 2, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) # Selection of the variable varLabel = gtk.Label(_("Referenced Variable:")) varLabel.show() self.varCombo = gtk.combo_box_entry_new_text() self.varCombo.show() self.varStore = gtk.ListStore(str, str) # description, id, self.varCombo.set_model(self.varStore) # We retrieve all the existing variables in the project existingVariables = self.project.getVocabulary().getVariables() for existingVariable in existingVariables: self.varCombo.get_model().append([existingVariable.getUncontextualizedDescription(), existingVariable.getID()]) mainTable.attach(varLabel, 0, 1, 2, 3, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) mainTable.attach(self.varCombo, 1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) dialog.vbox.pack_end(mainTable, True, True, 0) dialog.show_all() result = dialog.run() if result != gtk.RESPONSE_OK: dialog.destroy() return idReferencedVariable = self.varCombo.get_model().get_value(self.varCombo.get_active_iter(), 1) referencedVariable = ReferencedVariable(uuid.uuid4(), "Ref", idReferencedVariable) rootVariable.addChild(referencedVariable) self.datas[str(referencedVariable.getID())] = referencedVariable self.treestore.append(rootEntry, [str(referencedVariable.getID()), referencedVariable.getUncontextualizedDescription()]) # We close the current dialog dialog.destroy()
def getPanel(self): # Create the main panel self.panel = gtk.Table(rows=3, columns=3, homogeneous=False) self.panel.show() # Create the header (first row) with the search form # Search entry self.searchEntry = gtk.Entry() self.searchEntry.show() # Combo to select the type of the input self.typeCombo = gtk.combo_box_entry_new_text() self.typeCombo.show() self.typeStore = gtk.ListStore(str) self.typeCombo.set_model(self.typeStore) self.typeCombo.get_model().append([Format.STRING]) self.typeCombo.get_model().append([Format.HEX]) self.typeCombo.get_model().append([Format.BINARY]) self.typeCombo.get_model().append([Format.OCTAL]) self.typeCombo.get_model().append([Format.DECIMAL]) self.typeCombo.get_model().append([Format.IP]) # Search button searchButton = gtk.Button(_("Search")) searchButton.show() searchButton.connect("clicked", self.prepareSearchingOperation) self.panel.attach(self.searchEntry, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) self.panel.attach(self.typeCombo, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) self.panel.attach(searchButton, 2, 3, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5) return self.panel
def NetzobComboBoxEntry(): combo = gtk.combo_box_entry_new_text() combo.show() combo.set_model(gtk.ListStore(str)) cell = combo.get_cells()[0] # Get the cellrenderer cell.set_property("size-points", 9) return combo
def register(self): self.lock = threading.Lock() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.dmm = Gpib.Gpib(devname) self.dmm.clear() time.sleep(.1) self.dmm.range = .1 self.set_speed(self.dmm, 'NORM') if self.ui_target: self.speedchoice = gtk.combo_box_entry_new_text() for string in ['NORM','FAST', 'SLOW']: self.speedchoice.append_text(string) iter = self.speedchoice.get_model().get_iter_first() self.speedchoice.set_active_iter(iter) self.speedchoice.connect("changed", self.set_speed_clicked) dmmspeed = gtk.Label("%s"%(self.alias)) self.tophbox = gtk.HBox(False, 5) self.tophbox.pack_start(dmmspeed, True, True, 5) self.tophbox.pack_start(self.speedchoice, True, True, 5) self.ui_target.pack_start(self.tophbox, False, False, 5) self.ui_target.show_all()
def createMountPointCombo(request, excludeMountPoints=[]): mountCombo = gtk.combo_box_entry_new_text() mntptlist = [] label = getattr(request.format, "label", None) if request.exists and label and label.startswith("/"): mntptlist.append(label) idx = 0 for p in defaultMountPoints: if p in excludeMountPoints: continue if not p in mntptlist and (p[0] == "/"): mntptlist.append(p) map(mountCombo.append_text, mntptlist) if (request.format.type or request.format.migrate) and \ request.format.mountable: mountpoint = request.format.mountpoint mountCombo.set_sensitive(1) if mountpoint: mountCombo.get_children()[0].set_text(mountpoint) else: mountCombo.get_children()[0].set_text("") else: mountCombo.get_children()[0].set_text(_("<Not Applicable>")) mountCombo.set_sensitive(0) mountCombo.set_data("saved_mntpt", None) return mountCombo
def __init__(self, matches=None, choices=None, default=None): gtk.HBox.__init__(self) DynamicWidget.__init__(self, default) self.set_border_width(0) self.set_spacing(0) if choices: self.combo = gtk.combo_box_entry_new_text() self.text = self.combo.child self.combo.show() self.pack_start(self.combo) for choice in choices: self.combo.append_text(choice) else: self.text = gtk.Entry() self.text.show() self.pack_start(self.text) self.matches = None self.last_valid = None self.valid = False self.text.connect("changed", self._textChanged) if matches: if type(matches) is str: self.matches = re.compile(matches) else: self.matches = matches self._textChanged(None)
def ActiveCombo(c, box, combolist, combodefault, entry, f_1=False, p_1=False, f_2=False, p_2=False, f_3=False, p_3=False): if entry: combo = gtk.combo_box_entry_new_text() else: combo = gtk.combo_box_new_text() for item in combolist: combo.append_text(item) if f_1: combo.connect('changed', f_1, *p_1) if f_2: combo.connect('changed', f_2, *p_2) if f_3: combo.connect('changed', f_3, *p_3) combo.set_active(combodefault) box.pack_start(combo, False, False, 0) return combo
def __init__(self, dbus_ifaces): """ Load the wired network entry. """ NetworkEntry.__init__(self, dbus_ifaces) self.image.set_alignment(.5, 0) self.image.set_size_request(60, -1) self.image.set_from_icon_name("network-wired", 6) self.image.show() self.expander.show() self.connect_button.show() self.expander.set_label(language['wired_network']) self.is_full_gui = True self.button_add = gtk.Button(stock=gtk.STOCK_ADD) self.button_delete = gtk.Button(stock=gtk.STOCK_DELETE) self.profile_help = gtk.Label(language['wired_network_instructions']) self.chkbox_default_profile = gtk.CheckButton(language['default_wired']) self.combo_profile_names = gtk.combo_box_entry_new_text() self.profile_list = wired.GetWiredProfileList() if self.profile_list: for x in self.profile_list: self.combo_profile_names.append_text(x) self.profile_help.set_justify(gtk.JUSTIFY_LEFT) self.profile_help.set_line_wrap(True) self.hbox_temp = gtk.HBox(False, 0) self.hbox_def = gtk.HBox(False, 0) self.vbox_top.pack_start(self.profile_help, True, True) self.vbox_top.pack_start(self.hbox_def) self.vbox_top.pack_start(self.hbox_temp) self.hbox_temp.pack_start(self.combo_profile_names, True, True) self.hbox_temp.pack_start(self.button_add, False, False) self.hbox_temp.pack_start(self.button_delete, False, False) self.hbox_def.pack_start(self.chkbox_default_profile, False, False) self.button_add.connect("clicked", self.add_profile) self.button_delete.connect("clicked", self.remove_profile) self.chkbox_default_profile.connect("toggled", self.toggle_default_profile) self.combo_profile_names.connect("changed", self.change_profile) self.script_button.connect("button-press-event", self.edit_scripts) if stringToBoolean(wired.GetWiredProperty("default")): self.chkbox_default_profile.set_active(True) else: self.chkbox_default_profile.set_active(False) self.show_all() self.profile_help.hide() self.advanced_dialog = WiredSettingsDialog(self.combo_profile_names.get_active_text()) if self.profile_list is not None: prof = wired.GetDefaultWiredNetwork() if prof != None: i = 0 while self.combo_profile_names.get_active_text() != prof: self.combo_profile_names.set_active(i) i += 1 else: self.combo_profile_names.set_active(0) self.expander.set_expanded(False) else: if not wired.GetAlwaysShowWiredInterface(): self.expander.set_expanded(True) self.profile_help.show() self.check_enable() self.wireddis = self.connect("destroy", self.destroy_called)
def __init__(self, app): self.app = app self.wTree = gtk.glade.XML('glade/mail_pref.glade') self.w = self.wTree.get_widget('window1') table1 = self.wTree.get_widget('table1') self.e_smpt_server = gtk.combo_box_entry_new_text(); self.e_smpt_server.show() table1.attach(self.e_smpt_server, 1, 2, 0, 1) self.e_port = self.wTree.get_widget('e_port') self.cbox_use_auth = self.wTree.get_widget('cbox_use_auth') self.e_username = self.wTree.get_widget('e_username') self.e_passwd = self.wTree.get_widget('e_passwd') self.cbox_use_ssl = self.wTree.get_widget('cbox_use_ssl') self.cbox_forked_mail = self.wTree.get_widget('cbox_forked_mail') self.bt_del_imap = self.wTree.get_widget('bt_del_imap') self.cbox_is_imap_server = self.wTree.get_widget('cbox_is_imap_server') self.bt_cancel = self.wTree.get_widget('bt_cancel') self.bt_del_imap.set_sensitive(False) evtmap = { 'on_bt_save_clicked': self.on_bt_save_clicked,\ 'on_button1_clicked':self.on_button1_clicked,\ 'destroy': lambda o: self.destroy() ,\ 'on_cbox_is_imap_server_toggled': self.on_cbox_is_imap_server_toggled,\ 'on_bt_del_imap_clicked': self.on_bt_del_imap_clicked,\ 'on_bt_set_port_default_clicked': self.on_bt_set_port_default_clicked } self.load_smtp_config() self.response = 1 self.combo_handler_id = None self.combo_handler_id1 = None self.wTree.signal_autoconnect(evtmap)
def add_entry(self, label, property, help, passwd = 0, entries=None): lbl = gtk.Label(label) lbl.show() align = gtk.Alignment() align.show() align.add(lbl) if entries: combo = gtk.combo_box_entry_new_text() entry = combo.child combo.show() for e in entries: combo.append_text(e) combo.set_tooltip_text(help) self.__add_line(1, align, combo) else: combo = None entry = gtk.Entry() entry.show() entry.set_tooltip_text(help) self.__add_line(1, align, entry) if (passwd): entry.set_visibility(False) entry.set_invisible_char(unichr(0x2022)) value = self.__get_config(property) entry.set_text(value) entry.connect('changed', self.__on_change, property, self.CHANGE_ENTRY)
def getEntries(self): ''' Get entries @return: gtk.VBox containg gtk.Entry's ''' right = gtk.VBox(False, 10) self.username = gtk.Entry() self.password = gtk.Entry() self.password.set_visibility(False) #self.hostname = gtk.Entry() self.hostname = gtk.combo_box_entry_new_text() self.username.connect("key-press-event", self.entryKeyPress_cb) self.password.connect("key-press-event", self.entryKeyPress_cb) self.hostname.get_child().connect("key-press-event", self.entryKeyPress_cb) right.pack_start(self.username, False, False, 0) right.pack_start(self.password, False, False, 0) right.pack_start(self.hostname, False, False, 0) return right
def __init__(self, frame, message="", default_text='', modal=True, option=False, optionmessage="", optionvalue=False, droplist=[]): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete-event", self.quit) self.gotoption = option if modal: self.set_modal(True) box = gtk.VBox(spacing=10) box.set_border_width(10) self.vbox.pack_start(box) box.show() if message: label = gtk.Label(message) box.pack_start(label, False, False) label.set_line_wrap(True) label.show() self.combo = gtk.combo_box_entry_new_text() for i in droplist: self.combo.append_text(i) self.combo.child.set_text(default_text) box.pack_start(self.combo, False, False) self.combo.show() self.combo.grab_focus() self.option = gtk.CheckButton() self.option.set_active(optionvalue) self.option.set_label(optionmessage) self.option.show() if self.gotoption: box.pack_start(self.option, False, False) button = gtk.Button(_("OK")) button.connect("clicked", self.click) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() button.grab_default() button = gtk.Button(_("Cancel")) button.connect("clicked", self.quit) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() self.ret = None
def __init__(self, name, parent, attrs={},screen=None): wid_int.wid_int.__init__(self, name, parent, attrs, screen) self.widget = gtk.combo_box_entry_new_text() self.widget.child.set_editable(False) self.set_popdown(attrs.get('selection', [])) if self.default_search: self._value_set(str(self.default_search))
def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_size_request(600, 600) self.button1 = gtk.Button("EXIT") self.button1.connect("clicked", self.destroy) self.button2 = gtk.Button("hide") self.button2.connect("clicked", self.myhide) self.button3 = gtk.Button("show") self.button3.connect("clicked", self.myshow) self.button4 = gtk.Button("relable") self.button4.connect("clicked", self.relable) self.button5 = gtk.Button("add to Combo box") self.button5.connect("clicked", self.add_combo) self.label1 = gtk.Label("disini dituliskan label") self.text1 = gtk.Entry() self.text1.connect("changed", self.textbox) self.combo = gtk.combo_box_entry_new_text() self.combo.connect("changed", self.combo_text) self.combo.append_text("Ini tulisan") self.combo.append_text("Opsi 1") self.combo.append_text("Opsi 2") self.combo.append_text("Opsi 3") #resize image self.pix = gtk.gdk.pixbuf_new_from_file_at_size( "google_41.png", 200, 200) #add Image self.image = gtk.Image() #self.image.set_from_file("google_41.png") <-- without pix for resize pic self.image.set_from_pixbuf(self.pix) self.box1 = gtk.HBox() self.box1.pack_start(self.button1) self.box1.pack_start(self.button2) self.box1.pack_start(self.button3) self.box1.pack_start(self.button4) self.box3 = gtk.HBox() self.box3.pack_start(self.text1) self.box3.pack_start(self.button5) self.box2 = gtk.VBox() self.box2.pack_start(self.box1) self.box2.pack_start(self.label1) self.box2.pack_start(self.box3) self.box2.pack_start(self.combo) self.box2.pack_start(self.image) self.window.add(self.box2) self.window.show_all() self.window.connect("destroy", self.destroy)
def __init__(self, title="Add printer"): gtk.Dialog.__init__(self, title, None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) tab = gtk.Table(6, 2) self.vbox.pack_start(tab) # Printer name tab.attach(gtk.Label("Emulated Printer name"), 0, 1, 0, 1, ypadding=5) self.cups_printer_name = gtk.Entry() tab.attach(self.cups_printer_name, 1, 2, 0, 1, ypadding=5) # Description tab.attach(gtk.Label("Description"), 0, 1, 1, 2, ypadding=5) self.description = gtk.Entry() tab.attach(self.description, 1, 2, 1, 2, ypadding=5) # Actual name tab.attach(gtk.Label("Actual Printer name"), 0, 1, 2, 3, ypadding=5) self.gs_printer_name = gtk.Entry() tab.attach(self.gs_printer_name, 1, 2, 2, 3, ypadding=5) # Form type tab.attach(gtk.Label("Form type"), 0, 1, 3, 4, ypadding=5) self.form_type = gtk.Entry() tab.attach(self.form_type, 1, 2, 3, 4, ypadding=5) # media supported/default tab.attach(gtk.Label("Media default"), 0, 1, 4, 5, ypadding=5) self.media_supp = gtk.combo_box_entry_new_text() tab.attach(self.media_supp, 1, 2, 4, 5, ypadding=5) # document format supported/default tab.attach(gtk.Label("Doc format default"), 0, 1, 5, 6, ypadding=5) self.doc_format = gtk.combo_box_entry_new_text() tab.attach(self.doc_format, 1, 2, 5, 6, ypadding=5) self.show_all()
def __init__(self): HIGWindow.__init__(self) self.wtitle = _("SMTP Account Editor") # header self.title_markup = "<span size='16500' weight='heavy'>%s</span>" self.ttitle = HIGEntryLabel("") self.ttitle.set_line_wrap(False) self.ttitle.set_markup(self.title_markup % self.wtitle) self.umit_logo = gtk.Image() self.umit_logo.set_from_file(logo) # schemas name self.schema_name_lbl = HIGEntryLabel(_("Schema name")) self.schema_name = gtk.combo_box_entry_new_text() self.schema_name.connect('changed', self._check_schema) # smtp server self.smtp_server_lbl = HIGEntryLabel(_("Server")) self.smtp_server = gtk.Entry() self.smtp_port_lbl = HIGEntryLabel(_("Port")) self.smtp_port = gtk.Entry() # sending mail.. self.smtp_mailfrom_lbl = HIGEntryLabel(_("Mail from")) self.smtp_mailfrom = gtk.Entry() # smtp auth self.smtp_need_auth = gtk.CheckButton( _("Servers requires authentication")) self.smtp_need_auth.connect('toggled', self._auth_need) self.smtp_login_lbl = HIGEntryLabel(_("Username")) self.smtp_login = gtk.Entry() self.smtp_passwd_lbl = HIGEntryLabel(_("Password")) self.smtp_passwd = gtk.Entry() self.smtp_passwd.set_visibility(False) self._auth_need(None) # smtp encryption self.smtp_encrypt_tls = gtk.CheckButton(_("Use TLS Encryption")) """ Missing: SSL encryption, Other authentication methods. """ # bottom buttons self.help = HIGButton(stock=gtk.STOCK_HELP) self.help.connect('clicked', self._show_help) self.apply = HIGButton(stock=gtk.STOCK_APPLY) self.apply.connect('clicked', self._save_schema) self.cancel = HIGButton(stock=gtk.STOCK_CANCEL) self.cancel.connect('clicked', self._exit) self.ok = HIGButton(stock=gtk.STOCK_OK) self.ok.connect('clicked', self._save_schema_and_leave) self.load_schemas() self.__set_props() self.__do_layout() self.connect('destroy', self._exit)
def createComboEntry(self, controller, name, list): comboboxentry = gtk.combo_box_entry_new_text() comboboxentry.set_name(name) for item in list: comboboxentry.append_text(item) comboboxentry.child.connect('changed', controller.callback2) #comboboxentry.connect('changed', controller.callback2) #comboboxentry.set_active(0) return comboboxentry
def __init__(self, values): gtk.HBox.__init__(self) self.combo = gtk.combo_box_entry_new_text() for value in values: self.combo.append_text(value) self.pack_start(self.combo) self.combo.show()
def __init__(self, name, parent, attrs={}): wid_int.wid_int.__init__(self, name, parent, attrs) self.widget = gtk.combo_box_entry_new_text() self.widget.child.set_editable(True) self.widget.child.connect('key_press_event', self.sig_key_press) self._selection = {} if 'selection' in attrs: self.set_popdown(attrs.get('selection', []))
def on_sub_clicked(self,widget): if self.subCount: if not self.newSubGraph: return self.newGraph[self.subCount]['stats']=self.newSubGraph self.newSubGraph=[] if not self.makingNewGraph: self.makingNewGraph=True self.sharedButton=gtk.CheckButton('sharedX') self.subBox.pack_start(self.sharedButton,False,False) self.sharedButton.show() else: l=gtk.Label('------------------') l.show() self.subBox.pack_start(l,False,False) textEntry=gtk.Entry() textEntry.set_text('SubGraph'+str(self.subCount)) self.subCount+=1 self.subBox.pack_start(textEntry,False,False) textEntry.show() self.newGraph[self.subCount]={} self.newGraph[self.subCount]['name']=textEntry h=gtk.HBox() l=gtk.Label('X axis:') h.pack_start(l) l.show() combo=gtk.combo_box_entry_new_text() combo.append_text('customX') combo.append_text('lpb') combo.append_text('time') combo.set_active(2) combo.get_children()[0].set_editable(False) combo.show() h.pack_start(combo,True,True) h.show() self.subBox.pack_start(h,False,False) self.newGraph[self.subCount]['x']=combo hbox=gtk.HBox() self.lStore=gtk.ListStore(str) tview=gtk.TreeView(self.lStore) hbox.pack_start(tview,True,True) renderer=gtk.CellRendererText() # renderer.set_property('width-chars',30) # renderer.set_property('xpad',10) column=gtk.TreeViewColumn("statistics",renderer, text=0) column.set_resizable(True) # column.set_fixed_width(120) tview.append_column(column) tview.show() hbox.show() self.subBox.pack_start(hbox,False,False)
def set_data_combo(self): """ Create a combo box for node data selection in the node data frame. Add an entry if required. """ self.set_data_empty() if isinstance(self.node.datatype[0], tuple): self.data = gtk.combo_box_entry_new_text() else: self.data = gtk.combo_box_new_text() self.frame.add(self.data) self.data.show() self.data.connect("set-focus-child", self.combo_focus_child) self.set_child_packing(self.frame, False, False, 0, gtk.PACK_START) if isinstance(self.node.datatype[0], tuple): self.buttons.show() else: self.buttons.hide() if self.node.data is None: if isinstance(self.node.datatype[0], tuple): self.data.child.set_text( "Select " + datatype.print_type(self.node.datatype[1]) + "...") else: self.data.append_text("Select...") self.data.set_active(0) self.data.child.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("blue")) self.data.child.modify_text(gtk.STATE_PRELIGHT, gtk.gdk.color_parse("blue")) if isinstance(self.node.datatype[0], tuple): options = self.node.datatype[0] else: options = self.node.datatype for (i, opt) in enumerate(options): self.data.append_text(opt) if self.node.data == opt: self.data.set_active(i) if (isinstance(self.node.datatype[0], tuple) and self.node.data is not None and self.node.data not in self.node.datatype[0]): self.data.child.set_text(self.node.data) self.data.connect("changed", self.combo_changed) return
def create_start_diag(self): self.start_diag = gtk.Fixed() self.start_label = gtk.Label("Your Music folder") self.start_entry = gtk.combo_box_entry_new_text() self.start_entry.set_size_request(220, 27) self.start_button = gtk.Button("Import Music") self.start_diag.put(self.start_label, 350, 150) self.start_diag.put(self.start_entry, 290, 175) self.start_diag.put(self.start_button, 355, 208) return self.start_diag
def Generate_GTK(self): box = gtk.VBox(False, 0) # the name of the setting hbox = gtk.HBox(False, 0) label = gtk.Label("") label.set_markup('<span weight="bold">' + self.Name + '</span>') label.set_size_request(150, -1) hbox.pack_start(label, expand=False, fill=False, padding=0) box.pack_start(hbox, expand=False, fill=False, padding=5) # the description of the option hbox = gtk.HBox(False, 0) label = gtk.Label(self.HelpText) label.set_size_request(200, -1) label.set_line_wrap(True) label.set_justify(gtk.JUSTIFY_FILL) hbox.pack_start(label, expand=False, fill=False, padding=0) box.pack_start(hbox, expand=False, fill=False, padding=5) # switch here based on type of gui element. if self.Type == self.OptionType.TEXT: gui_element = gtk.Entry() elif self.Type == self.OptionType.NONE: gui_element = gtk.Label("") # but we want to HIDE the entry so its not visible gui_element.hide() elif self.Type == self.OptionType.COMBO: gui_element = gtk.combo_box_new_text() #gui_element.set_wrap_width(5) elif self.Type == self.OptionType.COMBO_ENTRY: gui_element = gtk.combo_box_entry_new_text() # store it for later :) self.GtkElement = gui_element for option_text in self.Options: gui_element.append_text(option_text) gui_element.set_name(self.Name) gui_element.set_size_request(150, -1) # what we do by default if self.Type == self.OptionType.TEXT or self.Type == self.OptionType.NONE: #gui_element.set_text(() pass elif self.Type == self.OptionType.COMBO: gui_element.set_active(0) hbox = gtk.HBox(False, 0) hbox.pack_start(gui_element, expand=False, fill=False, padding=0) box.pack_start(hbox, expand=False, fill=False, padding=5) return box
def __init__(self,plugin): gtk.VBox.__init__(self) hbox = gtk.HBox(False, 0) self.plugin=plugin self.worker=plugin.worker self.place_request=None self.ignore_release=False self.osm_box=gtk.HBox() self.osm=None self.latlon_entry = gtk.Entry() self.places_combo = gtk.combo_box_entry_new_text() self.places_combo.connect("changed",self.set_place_signal) self.places={} self.source_combo=gtk.combo_box_new_text() for s in map_source: self.source_combo.append_text(s[0]) self.source_combo.connect("changed",self.set_source_signal) self.source_combo.set_active(1) ##open street map by default zoom_in_button = gtk.Button(stock=gtk.STOCK_ZOOM_IN) zoom_in_button.connect('clicked', self.zoom_in_clicked) zoom_out_button = gtk.Button(stock=gtk.STOCK_ZOOM_OUT) zoom_out_button.connect('clicked', self.zoom_out_clicked) home_button = gtk.Button(stock=gtk.STOCK_HOME) home_button.connect('clicked', self.home_clicked) add_place_button = gtk.Button(stock=gtk.STOCK_ADD) add_place_button.connect('clicked', self.add_place_signal) delete_place_button = gtk.Button(stock=gtk.STOCK_REMOVE) delete_place_button.connect('clicked', self.delete_place_signal) # cache_button = gtk.Button('Cache') # cache_button.connect('clicked', self.cache_clicked, self.osm) self.pack_start(self.osm_box) hbox.pack_start(zoom_in_button) hbox.pack_start(zoom_out_button) hbox.pack_start(home_button) # hbox.pack_start(cache_button) self.pack_start(hbox, False) hbox_info=gtk.HBox() hbox_info.pack_start(self.latlon_entry) hbox_info.pack_start(self.source_combo, False) self.pack_start(hbox_info,False) hbox_place=gtk.HBox() hbox_place.pack_start(self.places_combo) hbox_place.pack_start(add_place_button,False) hbox_place.pack_start(delete_place_button,False) self.pack_start(hbox_place, False) self.update_map_items() self.show_all()