Exemplo n.º 1
0
 def init_page_1 (self):
     
     self.fields1 = self.xml.get_widget('f_list_1')
     rend = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('Name'), rend, text = 0)
     self.fields1.append_column(col)
     rend = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('Type'), rend, text = 1)
     self.fields1.append_column(col)
     
     self.fm = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                             gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
     self.sfm = gtk.TreeModelSort(self.fm)
     self.sfm.set_sort_column_id(2, gtk.SORT_ASCENDING)
     self.fields1.set_model(self.sfm)
     self.s1 = self.fields1.get_selection()
     self.s1.connect ('changed', self.list_1_select)
     self.fields = copy.copy (Config.get ('base/fields').data)
     for key, item in  self.fields.iteritems():
         self.fm.append((item.name,
                         _typename [item.type], key, item)) 
     
     self.name1 = self.xml.get_widget('name1')
     self.menu1 = self.xml.get_widget('type1')
     menu = gtk.Menu ()
     self.menu1.set_menu (menu)
     self.menu_items = _typename.keys ()
     for item in self.menu_items:
         Utils.popup_add (menu, _typename [item], self.select_menu, item)
     self.menu1.set_history (0)
     self.current_menu = self.menu_items [0]
     self.check()
Exemplo n.º 2
0
    def __init__ (self, parent = None):

        Utils.GladeWindow.__init__ (self, parent)

        # Fill the output format drop-down menu
        menu = gtk.Menu ()
        self._w_menu.set_menu (menu)
        
        outlist = Autoload.available ('output')
        outlist.sort ()
        
        for avail in outlist:
            Utils.popup_add (menu, avail, self._menu_select, avail)

        self._w_menu.set_history (0)
        self.menu_item = outlist [0]

        self._w_style_entry.set_default_path (FormatDialog.style)
        self._w_style.set_text (FormatDialog.style)

        if FormatDialog.output:
            self._w_output_entry.set_default_path (FormatDialog.output)
            self._w_output.set_text (FormatDialog.output)
        
        self._w_format.show ()
        return
Exemplo n.º 3
0
    def __init__(self, parent=None):
        Utils.Builder.__init__(self, parent)

        # the tree model contains a string that explains the query,
        # and a python object representing the actual query.
        
        self._model = gtk.TreeStore(str, object)
        self._w_tree.set_model(self._model)

        # the view does not display the python column, of course.
        col = gtk.TreeViewColumn ('field', gtk.CellRendererText (), text = 0)
        self._w_tree.append_column (col)

        self._w_tree.expand_all ()
        
        # The root of the search tree is the full database
        self._model.append (None, (_("Full database"), None))


        # Monitor the selected items
        self._selection = self._w_tree.get_selection ()
        self._selection.connect ('changed', self.selection)
        
        field_items = [' - any field - '] + \
                      list(Config.get('gnome/searched').data) + \
                      [' - type - ', ' - key - ']

        for f in field_items:
            self._w_field.append_text(f)

        self._w_field.set_active(0)

        # connect a menu to the right button
        self.menu = gtk.Menu ()
        self.delete_button = Utils.popup_add (self.menu, _("Delete"),
                                              self.search_delete)

        # We are set up.
        self.show()