Esempio n. 1
0
    def __init__(self, parent, menubar):
        self.project_data = ObjectTree([Column('name',
                                               use_markup=True,
                                               data_type=str,
                                               sorted=True),
                                        Column('info')])

        self.project_data.connect('row-activated', self.on_row_activated)
        self.model_tree = Project()
        self._set_treeview_hooks()

        self.menubar = menubar

        self.set_parent(parent)


        self.filename = ''

        self.undo_stack = UndoStack(
            self.model_tree.__repr__,
            self.import_xml_file,
            self.project_data.select,
            menubar,
            self.meta,
            'Initialization')

        SlaveDelegate.__init__(self, toplevel=self.project_data)
 def __init__(self):
     SlaveDelegate.__init__(self,
                            gladefile="list_entries",
                            widgets=("table",))
     self.table.set_columns([Column("name", title="Name"),
                             Column("address", title="Address"),
                             Column("phone", title="Phone")])
Esempio n. 3
0
 def __init__(self, parent):
     self.parent = parent
     self.news_list = ObjectList([
         Column('title', 'Title of article', str),
         Column('author', 'Author of article', str),
         Column('url', 'Address of article', str)])
     SlaveDelegate.__init__(self, toplevel=self.news_list)
     self.news_list.add_list(news)
     self.news_list.select(self.news_list[0])
Esempio n. 4
0
 def __init__(self):
     SlaveDelegate.__init__(self,
                            gladefile="list_entries",
                            widgets=("table", ))
     self.table.set_columns([
         Column("name", title="Name"),
         Column("address", title="Address"),
         Column("phone", title="Phone")
     ])
Esempio n. 5
0
 def __init__(self, parent):
     self.parent = parent
     self.news_list = ObjectList([
         Column('title', 'Title of article', str),
         Column('author', 'Author of article', str),
         Column('url', 'Address of article', str)])
     SlaveDelegate.__init__(self, toplevel=self.news_list)
     self.news_list.add_list(news)
     self.news_list.select(self.news_list[0])
Esempio n. 6
0
 def __init__(self, columns):
     """
     Create a new SearchSlaveDelegate object.
     @ivar results: the results list of the container
     @ivar search: the L{SearchContainer}
     """
     self.search = SearchContainer(columns)
     SlaveDelegate.__init__(self, toplevel=self.search)
     self.results = self.search.results
     self.search.show()
Esempio n. 7
0
 def __init__(self, columns, tree=False):
     """
     Create a new SearchSlaveDelegate object.
     :ivar results: the results list of the container
     :ivar search: the :class:`SearchContainer`
     """
     self.search = SearchContainer(columns, tree=tree)
     SlaveDelegate.__init__(self, toplevel=self.search)
     self.results = self.search.results
     self.search.show()
Esempio n. 8
0
    def __init__(self,
                 columns=None,
                 tree=False,
                 restore_name=None,
                 chars=25,
                 store=None,
                 search_spec=None,
                 fast_iter=False,
                 result_view_class=None):
        """
        Create a new SearchContainer object.
        :param columns: a list of :class:`kiwi.ui.objectlist.Column`
        :param tree: if we should list the results as a tree
        :param restore_name:
        :param chars: maximum number of chars used by the search entry
        :param store: a database store
        :param search_spec: a search spec for store to find on
        """
        if tree:
            self.result_view_class = SearchResultTreeView

        if result_view_class:
            self.result_view_class = result_view_class

        self._auto_search = True
        self._lazy_search = False
        self._last_results = None
        self._model = None
        self._query_executer = None
        self._restore_name = restore_name
        self._search_filters = []
        self._selected_item = None
        self._summary_label = None
        self._search_spec = search_spec
        self._fast_iter = fast_iter
        self.store = store
        self.menu = None
        self.result_view = None
        self._settings_key = 'search-columns-%s' % (api.get_current_user(
            self.store).username, )
        self.columns = self.restore_columns(columns)

        self.vbox = Gtk.VBox()
        SlaveDelegate.__init__(self, toplevel=self.vbox)
        self.vbox.show()

        search_filter = StringSearchFilter(_('Search:'),
                                           chars=chars,
                                           container=self)
        search_filter.connect('changed', self._on_search_filter__changed)
        self._search_filters.append(search_filter)
        self._primary_filter = search_filter

        self._create_ui()
        self.focus_search_entry()
Esempio n. 9
0
 def __init__(self, view):
     """
     :param view: a view to store the created widgets in
     """
     self._fields = {}
     if not view:
         raise TypeError("Form %r requires a view, not %r" % (self.__class__.__name__, view))
     self.proxy = None
     self.main_view = view
     # Just a simple GtkBin
     self.toplevel = gtk.Alignment(xscale=1)
     SlaveDelegate.__init__(self)
Esempio n. 10
0
    def __init__(self, columns=None,
                 tree=False,
                 restore_name=None,
                 chars=25,
                 store=None,
                 search_spec=None,
                 fast_iter=False,
                 result_view_class=None):
        """
        Create a new SearchContainer object.
        :param columns: a list of :class:`kiwi.ui.objectlist.Column`
        :param tree: if we should list the results as a tree
        :param restore_name:
        :param chars: maximum number of chars used by the search entry
        :param store: a database store
        :param search_spec: a search spec for store to find on
        """
        if tree:
            self.result_view_class = SearchResultTreeView

        if result_view_class:
            self.result_view_class = result_view_class

        self._auto_search = True
        self._lazy_search = False
        self._last_results = None
        self._model = None
        self._query_executer = None
        self._restore_name = restore_name
        self._search_filters = []
        self._selected_item = None
        self._summary_label = None
        self._search_spec = search_spec
        self._fast_iter = fast_iter
        self.store = store
        self.menu = None
        self.result_view = None
        self._settings_key = 'search-columns-%s' % (
            api.get_current_user(self.store).username, )
        self.columns = self.restore_columns(columns)

        self.vbox = gtk.VBox()
        SlaveDelegate.__init__(self, toplevel=self.vbox)
        self.vbox.show()

        search_filter = StringSearchFilter(_('Search:'), chars=chars,
                                           container=self)
        search_filter.connect('changed', self._on_search_filter__changed)
        self._search_filters.append(search_filter)
        self._primary_filter = search_filter

        self._create_ui()
        self.focus_search_entry()
Esempio n. 11
0
 def __init__(self, toplevel=None):
     SlaveDelegate.__init__(self,
                            gladefile="list",
                            toplevel=toplevel,
                            widgets=("table",))
     self.table.set_columns([Column("name", title="Name"),
                             Column("address", title="Address"),
                             Column("phones", title="Phones",
                                    format_func=self._phones_format),
                             Column("birthday", title="Birthday"),
                             Column("category", title="Category",
                                    format_func=self._category_format)])
     self.load_data()
Esempio n. 12
0
 def __init__(self, view):
     """
     :param view: a view to store the created widgets in
     """
     self._fields = {}
     if not view:
         raise TypeError(
             "Form %r requires a view, not %r" % (
                 self.__class__.__name__, view, ))
     self.proxy = None
     self.main_view = view
     # Just a simple GtkBin
     self.toplevel = Gtk.Alignment.new(0.5, 0.5, 1, 1)
     SlaveDelegate.__init__(self)
Esempio n. 13
0
 def __init__(self, toplevel=None):
     SlaveDelegate.__init__(self,
                            gladefile="list",
                            toplevel=toplevel,
                            widgets=("table", ))
     self.table.set_columns([
         Column("name", title="Name"),
         Column("address", title="Address"),
         Column("phones", title="Phones", format_func=self._phones_format),
         Column("birthday", title="Birthday"),
         Column("category",
                title="Category",
                format_func=self._category_format)
     ])
     self.load_data()
Esempio n. 14
0
    def __init__(self):
        box = gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()

        label = gtk.Label("Nummer:")
        label.show()
        box.pack_start(label, False, False)

        combo = ProxyComboEntry()
        combo.set_property('model-attribute', 'nummer')
        combo.set_property('data-type', 'str')
        combo.prefill(['Ett', u'Två', 'Tre'])
        combo.show()
        box.pack_start(combo)
        self.combo = combo

        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])
Esempio n. 15
0
    def __init__(self):
        box = gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()

        label = gtk.Label("Nummer:")
        label.show()
        box.pack_start(label, False, False)

        combo = ProxyComboEntry()
        combo.set_property('model-attribute', 'nummer')
        combo.set_property('data-type', 'str')
        combo.prefill(['Ett', u'Två', 'Tre'])
        combo.show()
        box.pack_start(combo)
        self.combo = combo

        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])
Esempio n. 16
0
    def __init__(self):
        box = Gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()

        label = Gtk.Label(label="Number:")
        label.show()
        box.pack_start(label, False, False, 0)

        combo = ProxyComboEntry()
        combo.set_property('model-attribute', 'number')
        combo.set_property('data-type', 'str')
        combo.prefill(['One', 'Two', 'Three'])
        combo.show()
        box.pack_start(combo, True, True, 0)
        self.combo = combo

        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])
Esempio n. 17
0
File: news3.py Progetto: fuinha/kiwi
    def __init__(self):
        Delegate.__init__(self, gladefile="news_shell.ui",
                          delete_handler=self.quit_if_last)

        # paint header and footer; they are eventboxes that hold a
        # label and buttonbox respectively
        gadgets.set_background(self.header, "white")
        gadgets.set_background(self.footer, "#A0A0A0")
        gadgets.set_foreground(self.title, "blue")

        # Create the delegate and set it up
        objectlist = ObjectList(my_columns, news)
        objectlist.connect('selection-changed', self.news_selected)
        objectlist.connect('double-click', self.double_click)
        slave = SlaveDelegate(toplevel=objectlist)

        self.attach_slave("placeholder", slave)
        slave.focus_toplevel()  # Must be done after attach

        self.slave = slave
Esempio n. 18
0
    def __init__(self, columns=None, orientation=gtk.ORIENTATION_VERTICAL):
        columns = columns or self.columns
        if not columns:
            raise ValueError("columns cannot be empty")

        self.listcontainer = ListContainer(columns, orientation)
        self.listcontainer.connect('add-item',
                                   self._on_listcontainer__add_item)
        self.listcontainer.connect('remove-item',
                                   self._on_listcontainer__remove_item)
        self.listcontainer.connect('edit-item',
                                   self._on_listcontainer__edit_item)
        self.listcontainer.connect('selection-changed',
                                   self._on_listcontainer__selection_changed)

        self.listcontainer.set_border_width(6)
        self.listcontainer.show()

        self.refresh()

        SlaveDelegate.__init__(self, toplevel=self.listcontainer)
Esempio n. 19
0
    def __init__(self):
        Delegate.__init__(self,
                          gladefile="news_shell.ui",
                          delete_handler=self.quit_if_last)

        # paint header and footer; they are eventboxes that hold a
        # label and buttonbox respectively
        gadgets.set_background(self.header, "white")
        gadgets.set_background(self.footer, "#A0A0A0")
        gadgets.set_foreground(self.title, "blue")

        # Create the delegate and set it up
        objectlist = ObjectList(my_columns, news)
        objectlist.connect('selection-changed', self.news_selected)
        objectlist.connect('double-click', self.double_click)
        slave = SlaveDelegate(toplevel=objectlist)

        self.attach_slave("placeholder", slave)
        slave.focus_toplevel()  # Must be done after attach

        self.slave = slave
Esempio n. 20
0
    def __init__(self, parent, menubar):
        self.project_data = ObjectTree([
            Column('name', use_markup=True, data_type=str, sorted=True),
            Column('info')
        ])

        self.project_data.connect('row-activated', self.on_row_activated)
        self.model_tree = Project()
        self._set_treeview_hooks()

        self.menubar = menubar

        self.set_parent(parent)

        self.filename = ''

        self.undo_stack = UndoStack(self.model_tree.__repr__, self.import_file,
                                    self.project_data.select, menubar,
                                    self.meta, 'Initialization')

        SlaveDelegate.__init__(self, toplevel=self.project_data)
Esempio n. 21
0
    def __init__(self, columns=None, orientation=gtk.ORIENTATION_VERTICAL):
        columns = columns or self.columns
        if not columns:
            raise ValueError("columns cannot be empty")

        self.listcontainer = ListContainer(columns, orientation)
        self.listcontainer.connect(
            'add-item', self._on_listcontainer__add_item)
        self.listcontainer.connect(
            'remove-item', self._on_listcontainer__remove_item)
        self.listcontainer.connect(
            'edit-item', self._on_listcontainer__edit_item)
        self.listcontainer.connect(
            'selection-changed', self._on_listcontainer__selection_changed)

        self.listcontainer.set_border_width(6)
        self.listcontainer.show()

        self.refresh()

        SlaveDelegate.__init__(self, toplevel=self.listcontainer)
Esempio n. 22
0
    def __init__(self, parent, recentPlayed=None):
        windowName = "PlayMediaWindow"

        Delegate.__init__(self, gladefile=globals.gladeFile,
                          toplevel_name=windowName,  
                          delete_handler=self.quit_if_last)

        # Create the delegate and set it up
        self.buildObjectList(recentPlayed)
        self.mediaList.grab_focus()
        slave = SlaveDelegate(toplevel=self.mediaList)

        self.attach_slave("labelX", slave)
        slave.focus_toplevel() # Must be done after attach

        self.slave = slave

        self.set_transient_for(parent)

        # Set the image
        image = self.get_widget("imgAddMediaFile")
        image.set_from_file(os.path.join(globals.imageDir, "movie_track_add.png"))
Esempio n. 23
0
    def __init__(self, parent, recentPlayed=None):
        windowName = "PlayMediaWindow"

        Delegate.__init__(self,
                          gladefile=globals.gladeFile,
                          toplevel_name=windowName,
                          delete_handler=self.quit_if_last)

        # Create the delegate and set it up
        self.buildObjectList(recentPlayed)
        self.mediaList.grab_focus()
        slave = SlaveDelegate(toplevel=self.mediaList)

        self.attach_slave("labelX", slave)
        slave.focus_toplevel()  # Must be done after attach

        self.slave = slave

        self.set_transient_for(parent)

        # Set the image
        image = self.get_widget("imgAddMediaFile")
        image.set_from_file(
            os.path.join(globals.imageDir, "movie_track_add.png"))
Esempio n. 24
0
 def __init__(self, toplevel=None, **kw):
     PythonViewMixin.__init__(self)
     if toplevel is None:
         toplevel = self.create_toplevel_widget()
     SlaveDelegate.__init__(self, toplevel=toplevel, **kw)
     self.attach_slaves()
Esempio n. 25
0
 def __init__(self, toplevel=None, **kw):
     PythonViewMixin.__init__(self)
     if toplevel is None:
         toplevel = self.create_toplevel_widget()
     SlaveDelegate.__init__(self, toplevel=toplevel, **kw)
     self.attach_slaves()