def __init__(self, rlayer): gtk.GtkWindow.__init__(self) import gview self.rlayer = rlayer raster = rlayer.get_data() self.xsize = raster.get_dataset().RasterXSize self.ysize = raster.get_dataset().RasterYSize self.set_policy(gtk.TRUE, gtk.TRUE, gtk.FALSE) # self.set_usize(self.xsize, self.ysize) self.viewarea = gview.GvViewArea() self.viewarea.add_layer(self.rlayer) self.viewarea.size(self.xsize, self.ysize) shell = gtk.GtkVBox(spacing=0) self.add(shell) # Print menu menuf = GtkExtra.MenuFactory() self.menuf = menuf menuf.add_entries([('File/Print', None, self.print_cb)]) shell.pack_start(menuf, expand=gtk.FALSE) shell.pack_start(self.viewarea) self.connect('delete-event', self.close) self.show_all() self.viewarea.fit_extents(0, self.ysize, self.xsize, -self.ysize)
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 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 __init__(self, ok_cb=None, cancel_cb=None, cb_data=None): gtk.GtkWindow.__init__(self) self.set_title('Select a Color') vbox = gtk.GtkVBox(spacing=3) self.add(vbox) self.user_ok_cb = ok_cb self.user_cancel_cb = cancel_cb self.user_cb_data = cb_data self.connect('delete-event', self.user_cancel_cb) #add the color selection widget self.colorsel = gtk.GtkColorSelection() self.colorsel.set_opacity(gtk.TRUE) vbox.pack_start(self.colorsel) #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() ok_button.set_flags(gtk.CAN_DEFAULT) ok_button.grab_default()
def init_customize_gui_panel(self): # Inherit all the usual stuff... General_POIToolDlg.init_customize_gui_panel(self) # Add new frame with pixel info, keeping track of # the frame and text object... self.frame_dict['pixel_info_frame'] = gtk.GtkFrame() self.show_list.append(self.frame_dict['pixel_info_frame']) pixel_vbox = gtk.GtkVBox() self.show_list.append(pixel_vbox) self.frame_dict['pixel_info_frame'].add(pixel_vbox) pixel_scroll = gtk.GtkScrolledWindow() self.show_list.append(pixel_scroll) pixel_vbox.pack_start(pixel_scroll,expand = gtk.TRUE) self.entry_dict['pixel_info_text'] = gtk.GtkText() self.show_list.append(self.entry_dict['pixel_info_text']) self.entry_dict['pixel_info_text'].set_line_wrap(gtk.FALSE) self.entry_dict['pixel_info_text'].set_word_wrap(gtk.FALSE) self.entry_dict['pixel_info_text'].set_editable(gtk.FALSE) pixel_scroll.add(self.entry_dict['pixel_info_text']) self.entry_dict['pixel_info_text'].insert_defaults('') self.main_panel.pack_start(self.frame_dict['pixel_info_frame'],gtk.TRUE,gtk.TRUE,0)
def __init__(self, title): gtk.GtkWindow.__init__(self) self.set_title(title) self.vbox = gtk.GtkVBox() self.add(self.vbox) self.hbox = gtk.GtkHBox() self.vbox.pack_end(self.hbox)
def __init__(self, size=(300,300), name="Piddle-GTK", infoline=1): """Initialize the canvas and minimal supporting widgets. If |infoline| is true (the default), a status bar will be included at the bottom of the window to support the ,setInfoLine() method. If false, no statusbar will be used. """ import gtk # width, height = (int(round(size[0])), int(round(size[1]))) # top = self.__top = gtk.GtkWindow() vbox = self.__vbox = gtk.GtkVBox() da = gtk.GtkDrawingArea() # top.add(vbox) vbox.pack_start(da) if infoline: sbar = self.__sbar = gtk.GtkStatusbar() vbox.pack_end(sbar, expand=0) sbar.set_border_width(2) else: self.__sbar = None InteractiveCanvas.__init__(self, da, top) top.set_wmclass("canvas", "Canvas") da.realize() da.set_usize(width, height) top.show_all() top.set_icon_name(name) top.set_title(name) self.ensure_size(width, height) self.__status = None
def __init__(self, imgui, *args, **kw): apply(gtk.GtkWindow.__init__, (self, ) + args, kw) self.imgui = imgui self.accounts = [] vbox = gtk.GtkVBox(gtk.FALSE, 5) vbox.set_border_width(5) self.add(vbox) titles = ['Username', 'Online', 'Auto-Login', 'Gateway'] clist = gtk.GtkCList(len(titles), titles) clist.signal_connect("select_row", self.rowSelected) clist.set_shadow_type(gtk.SHADOW_OUT) scrolled = gtk.GtkScrolledWindow(None, None) scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) vbox.pack_start(scrolled, gtk.TRUE, gtk.TRUE, 0) scrolled.add(clist) hb = gtk.GtkHBox(gtk.FALSE, 0) vbox.pack_start(hb, gtk.FALSE, gtk.TRUE, 0) addB = gtk.GtkButton("Add") modifyB = gtk.GtkButton("Modify") loginB = gtk.GtkButton("Logon") deleteB = gtk.GtkButton("Delete") map(hb.add, [addB, modifyB, loginB, deleteB]) self.imgui.im.connect(self.event_attach, "attach") self.imgui.im.connect(self.event_detach, "detach") self.signal_connect('destroy', gtk.mainquit, None)
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 __init__(self): gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_title("Manhole Interaction") self.set_usize(300,300) self['name'] = "Manhole" vbox = gtk.GtkVBox() pane = gtk.GtkVPaned() self.output = OutputConsole(toplevel=self) pane.pack1(gtkutil.scrollify(self.output), gtk.TRUE, gtk.FALSE) self.input = InputText(toplevel=self) pane.pack2(gtkutil.scrollify(self.input), gtk.FALSE, gtk.TRUE) vbox.pack_start(pane, 1,1,0) self.add(vbox) self.input.grab_focus() self.signal_connect('destroy', gtk.mainquit, None) if _GNOME_POWER: self.display = BrowserDisplay() dWindow = gtk.GtkWindow(title="Spelunking") dWindow.add(self.display) dWindow.show_all() else: self.display = BrowserDisplay(self) # The referencable attached to the Perspective self.client = self self.remote_receiveBrowserObject=self.display.receiveBrowserObject self.remote_console = self.output.console
def __init__(self, question, default, callback): gtk.GtkWindow.__init__(self) self.callback = callback self.text = gtk.GtkText() self.set_title(question) self.text.set_editable(gtk.TRUE) self.text.insert_defaults(default) self.text.set_word_wrap(gtk.TRUE) scrl = gtkutil.scrollify(self.text) vb = gtk.GtkVBox() bb = gtk.GtkHButtonBox() vb.pack_start(scrl) bb.set_spacing(0) bb.set_layout(gtk.BUTTONBOX_END) cancelb = gtkutil.cbutton("Cancel", self.callcancel) bb.add(cancelb) okb = gtkutil.cbutton("OK", self.callok) cancelb.set_flags(gtk.CAN_DEFAULT) okb.set_flags(gtk.CAN_DEFAULT) okb.set_flags(gtk.HAS_DEFAULT) bb.add(okb) vb.add(bb, expand=gtk.FALSE) self.add(vb) self.set_usize(300, 200) self.connect('delete_event', dontgo) self.show_all()
def __init__(self): gtk.GtkHBox.__init__(self, gtk.FALSE, 5) self.entry = gtk.GtkEntry() self.pack_start(self.entry) self.entry.show() self.button = gtk.GtkButton("...") self.button.connect("clicked", self.show_dialog) self.pack_start(self.button, expand=gtk.FALSE) self.button.show() self.dialog = gtk.GtkDialog() self.dialog.set_title(self.get_title()) def delete_event(win, event): win.hide() return gtk.TRUE self.dialog.connect("delete_event", delete_event) box = gtk.GtkVBox() box.set_border_width(5) self.dialog.vbox.pack_start(box) box.show() swin = gtk.GtkScrolledWindow() swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) box.pack_start(swin) swin.show() items = map(None, self.get_list()) list = gtk.GtkList() list.set_selection_mode(gtk.SELECTION_BROWSE) self.selected = self.get_default() self.entry.set_text(self.selected) items.sort() for s in items: item = gtk.GtkListItem(s) list.add(item) if s == self.selected: list.select_child(item) item.show() swin.add_with_viewport(list) list.show() b = gtk.GtkButton("OK") self.dialog.action_area.pack_start(b) b.set_flags(gtk.CAN_DEFAULT) b.grab_default() b.show() b.connect("clicked", self.selection_ok, list) b = gtk.GtkButton("Cancel") self.dialog.action_area.pack_start(b) b.set_flags(gtk.CAN_DEFAULT) b.show() b.connect("clicked", self.dialog.hide) self.dialog.set_usize(300, 225)
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, echoer): l.hide() self.echoer = echoer w = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL) vb = gtk.GtkVBox(); b = gtk.GtkButton("Echo:") self.entry = gtk.GtkEntry(); self.outry = gtk.GtkEntry() w.add(vb) map(vb.add, [b, self.entry, self.outry]) b.connect('clicked', self.clicked) w.connect('destroy', gtk.mainquit) w.show_all()
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): self.canvas = None self.window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.delete_event) self.window.set_title("jXPMap Editor") self.box0 = gtk.GtkVBox(gtk.FALSE, 0) menubar = self.buildMenuBar() self.box0.pack_start(menubar, gtk.FALSE, gtk.FALSE, 0) self.box1 = gtk.GtkHBox(gtk.FALSE, 0) self.box0.pack_start(self.box1, gtk.TRUE, gtk.TRUE, 0) self.window.add(self.box0) self.buildToolBar() #self.ActionMap() #self.buildInputMap() # The visual calls are needed to make sure drawing bitmaps # (draw_*_image) works # ... at least according to some documentation that doesn't look # entirely reliable gtk.push_rgb_visual() area = gtk.GtkDrawingArea() gtk.pop_visual() area.size(500, 500) self.box1.pack_start(area, gtk.TRUE, gtk.TRUE, 0) area.connect("expose-event", self.area_expose_cb) # Change the default background to black so that the window # doesn't flash badly when resizing style = area.get_style().copy() style.bg[gtk.STATE_NORMAL] = area.get_colormap().alloc(0, 0, 0) area.set_style(style) area.connect("button_press_event", self.mouse_event) area.connect("button_release_event", self.mouse_event) area.connect("motion_notify_event", self.mouse_event) area.connect("configure_event", self.configure_event) area.set_events(GDK.EXPOSURE_MASK | GDK.BUTTON_PRESS_MASK | GDK.BUTTON_RELEASE_MASK | GDK.POINTER_MOTION_MASK | GDK.POINTER_MOTION_HINT_MASK) # The HINT_MASK means there won't be a callback for every mouse # motion event, only after certain other events or after an explicit # reading of the location with x, y = window.pointer. # This helps to avoid getting a queue of events if they're not handled # quickly enough. area.show() self.zoom = 0 self.box1.show() self.box0.show() self.window.show() self.canvas = MapCanvas(area)
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 main(): from vtkmodules.vtkFiltersSources import vtkConeSource from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper, vtkRenderer # load implementations for rendering and interaction factory classes import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle # The main window window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL) window.set_title("A GtkVTKRenderWindow Demo!") window.connect("destroy", gtk.mainquit) window.connect("delete_event", gtk.mainquit) window.set_border_width(10) # A VBox into which widgets are packed. vbox = gtk.GtkVBox(spacing=3) window.add(vbox) vbox.show() # The GtkVTKRenderWindow gvtk = GtkVTKRenderWindowInteractor() #gvtk.SetDesiredUpdateRate(1000) gvtk.set_usize(400, 400) vbox.pack_start(gvtk) gvtk.show() gvtk.Initialize() gvtk.Start() # prevents 'q' from exiting the app. gvtk.AddObserver("ExitEvent", lambda o, e, x=None: x) # The VTK stuff. cone = vtkConeSource() cone.SetResolution(80) coneMapper = vtkPolyDataMapper() coneMapper.SetInputConnection(cone.GetOutputPort()) #coneActor = vtkLODActor() coneActor = vtkActor() coneActor.SetMapper(coneMapper) coneActor.GetProperty().SetColor(0.5, 0.5, 1.0) ren = vtkRenderer() gvtk.GetRenderWindow().AddRenderer(ren) ren.AddActor(coneActor) # A simple quit button quit = gtk.GtkButton("Quit!") quit.connect("clicked", gtk.mainquit) vbox.pack_start(quit) quit.show() # show the main window and start event processing. window.show() gtk.mainloop()
def __init__(self): gtk.GtkWindow.__init__(self) vbox = gtk.GtkVBox() self.add(vbox) self.cmb = pguCombo(['test1', 'test2', 'long test string']) self.cmb.entry.connect('changed', self.item_changed) vbox.pack_start(self.cmb) self.connect('delete-event', gtk.mainquit) self.show_all()
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, title='pygtk app', jabberObj=None, width=None, height=None): gtk.GtkWindow.__init__(self) self.set_title(title) if width is None: if gtk.screen_width() > 300: ## Fit the display width = 320 height = 200 else: width = 240 height = 300 self._tabs = [] self.cols = {} self.jabberObj = jabberObj self.roster_selected = None self.set_usize(width, height) self.connect("delete_event", self.quit) self.box = gtk.GtkVBox() self.add(self.box) self.box.show() self.tbox = gtk.GtkHBox() self.checkItemCalled = 0 self.init_menu() self.init_status_select() self.close_but = gtk.GtkButton('X') self.close_but.connect("clicked", self.closeTabCB) self.close_but.show() self.tbox.pack_end(self.close_but, fill=gtk.FALSE, expand=gtk.FALSE) self.tbox.show() self.box.pack_start(self.tbox, fill=gtk.FALSE, expand=gtk.FALSE) self.notebook = gtk.GtkNotebook() self.notebook.set_tab_pos(gtk.POS_BOTTOM) self.notebook.set_scrollable(gtk.TRUE) self.notebook.connect('switch_page', self.notebook_switched) self.box.pack_end(self.notebook, fill=gtk.TRUE, expand=gtk.TRUE) self._tabs.append(Roster_Tab(self, 'roster')) self.notebook.show() self.show()
def __init__(self, size=(500, 400), name="p4VASP graph", infoline=None, drawing_area=None, top=None, world=None, graphdata=None): self.lastmotiontime = 0 width, height = (int(round(size[0])), int(round(size[1]))) self.world = world if drawing_area is None: if top is None: top = gtk.GtkWindow() vbox = gtk.GtkVBox() da = gtk.GtkDrawingArea() top.add(vbox) vbox.pack_start(da) if infoline: sbar = self.__sbar = gtk.GtkStatusbar() vbox.pack_end(sbar, expand=0) sbar.set_border_width(2) else: self.__sbar = None else: da = drawing_area if infoline is None: self.__sbar = None else: self.__sbar = infoline self.top = top piddleGTKp4.InteractiveCanvas.__init__(self, da, top) # top.set_wmclass("canvas", "Canvas") da.realize() da.set_usize(width, height) # top.show_all() # top.set_icon_name(name) # top.set_title(name) self.ensure_size(width, height) self.__status = None self.world = world self.graphdata = graphdata self.onOver = self.onOverCallback self.onClick = self.onClickCallback self.onKey = self.onKeyCallback self.point = -1, -1 self.selected_begin = None
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): 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 functions_help_window(*args): if gui["fhelp_window"] == 0: win = gtk.GtkWindow() gui["fhelp_window"] = win win.set_policy(gtk.TRUE, gtk.TRUE, gtk.FALSE) win.set_title("Available functions and constants") win.set_usize(500, 300) win.connect("delete_event", fhelp_window_close) win.set_border_width(4) window_pos_mode(win) vbox = gtk.GtkVBox(spacing=5) win.add(vbox) vbox.show() scrolled_window = gtk.GtkScrolledWindow() vbox.pack_start(scrolled_window, expand=gtk.TRUE) scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolled_window.show() clist = gtk.GtkCList(2) clist.set_row_height(18) clist.set_column_width(0, 180) clist.set_column_width(1, 520) clist.set_selection_mode(gtk.SELECTION_BROWSE) set_font(clist) scrolled_window.add(clist) clist.show() mlist = map(lambda i: "", range(2)) clist.freeze() for i in range(len(flist) / 2): mlist[0] = flist[i * 2] mlist[1] = flist[i * 2 + 1] clist.append(mlist) clist.thaw() button = gtk.GtkButton("Close") button.connect("clicked", fhelp_window_close) vbox.pack_start(button, expand=gtk.FALSE) button.set_flags(gtk.CAN_DEFAULT) button.grab_default() button.show() gui["fhelp_window"].show() else: gui["fhelp_window"].get_window()._raise()
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): gtk.GtkWindow.__init__(self) self.set_title("Test TextArea") vbox = gtk.GtkVBox() self.text = pguTextArea() self.entry = gtk.GtkEntry() self.button = gtk.GtkButton("insert") self.button.connect("clicked", self.insert_text) vbox.pack_start(self.text) vbox.pack_start(self.entry, expand=gtk.FALSE) vbox.pack_start(self.button, expand=gtk.FALSE) self.add(vbox) self.show_all()
def init_create_gui_panel(self): # Basic Buttons... self.button_dict['Analyze'] = gtk.GtkButton('Analyze') self.show_list.append(self.button_dict['Analyze']) self.button_dict['Activate'] = gtk.GtkCheckButton('Activate') self.show_list.append(self.button_dict['Activate']) self.button_dict['Auto Update'] = gtk.GtkCheckButton('Auto Update') self.show_list.append(self.button_dict['Auto Update']) self.button_dict['Set Tool'] = gtk.GtkButton('Set Tool') self.show_list.append(self.button_dict['Set Tool']) # Basic Frames... # first frame self.frame_dict['base_frame1'] = gtk.GtkFrame() self.show_list.append(self.frame_dict['base_frame1']) hbox1 = gtk.GtkHBox(gtk.TRUE,5) self.show_list.append(hbox1) hbox1.pack_end(self.button_dict['Analyze'],gtk.TRUE,gtk.TRUE,0) self.frame_dict['base_frame1'].add(hbox1) # second frame- will contain roi or poi info self.frame_dict['base_frame2'] = gtk.GtkFrame() self.show_list.append(self.frame_dict['base_frame2']) # third frame self.frame_dict['base_frame3'] = gtk.GtkFrame(); self.show_list.append(self.frame_dict['base_frame3']) hbox3 = gtk.GtkHBox(gtk.TRUE,5) self.show_list.append(hbox3) hbox3.pack_start(self.button_dict['Activate'],gtk.TRUE,gtk.TRUE,0) hbox3.pack_start(self.button_dict['Auto Update'],gtk.TRUE,gtk.TRUE,0) hbox3.pack_start(self.button_dict['Set Tool'],gtk.TRUE,gtk.TRUE,0) self.frame_dict['base_frame3'].add(hbox3) # Top level panel... self.main_panel = gtk.GtkVBox(gtk.FALSE,5) self.main_panel.pack_start(self.frame_dict['base_frame1'],gtk.FALSE,gtk.FALSE,0) self.main_panel.pack_start(self.frame_dict['base_frame2'],gtk.FALSE,gtk.FALSE,0) self.main_panel.pack_end(self.frame_dict['base_frame3'],gtk.FALSE,gtk.FALSE,0) self.add(self.main_panel) self.show_list.append(self.main_panel)
def mk_wnd(self, title): wnd = gtk.GtkWindow() wnd.set_title(title) self.box = gtk.GtkVBox() self.textbox = gtk.GtkHBox() e = gtk.GtkEntry() self.textentry = e e.show() self.textbox.pack_start(e) b = gtk.GtkButton('Lookup') def looker(button): self.lookup('', e.get_text()) b.connect('released', looker) b.show() self.textbox.pack_start(b) self.textbox.show() self.box.pack_start(self.textbox) def mk_sel_changed(fn): def sel_changed(l, fn=fn): sel = l.get_selection() if len(sel) > 0: s = sel[0].children()[0].get() (typ, val) = split_tv(s) fn(typ, val) return sel_changed def make_lb(text, fn, box): lb = gtk.GtkList() lb.show() frame = gtk.GtkFrame(text) frame.add(lb) frame.show() box.pack_start(frame) lb.connect('selection-changed', fn) return lb self.lb_head = make_lb('Head terms', mk_sel_changed(self.set_head), self.box) self.lb_rel = make_lb('Relations', mk_sel_changed(self.lookup), self.box) self.box.show() wnd.add(self.box) wnd.show() return wnd
def __init__(self, im, contact): gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL) self.im = im self.contact = contact self.set_title("%s - Instance Messenger" % contact) self.text = gtk.GtkText() vb = gtk.GtkVBox() gtkutil.defocusify(self.text) self.text.set_word_wrap(gtk.TRUE) vb.pack_start(gtkutil.scrollify(self.text), 1, 1, 0) self.entry = gtk.GtkEntry() self.entry.signal_connect('activate', self.sendMessage) vb.pack_start(self.entry, 0, 0, 0) self.add(vb) self.signal_connect('destroy', self.removeFromList, None) self.show_all()