本文整理汇总了Python中stoqlib.gui.base.dialogs.BasicDialog类的典型用法代码示例。如果您正苦于以下问题:Python BasicDialog类的具体用法?Python BasicDialog怎么用?Python BasicDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BasicDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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()
示例3: __init__
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()
示例4: __init__
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()
示例5: __init__
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()
示例6: __init__
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()
示例7: confirm
def confirm(self):
BasicDialog.confirm(self)
state = self.date_filter.get_state()
if isinstance(state, DateQueryState):
start, end = state.date, state.date
else:
start, end = state.start, state.end
self.retval = date_range(start=start, end=end)
示例8: __init__
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()
示例9: __init__
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()
示例10: __init__
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()
示例11: __init__
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()
示例12: __init__
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()
示例13: __init__
def __init__(self, store, model=None, visual_mode=False):
if store is not None and isinstance(store, StoqlibStore):
store.needs_retval = True
self._confirm_disabled = False
# FIXME:
# BasicEditor should inheirt from BasicDialog and instantiate
# the slave inside here, but it requires some major surgery
BaseEditorSlave.__init__(self, store, model,
visual_mode=visual_mode)
self.main_dialog = BasicDialog(title=self.get_title(self.model),
header_text=self.header,
help_section=self.help_section,
size=self.size)
# Do not close the dialog if re return False on self.confirm
self.main_dialog.enable_confirm_validation = True
self.main_dialog.attach_slave("main", self)
self.main_dialog.connect('confirm', self._on_main_dialog__confirm)
self.main_dialog.connect('cancel', self._on_main_dialog__cancel)
# This helps kiwis ui test, set the name of ourselves to
# the classname of the slave, which is much more helpful than
# just "BasicDialog"
self.main_dialog.get_toplevel().set_name(self.__class__.__name__)
if self.hide_footer or self.visual_mode:
self.main_dialog.hide_footer()
for name in self.confirm_widgets:
self.set_confirm_widget(getattr(self, name))
self.register_validate_function(self._validation_function)
self.force_validation()
示例14: __init__
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)
示例15: __init__
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)