示例#1
0
 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)
示例#2
0
    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)
示例#3
0
    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()
示例#4
0
	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)
示例#5
0
    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()
示例#6
0
    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)
示例#7
0
    def __init__(self, gui, jid, title='a tab'):
        Tab.__init__(self, gui, title)

        self._id = str(jid.getStripped())

        self._scroll = gtk.GtkScrolledWindow()
        self._txt = gtk.GtkText()
        self._txt.set_word_wrap(gtk.TRUE)
        self._scroll.add(self._txt)
        self._scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self._box.pack_start(self._scroll, fill=gtk.TRUE, expand=gtk.TRUE)

        self._hbox = gtk.GtkHBox()
        self._entry = gtk.GtkEntry()
        self._hbox.pack_start(self._entry, fill=gtk.TRUE, expand=gtk.TRUE)
        self._send_button = gtk.GtkButton('send')
        #self._send_button.connect('clicked', self._cb, self)
        #self._entry.connect('activate', self._cb, self )
        self._hbox.pack_end(self._send_button,
                            fill=gtk.FALSE,
                            expand=gtk.FALSE)
        self._box.pack_end(self._hbox, fill=gtk.TRUE, expand=gtk.FALSE)

        self._box.show_all()
        self._addToNoteBook()
        self._entry.grab_focus()
示例#8
0
    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)
示例#9
0
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()
示例#10
0
 def __init__(self, size=(300,300), name="Piddle-GTK"):
     import gtk
     #
     width, height = (int(round(size[0])), int(round(size[1])))
     top = self.__top = gtk.GtkDialog()
     vbox = top.vbox
     frame = self.__frame = gtk.GtkFrame()
     frame.set_shadow_type(gtk.SHADOW_IN)
     da = gtk.GtkDrawingArea()
     button = gtk.GtkButton("Dismiss")
     button.connect("clicked",
                    lambda button, top=top: top.destroy())
     frame.set_border_width(10)
     bbox = self.__bbox = gtk.GtkHButtonBox()
     bbox.set_layout(gtk.BUTTONBOX_END)
     bbox.pack_end(button)
     top.action_area.pack_end(bbox)
     frame.add(da)
     vbox.pack_start(frame)
     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)
示例#11
0
    def __init__(self, gui):
        Tab.__init__(self, gui, 'URLs')

        self._id = 'URLs'
        self._regexp = re.compile('(http://[^\s]+)', re.IGNORECASE)

        self._scrolled_win = gtk.GtkScrolledWindow()
        self._scrolled_win.set_policy(gtk.POLICY_AUTOMATIC,
                                      gtk.POLICY_AUTOMATIC)
        self._box.pack_start(self._scrolled_win)

        self._list = gtk.GtkList()
        self._list.set_selection_mode(gtk.SELECTION_BROWSE)
        self._scrolled_win.add_with_viewport(self._list)

        self._list.connect("select-child", self.selectCB)

        self._hbox = gtk.GtkHBox()
        self._open_button = gtk.GtkButton('open')
        self._hbox.pack_end(self._open_button,
                            fill=gtk.FALSE,
                            expand=gtk.FALSE)
        self._box.pack_end(self._hbox, fill=gtk.TRUE, expand=gtk.FALSE)
        self._box.show_all()
        self._addToNoteBook()
示例#12
0
    def __init__(self, master, jabberObj):
        gtk.GtkDialog.__init__(self)

        self.agents = jabberObj.requestAgents()

        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.ok_button = gtk.GtkButton('Ok')
        self.ok_button.connect('clicked', self.okay)
        self.action_area.pack_start(self.ok_button, expand=gtk.FALSE)
        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.scrolled_win = gtk.GtkScrolledWindow()
        self.scrolled_win.set_policy(gtk.POLICY_AUTOMATIC,
                                     gtk.POLICY_AUTOMATIC)
        self.vbox.pack_start(self.scrolled_win)

        self.list = gtk.GtkList()
        self.list.set_selection_mode(gtk.SELECTION_BROWSE)
        self.scrolled_win.add_with_viewport(self.list)

        for i in self.agents.keys():
            if self.agents[i].has_key('transport'):
                list_item = gtk.GtkListItem(self.agents[i]['name'])
                list_item.set_data('jid', i)
                self.list.add(list_item)
                list_item.show()

        self.list.connect("select-child", self.selectCB)

        self.vbox.pack_start(self.scrolled_win)
        self.vbox.show_all()
        self.action_area.show_all()
        self.show()
        self.selected = None
        self.set_modal(gtk.TRUE)
示例#13
0
def extension_python_fu_console():
    import gtk, gimpenums, gimpshelf
    stderr.write(str('Hallo' + '\n'))
    gtk.rc_parse(gimp.gtkrc())
    namespace = {
        '__builtins__': __builtins__,
        '__name__': '__main__',
        '__doc__': None,
        'gimp': gimp,
        'pdb': gimp.pdb,
        'shelf': gimpshelf.shelf
    }
    for s in gimpenums.__dict__.keys():
        if s[0] != '_':
            namespace[s] = getattr(gimpenums, s)

    win = gtk.GtkWindow()
    win.connect("destroy", gtk.mainquit)
    win.set_title("Gimp-Python Console")
    cons = gtkcons.Console(
        namespace=namespace,
        copyright='Gimp Python Extensions - Copyright (C), 1997-1999' +
        ' James Henstridge\n',
        quit_cb=gtk.mainquit)

    def browse(button, cons):
        import gtk, pdbbrowse

        def ok_clicked(button, browse, cons=cons):
            cons.line.set_text(browse.cmd)
            browse.destroy()

        win = pdbbrowse.BrowseWin(ok_button=ok_clicked)
        win.connect("destroy", gtk.mainquit)
        win.set_modal(TRUE)
        win.show()
        gtk.mainloop()

    button = gtk.GtkButton("Browse")
    button.connect("clicked", browse, cons)
    cons.inputbox.pack_end(button, expand=FALSE)
    button.show()
    win.add(cons)
    cons.show()
    win.set_default_size(475, 300)
    win.show()
    cons.init()

    # flush the displays every half second
    def timeout():
        gimp.displays_flush()
        return TRUE

    gtk.timeout_add(500, timeout)
    gtk.mainloop()
示例#14
0
文件: compose.py 项目: lmarabi/tareeg
 def create_gcp_frame(self):
     self.frames['GCPs'] = gtk.GtkFrame('')
     self.frames['GCPs'].set_shadow_type(gtk.SHADOW_NONE)
     vbox = gtk.GtkVBox()
     vbox.set_spacing(spc)
     self.frames['GCPs'].add(vbox)
     self.gcpgrid = pgugrid.pguGrid((3, 1, 0, 1, 7, 0, 0, 0, 3))
     self.gcpgrid.set_usize(200, 200)
     self.gcplist = []
     self.gcpgrid.set_source(
         self.gcplist,
         members=['Id', 'GCPPixel', 'GCPLine', 'GCPX', 'GCPY', 'GCPZ'],
         titles=['ID', 'Pixel', 'Line', 'X', 'Y', 'Z'],
         types=['string', 'float', 'float', 'float', 'float', 'float'])
     vbox.pack_start(self.gcpgrid)
     hbox = gtk.GtkHBox()
     hbox.set_spacing(spc)
     vbox.pack_start(hbox)
     self.add_gcp_button = gtk.GtkButton('  Add GCP  ')
     self.add_gcp_button.connect('clicked', self.add_gcp_cb)
     hbox.pack_start(self.add_gcp_button, expand=gtk.FALSE)
     self.tips.set_tip(self.add_gcp_button, 'Add a new GCP')
     self.load_gcp_button = gtk.GtkButton('Load GCPs')
     self.tips.set_tip(
         self.load_gcp_button,
         'Clear existing GCPs and load ' + 'new ones from a text file')
     self.load_gcp_button.connect('clicked', self.load_gcps_cb)
     hbox.pack_start(self.load_gcp_button, expand=gtk.FALSE)
     self.copy_gcp_button = gtk.GtkButton('Copy GCPs')
     self.copy_gcp_button.connect('clicked', self.copy_gcps_cb)
     self.tips.set_tip(
         self.copy_gcp_button, 'Clear existing GCPs and copy new ' +
         'ones from another GDAL dataset')
     hbox.pack_start(self.copy_gcp_button, expand=gtk.FALSE)
     self.clear_gcp_button = gtk.GtkButton('Clear GCPs')
     self.clear_gcp_button.connect('clicked', self.clear_gcps)
     self.tips.set_tip(self.clear_gcp_button, 'Clear all GCPs')
     hbox.pack_start(self.clear_gcp_button, expand=gtk.FALSE)
     self.gcpprjbox = ProjectionBox(self.tips)
     vbox.pack_start(self.gcpprjbox)
     self.frames['GCPs'].show_all()
     self.pack_start(self.frames['GCPs'])
示例#15
0
 def on_ParticipantList_select_row(self, w, row, column, event):
     self.selectedPerson = self.group.account.client.getPerson(self.members[row])
     print 'selected', self.selectedPerson
     personBox = self.xml.get_widget("PersonActionsBox")
     personFrame = self.xml.get_widget("PersonFrame")
     # clear out old buttons
     for child in personBox.children():
         personBox.remove(child)
     personFrame.set_label("Person: %s" % self.selectedPerson.name)
     for method in self.selectedPerson.getPersonCommands():
         b = gtk.GtkButton(method.__name__)
         b.connect("clicked", self._doPersonAction, method)
         personBox.add(b)
         b.show()
     for method in self.group.getTargetCommands(self.selectedPerson):
         b = gtk.GtkButton(method.__name__)
         b.connect("clicked", self._doTargetAction, method,
                   self.selectedPerson)
         personBox.add(b)
         b.show()
示例#16
0
文件: pgufont.py 项目: lmarabi/tareeg
    def __init__(self, fontspec=None, use_font=FALSE):
        """
        Initialize the font selector and optionally load a previous
        font spec
        """
        gtk.GtkHBox.__init__(self)

        self.use_font = use_font
        self.font = XLFDFontSpec()

        tips = gtk.GtkTooltips()

        if fontspec is not None:
            self.font.parse_font_spec(fontspec)
        else:
            self.font.set_font_part('Family', 'Arial')
            self.font.set_font_part('Point Size', '100')

        table = gtk.GtkTable()
        self.pack_start(table)

        table.set_row_spacings(6)
        table.set_col_spacings(6)
        table.set_border_width(6)

        self.font_label = pguFontDisplay()
        self.font_label.set_text(self.font.get_display_string())
        table.attach(self.font_label,
                     0,
                     1,
                     0,
                     1,
                     xoptions=gtk.SHRINK,
                     yoptions=gtk.SHRINK)
        tips.set_tip(self.font_label, 'double click to toggle sample mode')

        font_button = gtk.GtkButton('...')
        font_button.connect('clicked', self.show_font_dialog)
        table.attach(font_button,
                     1,
                     2,
                     0,
                     1,
                     xoptions=gtk.SHRINK,
                     yoptions=gtk.SHRINK)
        tips.set_tip(font_button, 'click to select a different font')

        self.show_all()

        self.font_label.set_events(gtk.GDK.BUTTON_PRESS_MASK)
        self.font_label.connect('button-press-event', self.label_clicked)

        self.update_gui()
        self.publish('font-changed')
示例#17
0
    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)
示例#18
0
 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()
示例#19
0
    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()
示例#20
0
文件: compose.py 项目: lmarabi/tareeg
    def __init__(self, title, wkt):
        gtk.GtkWindow.__init__(self)
        self.set_title(title)
        self.set_usize(350, 300)
        vbox = gtk.GtkVBox()
        self.add(vbox)
        self.text = gtk.GtkText()
        self.text.set_editable(gtk.TRUE)
        self.text.insert_defaults(wkt)
        vbox.pack_start(self.text)
        hbox = gtk.GtkHBox()
        vbox.pack_start(hbox, expand=gtk.FALSE)
        self.cancel_button = gtk.GtkButton('  Cancel  ')
        self.ok_button = gtk.GtkButton('     OK     ')
        hbox.pack_end(self.cancel_button, expand=gtk.FALSE)
        hbox.pack_end(self.ok_button, expand=gtk.FALSE)

        self.cancel_button.connect('clicked', self.quit)
        self.ok_button.connect('clicked', self.ok_cb)
        self.ret = None
        self.show_all()
示例#21
0
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()
示例#22
0
 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) # }
示例#23
0
    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()
示例#24
0
文件: mpiGUI.py 项目: santiama/OOF3D
    def __init__(self):
        ## create gtk window
        self.window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)
        self.window.set_usize(140, 100)

        self.control_box = gtk.GtkVBox(gtk.FALSE, 0)
        self.window.add(self.control_box)
        self.control_box.show()

        ## create startbutton
        self.startbutton = gtk.GtkButton("perform test")
        self.startbutton.connect("clicked", self.apply_function,
                                 self.control_box)
        self.control_box.add(self.startbutton)
        self.startbutton.show()

        ## create quitbutton
        self.quitbutton = gtk.GtkButton("Quit")
        self.quitbutton.connect("clicked", self.destroy)
        self.control_box.add(self.quitbutton)
        self.quitbutton.show()
示例#25
0
    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()
示例#26
0
 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)  # }
示例#27
0
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()
示例#28
0
    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()
示例#29
0
    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
示例#30
0
def main():
    top = gtk.GtkWindow()
    bbox = gtk.GtkVButtonBox()
    bbox.set_spacing(0)
    top.add(bbox)
    top.connect("destroy", gtk.mainquit)
    top.connect("delete_event", gtk.mainquit)
    tests = map((lambda test: (string.capitalize(test.__name__), test)),
                piddletest.tests)
    tests.extend(testitems)
    for name, test in tests:
        b = gtk.GtkButton(name)
        b.connect("clicked", Test(test))
        bbox.pack_start(b)
    top.show_all()
    gtk.mainloop()