def __init__(self): self._ui = None self.default_store = get_default_store() self._printer_verified = False # Delay printer creation until we are accessing pos or till app. Other # applications should still be accessible without a printer self._printer = None SaleStatusChangedEvent.connect(self._on_SaleStatusChanged) ECFIsLastSaleEvent.connect(self._on_ECFIsLastSale) TillOpenEvent.connect(self._on_TillOpen) TillCloseEvent.connect(self._on_TillClose) TillAddCashEvent.connect(self._on_TillAddCash) TillAddTillEntryEvent.connect(self._on_AddTillEntry) TillRemoveCashEvent.connect(self._on_TillRemoveCash) StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) CouponCreatedEvent.connect(self._on_CouponCreatedEvent) GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent) GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent) CheckECFStateEvent.connect(self._on_CheckECFStateEvent) HasPendingReduceZ.connect(self._on_HasPendingReduceZ) HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent) self._till_summarize_action = gtk.Action('Summary', _('Summary'), None, None) self._till_summarize_action.connect('activate', self._on_TillSummary__activate) add_bindings([ ('plugin.ecf.read_memory', '<Primary>F9'), ('plugin.ecf.summarize', '<Primary>F11'), ])
def __init__(self): self._setup_params() self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent) RunDialogEvent.connect(self._on_RunDialogEvent) PrintReportEvent.connect(self._on_PrintReportEvent) SearchDialogSetupSearchEvent.connect( self._on_SearchDialogSetupSearchEvent) WorkOrderStatusChangedEvent.connect( self._on_WorkOrderStatusChangedEvent) ApplicationSetupSearchEvent.connect( self._on_ApplicationSetupSearchEvent) add_bindings([ ('plugin.optical.pre_sale', ''), ('plugin.optical.search_medics', ''), ]) # Whenever the model of WorkOrderActions change, we should also change ours actions = WorkOrderActions.get_instance() actions.connect('model-set', self._on_work_order_actions__model_set) # Add a new option to the WorkOrderRow options menu WorkOrderRow.options.append((_('Create new purchase...'), 'optical_work_order.OpticalNewPurchase'))
def run(self, appdesc=None, appname=None): if not self._do_login(): raise SystemExit from stoq.gui.launcher import Launcher from stoqlib.gui.events import StartApplicationEvent from stoqlib.lib.message import error import gtk app_window = Launcher(self._options, self) app_window.show() app = app_window.app StartApplicationEvent.emit(app.name, app) # A GtkWindowGroup controls grabs (blocking mouse/keyboard interaction), # by default all windows are added to the same window group. # We want to avoid setting modallity on other windows # when running a dialog using gtk_dialog_run/run_dialog. window_group = gtk.WindowGroup() window_group.add_window(app_window.get_toplevel()) if appname is not None: appdesc = self.get_app_by_name(appname) if not appdesc: return if (appdesc.name != 'launcher' and not self._user.profile.check_app_permission(appdesc.name)): error(_("This user lacks credentials \nfor application %s") % appdesc.name) return self.run_embedded(appdesc, app_window)
def __init__(self): self._ui = None self.default_store = get_default_store() self._printer_verified = False # Delay printer creation until we are accessing pos or till app. Other # applications should still be accessible without a printer self._printer = None SaleStatusChangedEvent.connect(self._on_SaleStatusChanged) ECFIsLastSaleEvent.connect(self._on_ECFIsLastSale) TillOpenEvent.connect(self._on_TillOpen) TillCloseEvent.connect(self._on_TillClose) TillAddCashEvent.connect(self._on_TillAddCash) TillAddTillEntryEvent.connect(self._on_AddTillEntry) TillRemoveCashEvent.connect(self._on_TillRemoveCash) StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) CouponCreatedEvent.connect(self._on_CouponCreatedEvent) GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent) GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent) CheckECFStateEvent.connect(self._on_CheckECFStateEvent) HasPendingReduceZ.connect(self._on_HasPendingReduceZ) HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent) self._till_summarize_action = gtk.Action( 'Summary', _('Summary'), None, None) self._till_summarize_action.connect( 'activate', self._on_TillSummary__activate) add_bindings([ ('plugin.ecf.read_memory', '<Primary>F9'), ('plugin.ecf.summarize', '<Primary>F11'), ])
def __init__(self): self._ui = None self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) EditorSlaveCreateEvent.connect(self._on_EditorSlaveCreateEvent) add_bindings([ ('plugin.books.search_books', '<Primary><Alt>B'), ('plugin.books.search_publishers', '<Primary><Alt>P'), ])
def __init__(self): self._ui = None self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) EditorSlaveCreateEvent.connect(self._on_EditorSlaveCreateEvent) add_bindings([ ('plugin.optical.pre_sale', ''), ])
def __init__(self): self._ui = None self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent) RunDialogEvent.connect(self._on_RunDialogEvent) add_bindings([ ('plugin.optical.pre_sale', ''), ('plugin.optical.search_medics', ''), ])
def show_app(self, app, app_window, **params): app_window.reparent(self.application_box) self.application_box.set_child_packing(app_window, True, True, 0, gtk.PACK_START) # Default action settings for applications self.Print.set_visible(True) self.Print.set_sensitive(False) self.ExportSpreadSheet.set_visible(True) self.ExportSpreadSheet.set_sensitive(False) self.ChangePassword.set_visible(False) self.SignOut.set_visible(False) self.Close.set_sensitive(True) self.HomeToolItem.set_sensitive(True) # We only care about Quit on OSX self.Quit.set_visible(bool(self._osx_app)) self.NewToolItem.set_tooltip("") self.NewToolItem.set_sensitive(True) self.SearchToolItem.set_tooltip("") self.SearchToolItem.set_sensitive(True) self._update_toggle_actions(app.app_name) self.get_toplevel().set_title(app.get_title()) self.application_box.show() app.toplevel = self.get_toplevel() if app.app_name != 'launcher': self.application_actions[app.app_name].set_visible(False) if self._birthdays_bar is not None: if app.app_name in ['launcher', 'sales']: self._birthdays_bar.show() else: self._birthdays_bar.hide() # StartApplicationEvent must be emitted before calling app.activate(), # so that the plugins can have the chance to modify the application # before any other event is emitted. StartApplicationEvent.emit(app.app_name, app) app.activate(**params) self.uimanager.ensure_update() self.current_app = app self.current_widget = app_window if not self.in_ui_test: while gtk.events_pending(): gtk.main_iteration() app_window.show() app.setup_focus()
def show_app(self, app, app_window, **params): app_window.reparent(self.application_box) self.application_box.set_child_packing(app_window, True, True, 0, Gtk.PackType.START) # Default action settings for applications self.Print.set_visible(True) self.Print.set_sensitive(False) self.ExportSpreadSheet.set_visible(True) self.ExportSpreadSheet.set_sensitive(False) self.ChangePassword.set_visible(False) self.SignOut.set_visible(False) self.Close.set_sensitive(True) self.HomeToolItem.set_sensitive(True) # We only care about Quit on OSX self.Quit.set_visible(bool(self._osx_app)) self.NewToolItem.set_tooltip("") self.NewToolItem.set_sensitive(True) self.SearchToolItem.set_tooltip("") self.SearchToolItem.set_sensitive(True) self._update_toggle_actions(app.app_name) self.get_toplevel().set_title(app.get_title()) self.application_box.show() app.toplevel = self.get_toplevel() if app.app_name != 'launcher': self.application_actions[app.app_name].set_visible(False) if self._birthdays_bar is not None: if app.app_name in ['launcher', 'sales']: self._birthdays_bar.show() else: self._birthdays_bar.hide() # StartApplicationEvent must be emitted before calling app.activate(), # so that the plugins can have the chance to modify the application # before any other event is emitted. StartApplicationEvent.emit(app.app_name, app) app.activate(**params) self.uimanager.ensure_update() self.current_app = app self.current_widget = app_window if not self.in_ui_test: while Gtk.events_pending(): Gtk.main_iteration() app_window.show() app.setup_focus()
def _setup_events(self): SaleStatusChangedEvent.connect(self._on_SaleStatusChanged) SaleAvoidCancelEvent.connect(self._on_SaleAvoidCancel) TillOpenEvent.connect(self._on_TillOpen) TillCloseEvent.connect(self._on_TillClose) TillAddCashEvent.connect(self._on_TillAddCash) TillAddTillEntryEvent.connect(self._on_AddTillEntry) TillRemoveCashEvent.connect(self._on_TillRemoveCash) StartApplicationEvent.connect(self._on_StartApplicationEvent) CouponCreatedEvent.connect(self._on_CouponCreatedEvent) GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent) GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent) CheckECFStateEvent.connect(self._on_CheckECFStateEvent) HasPendingReduceZ.connect(self._on_HasPendingReduceZ) HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent) ECFGetPrinterUserNumberEvent.connect(self._on_ECFGetPrinterUserNumberEvent)
def _setup_events(self): SaleStatusChangedEvent.connect(self._on_SaleStatusChanged) SaleAvoidCancelEvent.connect(self._on_SaleAvoidCancel) TillOpenEvent.connect(self._on_TillOpen) TillCloseEvent.connect(self._on_TillClose) TillAddCashEvent.connect(self._on_TillAddCash) TillAddTillEntryEvent.connect(self._on_AddTillEntry) TillRemoveCashEvent.connect(self._on_TillRemoveCash) StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) CouponCreatedEvent.connect(self._on_CouponCreatedEvent) GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent) GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent) CheckECFStateEvent.connect(self._on_CheckECFStateEvent) HasPendingReduceZ.connect(self._on_HasPendingReduceZ) HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent)
def __init__(self): # This will contain a mapping of (appname, uimanager) -> extra_ui # We need to store that like this because each windows has it's unique # uimanager, and we have an extra_ui for different apps self._app_ui = dict() self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent) RunDialogEvent.connect(self._on_RunDialogEvent) PrintReportEvent.connect(self._on_PrintReportEvent) SearchDialogSetupSearchEvent.connect(self._on_SearchDialogSetupSearchEvent) ApplicationSetupSearchEvent.connect(self._on_ApplicationSetupSearchEvent) add_bindings([ ('plugin.optical.pre_sale', ''), ('plugin.optical.search_medics', ''), ])
def show_app(self, app, app_window, **params): self.stoq_menu.set_visible(False) app_window.get_parent().remove(app_window) self.application_box.add(app_window) self.application_box.set_child_packing(app_window, True, True, 0, Gtk.PackType.START) self._current_app_settings = self._app_settings.setdefault( app.app_name, {}) self.header_bar.set_title(app.get_title()) self.header_bar.set_subtitle(app.app_title) self.application_box.show() app.toplevel = self.get_toplevel() if self._birthdays_bar is not None: if app.app_name in ['launcher', 'sales']: self._birthdays_bar.show() else: self._birthdays_bar.hide() if app.app_name == 'launcher': icon_name = 'fa-power-off-symbolic' else: icon_name = 'fa-chevron-left-symbolic' self.set_close_button_icon(icon_name) # StartApplicationEvent must be emitted before calling app.activate(), # so that the plugins can have the chance to modify the application # before any other event is emitted. StartApplicationEvent.emit(app.app_name, app) app.activate(**params) self.current_app = app self.current_widget = app_window if not self.in_ui_test: while Gtk.events_pending(): Gtk.main_iteration() app_window.show() app.setup_focus()
def __init__(self): # This will contain a mapping of (appname, uimanager) -> extra_ui # We need to store that like this because each windows has it's unique # uimanager, and we have an extra_ui for different apps self._app_ui = dict() self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) StopApplicationEvent.connect(self._on_StopApplicationEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent) RunDialogEvent.connect(self._on_RunDialogEvent) PrintReportEvent.connect(self._on_PrintReportEvent) SearchDialogSetupSearchEvent.connect( self._on_SearchDialogSetupSearchEvent) ApplicationSetupSearchEvent.connect( self._on_ApplicationSetupSearchEvent) add_bindings([ ('plugin.optical.pre_sale', ''), ('plugin.optical.search_medics', ''), ])
def show_app(self, app, app_window, params=None): app_window.reparent(self.application_box) self.application_box.set_child_packing(app_window, True, True, 0, gtk.PACK_START) # Default action settings for applications self.Print.set_visible(True) self.Print.set_sensitive(False) self.ExportSpreadSheet.set_visible(True) self.ExportSpreadSheet.set_sensitive(False) self.ChangePassword.set_visible(False) self.SignOut.set_visible(False) self.Close.set_sensitive(True) # We only care about Quit on OSX self.Quit.set_visible(bool(self._osx_app)) self.NewToolItem.set_tooltip("") self.NewToolItem.set_sensitive(True) self.SearchToolItem.set_tooltip("") self.SearchToolItem.set_sensitive(True) self._update_toggle_actions(app.app_name) self.get_toplevel().set_title(app.get_title()) self.application_box.show() app.toplevel = self.get_toplevel() # StartApplicationEvent must be emitted before calling app.activate(), # so that the plugins can have the chance to modify the application # before any other event is emitted. StartApplicationEvent.emit(app.app_name, app) app.activate(params or {}) self.uimanager.ensure_update() self.current_app = app self.current_widget = app_window if not self.in_ui_test: while gtk.events_pending(): gtk.main_iteration() app_window.show() app.setup_focus()
def show_app(self, app, app_window, **params): self.stoq_menu.set_visible(False) app_window.get_parent().remove(app_window) self.application_box.add(app_window) self.application_box.set_child_packing(app_window, True, True, 0, Gtk.PackType.START) self._current_app_settings = self._app_settings.setdefault(app.app_name, {}) self.header_bar.set_title(app.get_title()) self.header_bar.set_subtitle(app.app_title) self.application_box.show() app.toplevel = self.get_toplevel() if self._birthdays_bar is not None: if app.app_name in ['launcher', 'sales']: self._birthdays_bar.show() else: self._birthdays_bar.hide() if app.app_name == 'launcher': icon_name = 'fa-power-off-symbolic' else: icon_name = 'fa-chevron-left-symbolic' self.set_close_button_icon(icon_name) # StartApplicationEvent must be emitted before calling app.activate(), # so that the plugins can have the chance to modify the application # before any other event is emitted. StartApplicationEvent.emit(app.app_name, app) app.activate(**params) self.current_app = app self.current_widget = app_window if not self.in_ui_test: while Gtk.events_pending(): Gtk.main_iteration() app_window.show() app.setup_focus()
def _load_app(self, appdesc, app_window): import gtk module = __import__("stoq.gui.%s" % (appdesc.name, ), globals(), locals(), ['']) window = appdesc.name.capitalize() + 'App' window_class = getattr(module, window, None) if window_class is None: raise SystemExit("%s app misses a %r attribute" % ( appdesc.name, window)) embedded = getattr(window_class, 'embedded', False) from stoq.gui.application import App app = App(window_class, self._login, self._options, self, embedded, app_window, appdesc.name) toplevel = app.main_window.get_toplevel() icon = toplevel.render_icon(appdesc.icon, gtk.ICON_SIZE_MENU) toplevel.set_icon(icon) from stoqlib.gui.events import StartApplicationEvent StartApplicationEvent.emit(appdesc.name, app) return app
def __init__(self): self._setup_params() self.default_store = get_default_store() StartApplicationEvent.connect(self._on_StartApplicationEvent) EditorCreateEvent.connect(self._on_EditorCreateEvent) RunDialogEvent.connect(self._on_RunDialogEvent) PrintReportEvent.connect(self._on_PrintReportEvent) SearchDialogSetupSearchEvent.connect(self._on_SearchDialogSetupSearchEvent) WorkOrderStatusChangedEvent.connect(self._on_WorkOrderStatusChangedEvent) ApplicationSetupSearchEvent.connect(self._on_ApplicationSetupSearchEvent) add_bindings([ ('plugin.optical.pre_sale', ''), ('plugin.optical.search_medics', ''), ]) # Whenever the model of WorkOrderActions change, we should also change ours actions = WorkOrderActions.get_instance() actions.connect('model-set', self._on_work_order_actions__model_set) # Add a new option to the WorkOrderRow options menu WorkOrderRow.options.append((_('Create new purchase...'), 'optical_work_order.OpticalNewPurchase'))