def create_geotransform_frame(self): self.frames['Geotransform'] = gtk.GtkFrame('') self.frames['Geotransform'].set_shadow_type(gtk.SHADOW_NONE) vbox = gtk.GtkVBox() vbox.set_spacing(spc) self.frames['Geotransform'].add(vbox) label = gtk.GtkLabel('Xgeo = GT(0) + XPixel*GT(1) + YLine*GT(2)') label.set_alignment(0, 0.5) vbox.pack_start(label) label = gtk.GtkLabel('Ygeo = GT(3) + XPixel*GT(4) + YLine*GT(5)') label.set_alignment(0, 0.5) vbox.pack_start(label) table = gtk.GtkTable(rows=6, cols=3) self.geotransform_entries = [] for idx in range(6): label = gtk.GtkLabel('GT(' + str(idx) + '):') label.set_alignment(0, 0.5) table.attach(label, 0, 1, idx, idx + 1) newentry = gtk.GtkEntry() self.geotransform_entries.append(newentry) table.attach(newentry, 1, 2, idx, idx + 1) vbox.pack_start(table) self.geotransformprjbox = ProjectionBox(self.tips) vbox.pack_start(self.geotransformprjbox) self.frames['Geotransform'].show_all() self.pack_start(self.frames['Geotransform'])
def create(self, path, accelerator=None, callback=None, *args): """ create a single menuitem and add it to one of the menus already created (or create a new one) """ last_slash = string.rfind(path, '/') if last_slash < 0: parentmenu = self.__w else: parentmenu = self.get_menu(path[:last_slash]) label = path[last_slash+1:] if label == '<separator>': item = gtk.GtkMenuItem() elif label[:7] == '<image:': end = string.find(label, '>') img_name = label[7:end] hbox = gtk.GtkHBox(spacing=2) try: hbox.pack_start(self.create_pixmap(img_name), expand=FALSE) except: print 'Unable to load menu pixmap: ' + img_name lbl = gtk.GtkLabel(label[end+1:]) lbl.set_justify(gtk.JUSTIFY_LEFT) hbox.pack_start(lbl, expand=FALSE) item = gtk.GtkMenuItem() item.add(hbox) item.show_all() elif label[:8] == '<toggle>': item = pguToggleMenuItem(label[8:]) elif label[:7] == '<check>': item = gtk.GtkCheckMenuItem(label[7:]) else: if parentmenu == self.__w: item = gtk.GtkMenuItem(label) else: hbox = gtk.GtkHBox() spc = gtk.GtkLabel('') spc.set_usize(22,18) hbox.pack_start(spc, expand=FALSE) lbl = gtk.GtkLabel(label) lbl.set_justify(gtk.JUSTIFY_LEFT) hbox.pack_start(lbl, expand=FALSE) item = gtk.GtkMenuItem() item.add(hbox) if label != '<nothing>': item.show() if accelerator: key, mods = self.parse_accelerator(accelerator) item.add_accelerator("activate", self.accelerator, key, mods, 'visible') if callback: apply(item.connect, ("activate", callback) + args) # right justify the help menu automatically if string.lower(label) == 'help' and parentmenu == self.__w: item.right_justify() parentmenu.append(item) self.__items[path] = item return item
def __init__(self, ok_cb=None, cancel_cb=None, cb_data=None, classify_type=CLASSIFY_EQUAL_INTERVAL): gtk.GtkWindow.__init__(self) self.set_title('Classification') self.user_ok_cb = ok_cb self.user_cancel_cb = cancel_cb self.user_cb_data = cb_data self.classify_type = classify_type self.set_border_width(6) #main vertical box vbox = gtk.GtkVBox(spacing=6) type_box = gtk.GtkHBox(spacing=6) type_box.pack_start(gtk.GtkLabel('Type:'), expand=gtk.FALSE) opt_menu = gtk.GtkOptionMenu() type_menu = gtk.GtkMenu() #using classification_types dictionary from gvclassification for i in range(len(classification_types)): for type in classification_types.iteritems(): if type[1] == i: item = gtk.GtkMenuItem(type[0]) item.connect('activate', self.type_menu_cb, classification_types[type[0]]) type_menu.append(item) opt_menu.set_menu(type_menu) opt_menu.set_history(classify_type) opt_menu.resize_children() type_box.pack_start(opt_menu) vbox.pack_start(type_box, expand=gtk.FALSE) #Number of classes classes_box = gtk.GtkHBox(spacing=6) classes_box.pack_start(gtk.GtkLabel('Number of classes:')) adj = gtk.GtkAdjustment(5, 2, 80, 1, 5, 5, 0) self.spinner = gtk.GtkSpinButton(adj) self.spinner.set_snap_to_ticks(gtk.TRUE) self.spinner.set_digits(0) classes_box.pack_start(self.spinner) vbox.pack_start(classes_box, expand=gtk.FALSE) #add the ok and cancel buttons button_box = gtk.GtkHButtonBox() ok_button = gtk.GtkButton("OK") ok_button.connect('clicked', self.ok_cb, cb_data) cancel_button = gtk.GtkButton("Cancel") cancel_button.connect('clicked', self.cancel_cb, cb_data) button_box.pack_start(ok_button) button_box.pack_start(cancel_button) vbox.pack_start(button_box, expand=gtk.FALSE) vbox.show_all() self.add(vbox) ok_button.set_flags(gtk.CAN_DEFAULT) ok_button.grab_default()
def __init__(self, master, jabber, agent=None): gtk.GtkWindow.__init__(self) self.connect("delete_event", self.delete_event) self.master = master self.jabber = jabber self.done = None self.agent = agent self.vbox = gtk.GtkVBox(gtk.FALSE, 5) self.add(self.vbox) self.frame = gtk.GtkFrame("New Account") self.jabber.requestRegInfo(self.agent) req = self.jabber.getRegInfo() self.table = gtk.GtkTable(6, 6, gtk.FALSE) self.instr_lbl = gtk.GtkLabel(req[u'instructions']) self.entrys = {} i = 0 for info in req.keys(): if info != u'instructions' and \ info != u'key': self.entrys[info] = {} self.entrys[info]['lbl'] = gtk.GtkLabel(info) self.entrys[info]['lbl'].set_alignment(1, 0.5) self.entrys[info]['entry'] = gtk.GtkEntry() self.table.attach(self.entrys[info]['lbl'], 0, 2, 1 + i, 2 + i, xpadding=3, ypadding=2) self.table.attach(self.entrys[info]['entry'], 2, 6, 1 + i, 2 + i, xpadding=3, ypadding=2) i = i + 1 self.reg_button = gtk.GtkButton('Register') self.table.attach(self.reg_button, 2, 6, 0, 1, xpadding=3, ypadding=2) self.reg_button.connect('clicked', self.register) self.frame.add(self.table) self.vbox.pack_start(self.frame) self.vbox.show_all() self.show() self.set_modal(gtk.TRUE)
def __init__(self, shapes, shapesgridtool=None): gtk.GtkWindow.__init__(self) self.set_title('Schema') shell = gtk.GtkVBox(spacing=5) shell.set_border_width(10) self.add(shell) self.grid = pgugrid.pguGrid(config=(2, 0, 0, 1, 4, 0, 0, 0)) self.grid.subscribe("cell-changed", self.changed_field) self.shapes = shapes self.shapesgridtool = shapesgridtool shell.pack_start(self.grid) # New field box3 = gtk.GtkTable(rows=5, cols=3) box3.set_row_spacings(5) box3.set_col_spacings(5) box3.set_border_width(10) nf_frame = gtk.GtkFrame('Add Field') nf_frame.add(box3) self.new_field_name_entry = gtk.GtkEntry(10) self.new_field_name_entry.set_text('') self.new_field_name_entry.set_editable(gtk.TRUE) self.new_field_width_entry = gtk.GtkEntry(2) self.new_field_width_entry.set_text('20') self.new_field_width_entry.set_editable(gtk.TRUE) self.new_field_precision_entry = gtk.GtkEntry(2) self.new_field_precision_entry.set_text('0') self.new_field_precision_entry.set_editable(gtk.FALSE) self.new_field_precision_entry.set_sensitive(gtk.FALSE) self.new_field_types = ('string', 'integer', 'float') self.new_field_type_menu = gvutils.GvOptionMenu( self.new_field_types, self.new_field_precision_cb) self.new_field_type_menu.set_history(0) box3.attach(gtk.GtkLabel('Name'), 0, 1, 0, 1) box3.attach(self.new_field_name_entry, 1, 2, 0, 1) box3.attach(gtk.GtkLabel('Type'), 0, 1, 1, 2) box3.attach(self.new_field_type_menu, 1, 2, 1, 2) box3.attach(gtk.GtkLabel('Width'), 0, 1, 2, 3) box3.attach(self.new_field_width_entry, 1, 2, 2, 3) box3.attach(gtk.GtkLabel('Precision'), 0, 1, 3, 4) box3.attach(self.new_field_precision_entry, 1, 2, 3, 4) button = gtk.GtkButton("Add") box3.attach(button, 0, 2, 4, 5) button.connect("clicked", self.add_field) shell.pack_start(nf_frame) nf_frame.show_all() # Ability to delete fields? self.fill_grid() self.grid.resize_to_default() self.show_all()
def reset_classification_list(self, *args): """Set the contents of class_list to the classification scheme in the classification object.""" #clear existing UI side items. self.class_list.clear_items(0, -1) del self.color_buttons, self.ranges, self.labels self.color_buttons = [] self.ranges = [] self.labels = [] cls = self.classification #prepare a default classification if one doesn't exist if cls.count == 0: cls.prepare_default(5) symbol = cls.get_symbol(0) #setup the column headers class_item = gtk.GtkListItem() set_widget_background(class_item, (1.0, 0.0, 0.0)) class_box = gtk.GtkHBox() clr_frm = gtk.GtkFrame() clr_frm.add(gtk.GtkLabel('Color')) clr_frm.set_shadow_type(gtk.SHADOW_OUT) if symbol is not None: sym_frm = gtk.GtkFrame() sym_frm.add(gtk.GtkLabel('Symbol')) sym_frm.set_shadow_type(gtk.SHADOW_OUT) scale_frm = gtk.GtkFrame() scale_frm.add(gtk.GtkLabel('Scale')) scale_frm.set_shadow_type(gtk.SHADOW_OUT) else: sym_frm = None scale_frm = None rng_frm = gtk.GtkFrame() rng_frm.add(gtk.GtkLabel('Range')) rng_frm.set_shadow_type(gtk.SHADOW_OUT) lbl_frm = gtk.GtkFrame() lbl_frm.add(gtk.GtkLabel('Label')) lbl_frm.set_shadow_type(gtk.SHADOW_OUT) self.add_classification_item(clr_frm, sym_frm, scale_frm, rng_frm, lbl_frm, gtk.FALSE) #for each class, create an entry in the list for n in range(cls.count): self.insert_class(n) self.class_list.show_all() if self.ramp is not None: self.apply_ramp(self.ramp)
def create_bar(self): ## Here we create the actual bar self.destroy_bar = 0 if not self.progressbox: self.progressbox = gtk.GtkVBox(gtk.TRUE, 10) ## Create the top label, if any if self.name_top and not self.label_top: self.label_top = gtk.GtkLabel() self.label_top.set_text(self.name_top) control_box.pack_start(self.label_top, gtk.TRUE, gtk.FALSE, 0) self.label_top.show() ## Create progress line self.progressline = gtk.GtkHBox(gtk.FALSE, 0) ## Create the progress bar self.progressbar = gtk.GtkProgressBar() self.progressbar.set_orientation(self.orientation) if self.type == "discrete": self.progress_discrete( ) ## if less than 10 things to do in the thread, make the bar discrete elif self.type == "active": self.back_and_forth_state(gtk.TRUE) self.progressbar.set_bar_style(self.style) self.progressline.pack_start(self.progressbar, gtk.TRUE, gtk.TRUE, 10) self.progressbox.pack_start(self.progressline, gtk.TRUE, gtk.TRUE, 0) self.progressbar.show() ## End of progress bar creation ## Stop button lives here self.stopbutton = gtk.GtkButton("Stop") self.stopbutton.connect("clicked", self.stop_it) self.progressline.pack_start(self.stopbutton, gtk.TRUE, gtk.TRUE, 20) self.stopbutton.show() self.progressline.show() ## Create the bottom label, if any if self.name_bottom and not self.label_bottom: self.label_bottom = gtk.GtkLabel() ## control_box.add(self.label_bottom) self.label_bottom.set_text(self.name_bottom) self.progressbox.pack_start(self.label_bottom, gtk.TRUE, gtk.TRUE, 0) self.label_bottom.show()
def __init__(self, tips): gtk.GtkVBox.__init__(self) self.frames = {} self.tips = tips hbox = gtk.GtkHBox() hbox.set_border_width(spc) self.pack_start(hbox) label = gtk.GtkLabel("Input Geocoding: ") label.set_alignment(0, 0.5) hbox.pack_start(label) self.geocode_menu_list = ['Default', 'GCPs', 'Geotransform'] self.geocode_menu = gvutils.GvOptionMenu(self.geocode_menu_list, self.geotype_toggled_cb) self.tips.set_tip( self.geocode_menu, 'Default: Derive geocoding from input bands\n' + 'GCPs: Define new ground control points\n' + 'Geotransform: Define a new affine transformation') hbox.pack_start(self.geocode_menu) hbox.show_all() self.create_default_frame() self.create_gcp_frame() self.create_geotransform_frame() self.geocode_menu.set_history(0) self.geotype_toggled_cb() self.default_fname = None # dataset to use for default info self.default_geotransform = None self.default_gcps = None self.default_prj = ''
def warning_window(title, message): win = gtk.GtkWindow() gui["warning_window"] = win win.set_policy(gtk.TRUE, gtk.TRUE, gtk.FALSE) win.set_title(title) win.set_usize(300, -2) win.connect("delete_event", warning_window_close) win.set_border_width(4) window_pos_mode(win) vbox = gtk.GtkVBox(spacing=5) win.add(vbox) vbox.show() label = gtk.GtkLabel("\n\n" + message + "\n\n") set_font(label) label.show() vbox.pack_start(label) button = gtk.GtkButton("Close") button.connect("clicked", warning_window_close) vbox.pack_start(button, expand=gtk.FALSE) button.set_flags(gtk.CAN_DEFAULT) button.grab_default() button.show() gui["main_window"].set_sensitive(gtk.FALSE) gui["warning_window"].show()
def makeoptmenu(name, opts, default=0, func=None): hbox = gtk.GtkHBox() label = gtk.GtkLabel(name) label.show() hbox.pack_start(label) menu = gtk.GtkMenu() def store(widget, data): self.values[name] = data if func: func(widget, data) for text, data in opts: menu_item = gtk.GtkMenuItem(text) menu_item.connect("activate", store, data) menu_item.show() menu.append(menu_item) option_menu = gtk.GtkOptionMenu() option_menu.set_menu(menu) option_menu.set_history(default) self.values[name] = opts[default][1] option_menu.show() hbox.pack_start(option_menu) hbox.show() return hbox
def __init__(self, master, jabberObj): gtk.GtkDialog.__init__(self) self.jid_str = None self.done = None self.connect("delete_event", self.delete_event) self.master = master self.jabber = jabberObj if self.master: self.set_transient_for(self.master) self.set_usize(200, 150) self.table = gtk.GtkTable(5, 2, gtk.FALSE) self.jid_lbl = gtk.GtkLabel('JID') self.jid_entry = gtk.GtkEntry() self.table.attach(self.jid_lbl, 0, 1, 0, 1) self.table.attach(self.jid_entry, 1, 2, 0, 1) self.add_button = gtk.GtkButton('Add') self.add_button.connect('clicked', self.add) self.action_area.pack_start(self.add_button, expand=gtk.FALSE) self.vbox.pack_start(self.table) self.vbox.show_all() self.action_area.show_all() self.show() self.set_modal(gtk.TRUE)
def __init__(self, master, msg, type=MSG_DIA_TYPE_OK): gtk.GtkDialog.__init__(self) self.done = None self.connect("delete_event", self.delete_event) self.master = master self.set_usize(200, 150) if self.master: self.set_transient_for(self.master) self.msg_lbl = gtk.GtkLabel(msg) self.ok_button = gtk.GtkButton('Ok') self.ok_button.connect('clicked', self.okay) self.action_area.pack_start(self.ok_button, expand=gtk.FALSE) if type == MSG_DIA_TYPE_YESNO: self.cancel_button = gtk.GtkButton('Cancel') self.cancel_button.connect('clicked', self.cancel) self.action_area.pack_start(self.cancel_button, expand=gtk.FALSE) self.vbox.pack_start(self.msg_lbl) self.vbox.show_all() self.action_area.show_all() self.show() self.set_modal(gtk.TRUE)
def create_view(name, plines, areas, raster): win = gtk.GtkWindow() win.set_title(name) win.set_policy(gtk.TRUE, gtk.TRUE, gtk.FALSE) shell = gtk.GtkVBox() win.add(shell) view = gview.GvViewArea() view.size(512,512) shell.pack_start(view, expand=gtk.TRUE) if raster: raster_layer = gview.GvRasterLayer(raster) view.add_layer(raster_layer) view.add_layer(gview.GvPqueryLayer()) view.add_layer(gview.GvAreaLayer(areas)) view.add_layer(gview.GvLineLayer(plines)) statusbar = gtk.GtkHBox() shell.pack_start(statusbar, expand=gtk.FALSE) label = gtk.GtkLabel() statusbar.pack_start(label, expand=gtk.FALSE, padding=3) tracker = gview.GvTrackTool(label) tracker.activate(view) view.connect('key-press-event', testmain_button_press) win.show_all() view.grab_focus() win.connect('delete-event', gtk.mainquit) gtk.quit_add_destroy(1, win) return view
def __init__(self): gtk.GtkFileSelection.__init__(self) self.set_title('Select GCP Text File') self.connect("destroy", self.quit) self.connect("delete_event", self.quit) gtk.grab_add(self) # is modal table = gtk.GtkTable(rows=8, cols=3) self.entries = [] labels = [ 'Delimiter: ', 'Pixel Column # (1-N: required): ', 'Line Column # (required): ', 'X (East/West) Column # (required): ', 'Y (North/South) Column # (required): ', 'Z (Height) Column # (optional): ', 'ID Column # (optional): ', 'Info Column # (optional): ' ] for idx in range(len(labels)): nl = gtk.GtkLabel(labels[idx]) nl.set_alignment(0, 0.5) self.entries.append(gtk.GtkEntry(maxlen=3)) table.attach(nl, 0, 1, idx, idx + 1) table.attach(self.entries[idx], 1, 2, idx, idx + 1) self.main_vbox.pack_end(table) table.show_all() self.cancel_button.connect('clicked', self.quit) self.ok_button.connect('clicked', self.ok_cb) self.ret = None
def init_customize_gui_panel(self): # By now, main panel, basic frames, buttons have been created # Middle frame (region display) must be filled in. patch_table = gtk.GtkTable(1,4,FALSE) self.show_list.append(patch_table) self.frame_dict['base_frame2'].add(patch_table) patch_table.set_border_width(5) patch_table.set_col_spacings(5) patch_table.set_col_spacing(1, 20) label1 = gtk.GtkLabel('Line: ') label1.set_alignment(0, 0.5) patch_table.attach(label1, 0,1, 0, 1) self.entry_dict['line'] = gtk.GtkEntry() self.entry_dict['line'].set_editable(gtk.FALSE) self.entry_dict['line'].set_usize(90, 25) self.entry_dict['line'].set_text('1') patch_table.attach(self.entry_dict['line'], 1,2, 0,1) label2 = gtk.GtkLabel('Pixel: ') label2.set_alignment(0, 0.5) patch_table.attach(label2, 2,3,0, 1) self.entry_dict['pixel'] = gtk.GtkEntry() self.entry_dict['pixel'].set_editable(gtk.FALSE) self.entry_dict['pixel'].set_usize(90, 25) self.entry_dict['pixel'].set_text('1') patch_table.attach(self.entry_dict['pixel'], 3,4, 0,1) # Create tooltips self.tooltips = gtk.GtkTooltips() tip_text = "Re-enable point-of-interest selection mode (" + \ "required for this tool's operation)." self.tooltips.set_tip(self.button_dict['Set Tool'],tip_text) tip_text = 'Automatically update every time the point of ' + \ 'interest changes.' self.tooltips.set_tip(self.button_dict['Auto Update'],tip_text) tip_text = 'Enable/Disable this tool.' self.tooltips.set_tip(self.button_dict['Activate'],tip_text) tip_text = 'Perform analysis.' self.tooltips.set_tip(self.button_dict['Analyze'],tip_text) self.frame_dict['base_frame2'].show_all()
def __init__(self, default=0): import gtk gtk.GtkToggleButton.__init__(self) self.label = gtk.GtkLabel("No") self.add(self.label) self.label.show() self.connect("toggled", self.changed) self.set_active(default)
def __init__(self): """initialize the ramp """ gtk.GtkFrame.__init__(self) self.set_shadow_type(gtk.SHADOW_NONE) self.colors = [] self.gradient = ColorGradientSwatch(self) self.title = gtk.GtkLabel('Ramp') fix = gtk.GtkFixed() fix.put(self.gradient, 1, 0) fix.put(self.title, 84, 0) self.add(fix) self.type = RAMP_GRADIENT
def __init__(self): gtk.GtkWindow.__init__(self) self.connect("delete_event", self.close); vbox = gtk.GtkVBox(gtk.FALSE, 8) # { self.label = gtk.GtkLabel("XXXXXXXXXX") # { self.label.show() vbox.pack_start(self.label) # } btn = gtk.GtkButton("Close") # { btn.connect("clicked", self.onCloseClicked) btn.show() vbox.pack_start(btn) # } vbox.show() self.add(vbox) # }
def __init__(self): self.pinfo = None gtk.GtkWindow.__init__(self) self.connect("delete_event", lambda self, *args: sys.exit(0)) vbox = gtk.GtkVBox() # { label = gtk.GtkLabel("hoge") # { label.show() vbox.pack_start(label) # } btn = gtk.GtkButton("close") # { btn.connect("clicked", self.onCloseClicked) btn.show() vbox.pack_start(btn) # } vbox.show() self.add(vbox) # }
def __init__(self): #print self.send_ gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_title("Reality Faucet") self.set_usize(640, 480) self.namelabel = gtk.GtkLabel("NameLabel") self.descbox = gtk.GtkText() self.descbox.set_usize(370, 255) self.descbox.set_word_wrap(gtk.TRUE) self.descscrl = gtkutil.scrollify(self.descbox) gtkutil.defocusify(self.descbox) self.itembox = gtk.GtkText() self.itembox.set_word_wrap(gtk.TRUE) self.itemscrl = gtkutil.scrollify(self.itembox) gtkutil.defocusify(self.itembox) self.happenings = gtk.GtkText() self.happenings.set_word_wrap(gtk.TRUE) self.happscrl = gtkutil.scrollify(self.happenings) gtkutil.defocusify(self.happenings) self.cmdarea = gtk.GtkEntry() self.hpaned = gtk.GtkHPaned() self.hpaned.add1(self.descscrl) self.hpaned.add2(self.itemscrl) self.vpaned = gtk.GtkVPaned() self.vpaned.add1(self.hpaned) self.vpaned.add2(self.happscrl) self.vbox = gtk.GtkVBox() self.vbox.pack_start(self.namelabel, expand=0) self.vbox.add(self.vpaned) self.vbox.pack_start(self.cmdarea, expand=0) self.add(self.vbox) self.signal_connect('destroy', gtk.mainquit, None) self.cmdarea.connect("key_press_event", self.processKey) self.cmdarea.grab_focus() self.history = [''] self.descriptions = {} self.items = {} self.exits = []
def __init__(self, title, text): self.window = gtk.GtkWindow(gtk.WINDOW_POPUP) self.window.set_title(title) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_modal(gtk.TRUE) self.label = gtk.GtkLabel(text) self.label.set_line_wrap(gtk.TRUE) box = gtk.GtkFrame() box.set_border_width(8) box.add(self.label) box.set_shadow_type(gtk.SHADOW_NONE) frame = gtk.GtkFrame() frame.set_shadow_type(gtk.SHADOW_OUT) frame.add(box) self.window.add(frame) self.window.show_all()
def about_window(): win = gtk.GtkWindow() gui["about_window"] = win win.set_policy(gtk.TRUE, gtk.TRUE, gtk.FALSE) win.set_title("About") win.connect("delete_event", about_window_close) win.set_border_width(2) window_pos_mode(win) frame = gtk.GtkFrame() frame.show() frame.set_border_width(2) win.add(frame) vbox = gtk.GtkVBox(spacing=5) vbox.show() frame.add(vbox) label = gtk.GtkLabel("\n\n" + "Clarence (programmer's calculator)\n" "\nversion " + version + "\n\n" "Written by Tomasz Maka <*****@*****.**>\n") set_font(label) label.show() vbox.pack_start(label) entry = gtk.GtkEntry() gui["http_entry"] = entry entry.set_editable(gtk.FALSE) entry.set_usize(290, -2) set_font(entry) entry.show() vbox.pack_start(entry) entry.set_text("http://clay.ll.pl/clarence.html") button = gtk.GtkButton("OK") button.connect("clicked", about_window_close) vbox.pack_start(button, expand=gtk.FALSE) button.set_flags(gtk.CAN_DEFAULT) button.grab_default() button.show() gui["main_window"].set_sensitive(gtk.FALSE) gui["about_window"].show()
def __init__(self, label=""): import pgutogglebutton gtk.GtkMenuItem.__init__( self ) hbox = gtk.GtkHBox( spacing = 2 ) self.tb = pgutogglebutton.pguToggleButton( ) self.tb.connect( 'toggled', self.toggled_cb) hbox.pack_start( self.tb, expand=FALSE ) evt_box = gtk.GtkEventBox() evt_box.connect( 'button-release-event', self.toggle_it ) lbl = gtk.GtkLabel( label ) evt_box.add( lbl ) hbox.pack_start( evt_box ) self.add( hbox ) self.show_all()
def __init__(self): gtk.GtkDialog.__init__(self) self.jid_str = None self.done = None self.type = 'available' self.connect("delete_event", self.delete_event) #self.master = master #self.jabber = jabberObj self.set_usize(200, 150) self.table = gtk.GtkTable(5, 2, gtk.FALSE) self.jid_lbl = gtk.GtkLabel('Status') self.jid_entry = gtk.GtkEntry() self.table.attach(self.jid_lbl, 0, 1, 0, 1) self.table.attach(self.jid_entry, 1, 2, 0, 1) self.add_button = gtk.GtkButton('Set') self.add_button.connect('clicked', self.set) self.action_area.pack_start(self.add_button, expand=gtk.FALSE) self.avail_radio = gtk.GtkRadioButton(None, 'available') self.unavail_radio = gtk.GtkRadioButton(self.avail_radio, 'unavailable') self.avail_radio.connect('clicked', self.avail) self.unavail_radio.connect('clicked', self.unavail) self.avail_radio.set_active(gtk.TRUE) self.table.attach(self.avail_radio, 0, 2, 1, 2) self.table.attach(self.unavail_radio, 0, 2, 2, 3) self.vbox.pack_start(self.table) self.vbox.show_all() self.action_area.show_all() self.show() self.set_modal(gtk.TRUE)
def buildToolBar(self): box = gtk.GtkVBox(gtk.FALSE, 0) l = [["New polygon", MapPolygon], ["New fuel", MapFuel], ["New checkpoint", MapCheckPoint], ["New ball", MapBall], ["New base", MapBase]] l = [[a, self.newObject, b] for a, b in l] l.extend([["Erase", self.toggleEraseMode, None], ["Toggle points", self.canvasToggle, 'showPoints'], ["Toggle filled", self.canvasToggle, 'filled'], ["Toggle textured", self.canvasToggle, 'textured'], ["Undo", self.undo, -1], ["Redo", self.undo, 1], ["Zoom in", self.zoom, 1], ["Zoom out", self.zoom, -1]]) for name, callback, data in l: button = gtk.GtkButton(name) button.connect("clicked", callback, data) box.pack_start(button, gtk.FALSE, gtk.FALSE, 0) button.show() self.zoomlabel = gtk.GtkLabel("1.00") self.zoomlabel.show() box.pack_start(self.zoomlabel, gtk.FALSE, gtk.FALSE, 0) self.box1.pack_start(box, gtk.FALSE, gtk.FALSE, 0) box.show()
def add_classification_item(self, clr, sym, scl, rng, lbl, delete_button=gtk.TRUE): """add a single row to the classification list. Optionally add a delete button that will delete that row from the classification. """ class_item = gtk.GtkListItem() class_box = gtk.GtkHBox() #explicitly size the first 5, let the last one fill the rest of the #space. clr.set_usize(70, -1) if sym is not None: sym.set_usize(70, -1) if scl is not None: scl.set_usize(70, -1) rng.set_usize(130, -1) lbl.set_usize(130, -1) class_box.pack_start(clr, expand=gtk.FALSE, fill=gtk.FALSE) if sym is not None: class_box.pack_start(sym, expand=gtk.FALSE, fill=gtk.FALSE) if scl is not None: class_box.pack_start(scl, expand=gtk.FALSE, fill=gtk.FALSE) class_box.pack_start(rng, expand=gtk.FALSE, fill=gtk.FALSE) class_box.pack_start(lbl, expand=gtk.FALSE, fill=gtk.FALSE) if delete_button: del_btn = gtk.GtkButton('x') del_btn.set_usize(45, -1) del_btn.connect('clicked', self.delete_item, class_item) class_box.pack_start(del_btn, expand=gtk.FALSE, fill=gtk.FALSE) class_box.add(gtk.GtkLabel('')) class_item.add(class_box) class_item.show() self.class_list.add(class_item)
def report_error(err): "Write 'error' to stderr and, if possible, display a dialog box too." try: sys.stderr.write('*** ' + err + '\n') except: pass try: import pygtk; pygtk.require('2.0') import gtk; g = gtk except: import gtk win = gtk.GtkDialog() message = gtk.GtkLabel(err + '\n\nAlso, pygtk2 needs to be present') win.set_title('Missing ROX-Lib2') win.set_position(gtk.WIN_POS_CENTER) message.set_padding(20, 20) win.vbox.pack_start(message) ok = gtk.GtkButton("OK") ok.set_flags(gtk.CAN_DEFAULT) win.action_area.pack_start(ok) ok.connect('clicked', gtk.mainquit) ok.grab_default() win.connect('destroy', gtk.mainquit) win.show_all() gtk.mainloop() else: box = g.MessageDialog(None, g.MESSAGE_ERROR, 0, g.BUTTONS_OK, err) box.set_title('Missing ROX-Lib2') box.set_position(g.WIN_POS_CENTER) box.set_default_response(g.RESPONSE_OK) box.run() sys.exit(1)
def __init__(self, r, a, w): self.attachment = a self.reader = r self.page = gtk.GtkFrame(None) xml = self.reader.readglade("messageframe", self) self.frame_widget = sqmail.gui.utils.WidgetStore(xml) self.frame_widget.frame.hide() self.frame_widget.frame.reparent(self.page) self.frame_widget.messageframe.destroy() xml = self.reader.readglade(w, self) self.viewer_widget = sqmail.gui.utils.WidgetStore(xml) self.viewer_widget.frame.hide() self.viewer_widget.frame.reparent(self.frame_widget.container) self.viewer_widget[w].destroy() self.page.show() self.tab = gtk.GtkLabel(self.attachment[0]) self.frame_widget.attachmentinfo.set_text(self.getdescription()) self.viewer_widget.frame.show() self.frame_widget.frame.show()
def destroy(*args): window.hide() gtk.mainquit() window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL) window.connect("destroy", destroy) window.set_border_width(10) window.set_usize(500, 100) control_box = gtk.GtkVBox(gtk.FALSE,0) window.add(control_box) control_box.show() ## create label label = gtk.GtkLabel() control_box.add(label) label.set_text("No threads running") label.show() ## create static bar a_bar_obj = ProgressBar(100) a_bar = a_bar_obj.get_bar() control_box.pack_start(a_bar, gtk.TRUE, gtk.FALSE, 0) a_bar.show() ## create button button = gtk.GtkButton(" Start Thread ") button.connect("clicked", start_new_thread, label, a_bar_obj) control_box.add(button)
glarea = gtkgl.GtkGLArea((gtkgl.RGBA, gtkgl.DEPTH_SIZE, 1, gtkgl.DOUBLEBUFFER)) glarea.size(300, 300) glarea.connect("realize", init) glarea.connect("size_allocate", reshape) glarea.connect("expose_event", draw) gtk.idle_add(idle) table.attach(glarea, 0,2, 0,1) glarea.show() for row, label, start, cb in ((1,'X Rotation', view_rotx, xchange), (2,'Y Rotation', view_roty, ychange), (3,'Z Rotation', view_rotz, zchange)): l = gtk.GtkLabel(label) table.attach(l, 0,1, row,row+1, xoptions=0, yoptions=gtk.FILL) l.show() adj = gtk.GtkAdjustment(start, 0, 360, 5, 5, 0) adj.connect("value_changed", cb) scale = gtk.GtkHScale(adj) table.attach(scale, 1,2, row,row+1, yoptions=gtk.FILL) scale.show() win.show() gtk.mainloop() glarea.destroy()