예제 #1
0
    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'))
예제 #2
0
파일: ecfui.py 프로젝트: Guillon88/stoq
    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)
        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)

        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'),
        ])
예제 #3
0
    def __init__(self, store, model=None, visual_mode=False):
        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()
        # We need to use self.model instead of model, since BaseEditorSlave
        # will create one if its None
        EditorCreateEvent.emit(self, self.model, store, visual_mode)
예제 #4
0
    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)
        EditorCreateEvent.connect(self._on_EditorCreateEvent)

        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'),
        ])
예제 #5
0
 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', ''),
     ])
예제 #6
0
    def test_event_without_model(self):
        self._callcount = 0

        def _callback(editor, model, store, visual_mode):
            self._callcount += 1
            self.assertEqual(model.name, 'new model')

        EditorCreateEvent.connect(_callback)
        _TestEditor(self.store, None)

        self.assertEqual(self._callcount, 1)
        EditorCreateEvent.disconnect(_callback)
예제 #7
0
    def test_event_without_model(self):
        self._callcount = 0

        def _callback(editor, model, store, visual_mode):
            self._callcount += 1
            self.assertEqual(model.name, 'new model')

        EditorCreateEvent.connect(_callback)
        _TestEditor(self.store, None)

        self.assertEqual(self._callcount, 1)
        EditorCreateEvent.disconnect(_callback)
예제 #8
0
    def test_event_with_model(self):
        obj = _TempModel(name='existing model')
        self._callcount = 0

        def _callback(editor, model, store, visual_mode):
            self._callcount += 1
            self.assertEqual(model.name, 'existing model')

        EditorCreateEvent.connect(_callback)
        _TestEditor(self.store, obj)

        self.assertEqual(self._callcount, 1)
        EditorCreateEvent.disconnect(_callback)
예제 #9
0
    def test_event_with_model(self):
        obj = _TempModel(name='existing model')
        self._callcount = 0

        def _callback(editor, model, store, visual_mode):
            self._callcount += 1
            self.assertEqual(model.name, 'existing model')

        EditorCreateEvent.connect(_callback)
        _TestEditor(self.store, obj)

        self.assertEqual(self._callcount, 1)
        EditorCreateEvent.disconnect(_callback)
예제 #10
0
파일: ecfui.py 프로젝트: hackedbellini/stoq
 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)
예제 #11
0
 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)
예제 #12
0
    def __init__(self, store, model=None, visual_mode=False):
        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)

        dialog_toplevel = self.main_dialog.get_toplevel()
        dialog_toplevel.connect('response', self._on_toplevel__response)
        dialog_toplevel.connect('delete-event',
                                self._on_toplevel__delete_event)

        # 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()
        # We need to use self.model instead of model, since BaseEditorSlave
        # will create one if its None
        EditorCreateEvent.emit(self, self.model, store, visual_mode)

        if store is not None:
            # This needs to be the last thing done on __init__ since we don't want
            # to consider things like self.create_model as a change
            self._store_pending_count = store.get_pending_count()
예제 #13
0
파일: opticalui.py 프로젝트: Guillon88/stoq
    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', ''),
        ])
예제 #14
0
    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', ''),
        ])
예제 #15
0
    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'))