Exemplo n.º 1
0
    def __init__(self, title=None, args=None, log_category=None,
                 start_msg=None, success_msg=None, failure_msg=None):
        """:param title: The title of the window.
        :param args: Default process and arguments to run.
        :param log_category: Default process and arguments to run.
        :param start_msg: Message that will appear on the progressbar before
        the process is started.
        :param success_msg: Message that will appear when process succeeds.
        :param failure_msg: Message that will appear then the process fails.
        """
        self.title = title or self.title
        if not self.title:
            raise ValueError('You must define a title for the window.')

        self.args = args or self.args
        if not self.args:
            raise ValueError('You must define the process and arguments for '
                             'the process.')

        self.log_category = log_category or self.log_category
        if not self.log_category:
            raise ValueError('You must define a log category to read the '
                             'output of the process from.')

        self.start_msg = start_msg or self.start_msg
        self.success_msg = success_msg or self.success_msg
        self.failure_msg = failure_msg or self.failure_msg

        BasicDialog.__init__(self, size=self.size, title=self.title)

        self._build_ui()
        self._execute()
Exemplo n.º 2
0
    def __init__(self,
                 columns,
                 objects,
                 hide_cancel_btn=True,
                 title='',
                 multiple=True,
                 header_text=""):
        """
        Create a new SimpleListDialog.
        :param columns:
        :param objects:
        :param hide_cancel_btn:
        :param title:
        :param multiple: if we're allowed to select multiple items
        :type multiple: boolean
        """

        BasicDialog.__init__(self,
                             size=self.size,
                             title=title,
                             header_text=header_text)
        if hide_cancel_btn:
            self.cancel_button.hide()

        if multiple:
            selection_mode = gtk.SELECTION_MULTIPLE
        else:
            selection_mode = gtk.SELECTION_BROWSE
        self.setup_slave(columns, objects, selection_mode)
Exemplo n.º 3
0
    def __init__(self):
        BasicDialog.__init__(self, title=self.title, size=self.size)
        self.toplevel.set_deletable(False)

        self._build_ui()
        self._setup_buttons()
        self.toplevel.connect('map-event', self._on_toplevel__map_event)
Exemplo n.º 4
0
    def __init__(self):
        BasicDialog.__init__(self, title=self.title, size=self.size)
        self.toplevel.set_deletable(False)

        self._build_ui()
        self._setup_buttons()
        self.toplevel.connect('map-event', self._on_toplevel__map_event)
Exemplo n.º 5
0
 def __init__(self, store):
     BasicDialog.__init__(self,
                          hide_footer=True, size=PaymentMethodsDialog.size,
                          title=PaymentMethodsDialog.title)
     self._can_edit = False
     self.store = store
     self._setup_list()
     self._setup_slaves()
Exemplo n.º 6
0
 def __init__(self, store):
     BasicDialog.__init__(self,
                          hide_footer=True, size=PaymentMethodsDialog.size,
                          title=PaymentMethodsDialog.title)
     self._can_edit = False
     self.store = store
     self._setup_list()
     self._setup_slaves()
Exemplo n.º 7
0
    def __init__(self, format, filename):
        BasicDialog.__init__(self, size=self.size, title=self.title)

        self.format = format
        self.filename = filename

        self._build_ui()
        self._execute()
Exemplo n.º 8
0
    def __init__(self, store):
        """A dialog to print the PaymentFlowHistoryReport report.

        :param store: a store
        """
        self.store = store
        BasicDialog.__init__(self, header_text='<b>%s</b>' % self.desc,
                             title=self.title)
        self._setup_widgets()
Exemplo n.º 9
0
    def __init__(self, store):
        """A dialog to print the PaymentFlowHistoryReport report.

        :param store: a store
        """
        self.store = store
        BasicDialog.__init__(self,
                             header_text='<b>%s</b>' % self.desc,
                             title=self.title)
        self._setup_widgets()
Exemplo n.º 10
0
    def __init__(self, store, printer):
        self._constant_slave = None
        self.store = store
        self.printer = printer

        BasicDialog.__init__(self, hide_footer=False, title='edit',
                             size=self.size)
        self.main.set_border_width(6)

        self._create_ui()
Exemplo n.º 11
0
    def __init__(self, store, printer):
        self._constant_slave = None
        self.store = store
        self.printer = printer

        BasicDialog.__init__(self, hide_footer=False, title='edit',
                             size=self.size)
        self.main.set_border_width(6)

        self._create_ui()
Exemplo n.º 12
0
 def __init__(self, store):
     header = _(u'Select the plugin you want to activate and click in '
                 'the apply button.')
     BasicDialog.__init__(self, hide_footer=False,
                          size=PluginManagerDialog.size,
                          title=PluginManagerDialog.title,
                          header_text=header)
     self.store = store
     self._manager = get_plugin_manager()
     self._setup_widgets()
Exemplo n.º 13
0
 def __init__(self, store):
     header = _(u'Select the plugin you want to activate and click in '
                'the apply button.')
     BasicDialog.__init__(self,
                          hide_footer=False,
                          size=PluginManagerDialog.size,
                          title=PluginManagerDialog.title,
                          header_text=header)
     self.store = store
     self._manager = get_plugin_manager()
     self._setup_widgets()
Exemplo n.º 14
0
    def __init__(self,
                 store,
                 search_spec=None,
                 hide_footer=True,
                 title='',
                 selection_mode=None,
                 double_click_confirm=False,
                 initial_string=''):
        """
        A base class for search dialog inheritance

        :param store: a store
        :param search_spec:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm
        :param initial_string: the string that should be initially filtered
        """

        self.store = store
        self.search_spec = search_spec or self.search_spec
        if not self.search_spec:
            raise ValueError("%r needs a search table" % self)
        self.selection_mode = self._setup_selection_mode(selection_mode)
        self.summary_label = None
        self.double_click_confirm = double_click_confirm
        self.csv_button = None
        self.initial_string = initial_string

        BasicDialog.__init__(self,
                             hide_footer=hide_footer,
                             main_label_text=self.main_label_text,
                             title=title or self.title,
                             size=self.size)

        self.enable_window_controls()
        self.disable_ok()
        self.set_ok_label(_('Se_lect Items'))
        self._setup_search()
        self._setup_details_slave()

        self._create_default_filters()
        self.create_filters()
        self.setup_widgets()
        if self.search_label:
            self.set_searchbar_label(self.search_label)

        if self.initial_string:
            search_filter = self.search.get_primary_filter()
            search_filter.set_state(self.initial_string)
            self.search.refresh()
            search_filter.entry.grab_focus()
Exemplo n.º 15
0
    def __init__(self, store=None):
        if self.list_slave_class is None:
            fmt = "%s needs to set it's list_slave_class attribute"
            raise TypeError(fmt % (self.__class__.__name__,))
        self.list_slave = self.list_slave_class(self, store=store)

        BasicDialog.__init__(self, title=self.title, size=self.size)

        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.list_slave.listcontainer)
        self.add(self.vbox)
        self.vbox.show()
Exemplo n.º 16
0
    def __init__(self, store=None):
        if self.list_slave_class is None:
            raise TypeError("%s needs to set it's list_slave_class attribute" %
                            (self.__class__.__name__, ))
        self.list_slave = self.list_slave_class(self, store=store)

        BasicDialog.__init__(self, title=self.title, size=self.size)

        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.list_slave.listcontainer)
        self.add(self.vbox)
        self.vbox.show()
Exemplo n.º 17
0
    def __init__(self, store=None, reuse_store=False):
        if self.list_slave_class is None:
            fmt = "%s needs to set it's list_slave_class attribute"
            raise TypeError(fmt % (self.__class__.__name__, ))
        self.list_slave = self.list_slave_class(self,
                                                store=store,
                                                reuse_store=reuse_store)

        BasicDialog.__init__(self, title=self.title, size=self.size)

        self.vbox = Gtk.VBox()
        self.vbox.pack_start(self.list_slave.listcontainer, True, True, 0)
        self.add(self.vbox)
        self.vbox.show()
Exemplo n.º 18
0
    def __init__(self, store):
        self.store = store

        self.date_filter = DateSearchFilter(_('Year:'))
        self.date_filter.clear_options()
        self._populate_date_filter(self.date_filter)
        self.date_filter.select()
        self.date_filter.set_use_date_entries(False)

        BasicDialog.__init__(self, title=self.title)
        self.main_label.set_justify(Gtk.Justification.CENTER)

        self.ok_button.set_label(_("Generate"))
        self.add(self.date_filter)
        self.date_filter.show()
Exemplo n.º 19
0
    def __init__(self, store):
        BasicDialog.__init__(self, title=self.title)
        self.main_label.set_justify(gtk.JUSTIFY_CENTER)

        self.store = store
        self.ok_button.set_label(_("Generate"))

        self.date_filter = DateSearchFilter(_('Month:'))
        self.date_filter.set_use_date_entries(False)
        self.date_filter.clear_options()
        self._populate_date_filter(self.date_filter)
        self.date_filter.select()

        self.add(self.date_filter)
        self.date_filter.show()
Exemplo n.º 20
0
    def __init__(self, store):
        BasicDialog.__init__(self, title=self.title)
        self.justify_label(gtk.JUSTIFY_CENTER)

        self.store = store
        self.ok_button.set_label(_("Generate"))

        self.date_filter = DateSearchFilter(_('Month:'))
        self.date_filter.set_use_date_entries(False)
        self.date_filter.clear_options()
        self._populate_date_filter(self.date_filter)
        self.date_filter.select()

        self.add(self.date_filter)
        self.date_filter.show()
Exemplo n.º 21
0
    def __init__(self, store, search_spec=None, hide_footer=True,
                 title='', selection_mode=None, double_click_confirm=False,
                 initial_string=''):
        """
        A base class for search dialog inheritance

        :param store: a store
        :param search_spec:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm
        :param initial_string: the string that should be initially filtered
        """

        self.store = store
        self.search_spec = search_spec or self.search_spec
        if not self.search_spec:
            raise ValueError("%r needs a search table" % self)
        self.selection_mode = self._setup_selection_mode(selection_mode)
        self.summary_label = None
        self.double_click_confirm = double_click_confirm
        self.csv_button = None
        self.initial_string = initial_string

        BasicDialog.__init__(self, hide_footer=hide_footer,
                             main_label_text=self.main_label_text,
                             title=title or self.title,
                             size=self.size)

        self.enable_window_controls()
        self.disable_ok()
        self.set_ok_label(_('Se_lect Items'))
        self._setup_search()
        self._setup_details_slave()

        self._create_default_filters()
        self.create_filters()
        self.setup_widgets()
        if self.search_label:
            self.set_searchbar_label(self.search_label)

        if self.initial_string:
            search_filter = self.search.get_primary_filter()
            search_filter.set_state(self.initial_string)
            self.search.refresh()
            search_filter.entry.grab_focus()
Exemplo n.º 22
0
    def __init__(self, store, search_table=None, hide_footer=True,
                 title='', selection_mode=None, double_click_confirm=False):
        """
        A base class for search dialog inheritance

        :param store: a store
        :param table:
        :param search_table:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm
        """

        self.store = store
        self.search_table = search_table or self.search_table
        if not self.search_table:
            raise ValueError("%r needs a search table" % self)
        self.selection_mode = self._setup_selection_mode(selection_mode)
        self.summary_label = None
        self.double_click_confirm = double_click_confirm

        BasicDialog.__init__(self, hide_footer=hide_footer,
                             main_label_text=self.main_label_text,
                             title=title or self.title,
                             size=self.size)

        self.executer = QueryExecuter(store)
        # FIXME: Remove this limit, but we need to migrate all existing
        #        searches to use lazy lists first. That in turn require
        #        us to rewrite the queries in such a way that count(*)
        #        will work properly.
        self.executer.set_limit(sysparam(self.store).MAX_SEARCH_RESULTS)
        self.set_table(self.search_table)

        self.enable_window_controls()
        self.disable_ok()
        self.set_ok_label(_('Se_lect Items'))
        self._setup_search()
        self._setup_details_slave()

        self.create_filters()
        self.setup_widgets()
        if self.search_label:
            self.set_searchbar_label(self.search_label)
Exemplo n.º 23
0
    def __init__(self,
                 store,
                 search_spec=None,
                 hide_footer=True,
                 title='',
                 selection_mode=None,
                 double_click_confirm=False):
        """
        A base class for search dialog inheritance

        :param store: a store
        :param table:
        :param search_spec:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm
        """

        self.store = store
        self.search_spec = search_spec or self.search_spec
        if not self.search_spec:
            raise ValueError("%r needs a search table" % self)
        self.selection_mode = self._setup_selection_mode(selection_mode)
        self.summary_label = None
        self.double_click_confirm = double_click_confirm

        BasicDialog.__init__(self,
                             hide_footer=hide_footer,
                             main_label_text=self.main_label_text,
                             title=title or self.title,
                             size=self.size)

        self.enable_window_controls()
        self.disable_ok()
        self.set_ok_label(_('Se_lect Items'))
        self._setup_search()
        self._setup_details_slave()

        self.create_filters()
        self.setup_widgets()
        if self.search_label:
            self.set_searchbar_label(self.search_label)
Exemplo n.º 24
0
    def __init__(
        self, store, search_spec=None, hide_footer=True, title="", selection_mode=None, double_click_confirm=False
    ):
        """
        A base class for search dialog inheritance

        :param store: a store
        :param table:
        :param search_spec:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm
        """

        self.store = store
        self.search_spec = search_spec or self.search_spec
        if not self.search_spec:
            raise ValueError("%r needs a search table" % self)
        self.selection_mode = self._setup_selection_mode(selection_mode)
        self.summary_label = None
        self.double_click_confirm = double_click_confirm

        BasicDialog.__init__(
            self,
            hide_footer=hide_footer,
            main_label_text=self.main_label_text,
            title=title or self.title,
            size=self.size,
        )

        self.enable_window_controls()
        self.disable_ok()
        self.set_ok_label(_("Se_lect Items"))
        self._setup_search()
        self._setup_details_slave()

        self.create_filters()
        self.setup_widgets()
        if self.search_label:
            self.set_searchbar_label(self.search_label)
Exemplo n.º 25
0
    def __init__(self, columns, objects, hide_cancel_btn=True, title="", multiple=True, header_text=""):
        """
        Create a new SimpleListDialog.
        :param columns:
        :param objects:
        :param hide_cancel_btn:
        :param title:
        :param multiple: if we're allowed to select multiple items
        :type multiple: boolean
        """

        BasicDialog.__init__(self, size=self.size, title=title, header_text=header_text)
        if hide_cancel_btn:
            self.cancel_button.hide()

        if multiple:
            selection_mode = gtk.SELECTION_MULTIPLE
        else:
            selection_mode = gtk.SELECTION_BROWSE
        self.setup_slave(columns, objects, selection_mode)
Exemplo n.º 26
0
    def __init__(self,
                 title=None,
                 args=None,
                 log_category=None,
                 start_msg=None,
                 success_msg=None,
                 failure_msg=None):
        """:param title: The title of the window.
        :param args: Default process and arguments to run.
        :param log_category: Default process and arguments to run.
        :param start_msg: Message that will appear on the progressbar before
        the process is started.
        :param success_msg: Message that will appear when process succeeds.
        :param failure_msg: Message that will appear then the process fails.
        """
        self.title = title or self.title
        if not self.title:
            raise ValueError('You must define a title for the window.')

        self.args = args or self.args
        if not self.args:
            raise ValueError('You must define the process and arguments for '
                             'the process.')

        self.log_category = log_category or self.log_category
        if not self.log_category:
            raise ValueError('You must define a log category to read the '
                             'output of the process from.')

        self.start_msg = start_msg or self.start_msg
        self.success_msg = success_msg or self.success_msg
        self.failure_msg = failure_msg or self.failure_msg

        BasicDialog.__init__(self, size=self.size, title=self.title)

        self._build_ui()
        self._execute()
Exemplo n.º 27
0
 def __init__(self, store):
     self.store = store
     BasicDialog.__init__(self, size=FormFieldEditor.size,
                          title=FormFieldEditor.title)
     self._create_ui()
Exemplo n.º 28
0
 def __init__(self):
     BasicDialog.__init__(self, size=ShortcutsEditor.size,
                          title=ShortcutsEditor.title)
     self._create_ui()
Exemplo n.º 29
0
 def __init__(self):
     BasicDialog.__init__(self,
                          size=ShortcutsEditor.size,
                          title=ShortcutsEditor.title)
     self._create_ui()
Exemplo n.º 30
0
 def __init__(self, store):
     self.store = store
     BasicDialog.__init__(self, size=FormFieldEditor.size,
                          title=FormFieldEditor.title)
     self._create_ui()
Exemplo n.º 31
0
    def __init__(self, title=None, header_text=None):
        title = title or self.title
        header_text = '<b>%s</b>' % header_text if header_text else ''
        BasicDialog.__init__(self, title=title, header_text=header_text)

        self._setup_widgets()