当前位置: 首页>>代码示例>>Python>>正文


Python Publisher.sendMessage方法代码示例

本文整理汇总了Python中wxbanker.lib.pubsub.Publisher.sendMessage方法的典型用法代码示例。如果您正苦于以下问题:Python Publisher.sendMessage方法的具体用法?Python Publisher.sendMessage怎么用?Python Publisher.sendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxbanker.lib.pubsub.Publisher的用法示例。


在下文中一共展示了Publisher.sendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
def init(path=None, welcome=True):
    import wx, sys
    from wxbanker import fileservice
    from wxbanker.controller import Controller

    bankController = Controller(path)
    
    # We can initialize the wx locale now that the wx.App is initialized.
    localization.initWxLocale()
    
    # Push our custom art provider.
    import wx.lib.art.img2pyartprov as img2pyartprov
    from wxbanker.art import silk, transparent
    for provider in (silk, transparent):
        wx.ArtProvider.Push(img2pyartprov.Img2PyArtProvider(provider))

    # Initialize the wxBanker frame!
    frame = BankerFrame(bankController, welcome)

    # Greet the user if it appears this is their first time using wxBanker.
    config = wx.Config.Get()
    firstTime = not config.ReadBool("RUN_BEFORE")
    if firstTime:
        Publisher.sendMessage("first run")
        config.WriteBool("RUN_BEFORE", True)

    return bankController.wxApp
开发者ID:assem-ch,项目名称:wxbanker,代码行数:29,代码来源:main.py

示例2: OnPaneChanged

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def OnPaneChanged(self, evt=None):
     """Redo the text and layout when the widget state is toggled."""
     self.Layout()
     
     # Change the labels
     expanded = int(self.IsExpanded())        
     self.Label = self.Labels[expanded]
     Publisher.sendMessage("CALCULATOR.TOGGLED", ("SHOW", "HIDE")[expanded])
开发者ID:gustavsen,项目名称:wxbanker,代码行数:10,代码来源:calculator.py

示例3: AddTransactions

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def AddTransactions(self, transactions, sources=None):
     Publisher.sendMessage("batch.start")
     # If we don't have any sources, we want None for each transaction.
     if sources is None:
         sources = [None for i in range(len(transactions))]
         
     for t, source in zip(transactions, sources):
         self.AddTransaction(transaction=t, source=source)
     Publisher.sendMessage("batch.end")
开发者ID:assem-ch,项目名称:wxbanker,代码行数:11,代码来源:account.py

示例4: onAccountClick

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def onAccountClick(self, event):
     """
     This method is called when the current account has been changed by clicking on an account name.
     """
     radio = event.EventObject
     if radio is self.allAccountsRadio:
         account = None
     else:
         account = self.accountObjects[radio.AccountIndex]
     Publisher.sendMessage("user.account changed", account)
开发者ID:assem-ch,项目名称:wxbanker,代码行数:12,代码来源:accountlistctrl.py

示例5: onButton

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def onButton(self, event):
     """If the save button was clicked save, and close the dialog in any case (Close/Cancel/Save)."""
     assert event.Id in (wx.ID_CLOSE, wx.ID_SAVE)
     
     if event.Id == wx.ID_SAVE:
         #we have to substract 1 from combo_box selection because we added the "base currency" entry
         selectedCurrency = self.currencyCombo.GetSelection() - 1
         Publisher.sendMessage("user.account_currency_changed", (self.Account, selectedCurrency))
         
     self.GrandParent.Destroy()
开发者ID:assem-ch,项目名称:wxbanker,代码行数:12,代码来源:accountconfigdialog.py

示例6: Remove

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
    def Remove(self, accountName):
        index = self.AccountIndex(accountName)
        if index == -1:
            raise bankexceptions.InvalidAccountException(accountName)

        account = self.pop(index)
        # Remove all the transactions associated with this account.
        account.Purge()
        
        Publisher.sendMessage("account.removed.%s"%accountName, account)
开发者ID:assem-ch,项目名称:wxbanker,代码行数:12,代码来源:accountlist.py

示例7: AddRecurringTransaction

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def AddRecurringTransaction(self, amount, description, date, repeatType, repeatEvery=1, repeatOn=None, endDate=None, source=None):
     # Create the recurring transaction object.
     recurring = RecurringTransaction(None, self, amount, description, date, repeatType, repeatEvery, repeatOn, endDate, source)
     # Store it.
     self.Store.MakeRecurringTransaction(recurring)
     # Add it to our internal list.
     self.RecurringTransactions.append(recurring)
     
     Publisher.sendMessage("recurringtransaction.created", (self, recurring))
     
     return recurring
开发者ID:assem-ch,项目名称:wxbanker,代码行数:13,代码来源:account.py

示例8: SetAutoSave

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
    def SetAutoSave(self, val):
        self._AutoSave = val
        wx.Config.Get().WriteBool("AUTO-SAVE", val)
        Publisher.sendMessage("controller.autosave_toggled", val)
        for model in self.Models:
            debug.debug("Setting auto-save to: %s" % val)
            model.Store.AutoSave = val

        # If the user enables auto-save, we want to also save.
        if self.AutoSave:
            Publisher.sendMessage("user.saved")
开发者ID:assem-ch,项目名称:wxbanker,代码行数:13,代码来源:controller.py

示例9: onSearch

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
    def onSearch(self, event=None):
        # Stop any timer that may be active, in the case of a manual search.
        self.SearchTimer.Stop()
        searchString = self.searchCtrl.Value # For a date, should be YYYY-MM-DD.
        matchType = self.matchChoices.index(self.matchBox.Value)

        searchInfo = (searchString, matchType)
        # Consider a blank search as a search cancellation.
        if searchString == "":
            self.onCancel()
        else:
            Publisher.sendMessage("SEARCH.INITIATED", searchInfo)
开发者ID:xuzhen,项目名称:wxbanker,代码行数:14,代码来源:searchctrl.py

示例10: Login

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
    def Login(cls, username, password, notify=True):
        if cls.IsLoggedIn():
            return

        accounts = {}
        for account in mintapi.get_accounts(username, password):
            account['balance'] = account['value'] # convert to wxBanker speak
            accounts[account['accountId']] = account
        cls._CachedAccounts = accounts

        if notify:
            Publisher.sendMessage("mint.updated")
开发者ID:assem-ch,项目名称:wxbanker,代码行数:14,代码来源:api.py

示例11: onNewTransaction

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
    def onNewTransaction(self, event=None):
        # First, ensure an account is selected.
        destAccount = self.CurrentAccount
        if destAccount is None:
            dlg = wx.MessageDialog(self.Parent,
                                _("Please select an account and then try again."),
                                _("No account selected"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return

        # Grab the transaction values from the control.
        result = self.getValues()
        if result is None:
            # Validation failed, user was informed.
            return
        amount, desc, date = result

        # If a search is active, we have to ask the user what they want to do.
        if self.Parent.Parent.searchActive:
            msg = _("A search is currently active.") + " " + _('Would you like to clear the current search and make this transaction in "%s"?') % (destAccount.Name)
            dlg = wx.MessageDialog(self.Parent, msg, _("Clear search?"), style=wx.YES_NO|wx.ICON_WARNING)
            result = dlg.ShowModal()
            if result == wx.ID_YES:
                Publisher.sendMessage("SEARCH.CANCELLED")
            else:
                return

        sourceAccount = None
        # If the transfer box is checked, this is a transfer!
        if self.transferCheck.Value:
            result = self.Parent.transferRow.GetAccounts(destAccount)
            if result is None:
                dlg = wx.MessageDialog(self.Parent,
                                       _("This transaction is marked as a transfer. Please select the transfer account."),
                                       _("No account selected"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                return
            sourceAccount, destAccount = result

        # Now let's see if this is a recurring transaction
        if self.recursCheck.GetValue():
            settings = self.Parent.GetSettings()
            args = [amount, desc, date] + list(settings) + [sourceAccount]
            destAccount.AddRecurringTransaction(*args)
        else:
            destAccount.AddTransaction(amount, desc, date, sourceAccount)
            
        # A transaction was added, we can stop flashing if we were.
        self.newButton.StopFlashing()
        
        # Reset the controls and focus to their default values.
        self.clear()
开发者ID:assem-ch,项目名称:wxbanker,代码行数:54,代码来源:newtransactionctrl.py

示例12: getTransactionsFrom

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def getTransactionsFrom(self, account):
     transactions = TransactionList()
     # Generate a map of recurring transaction IDs to the objects for fast look-up.
     recurringCache = {}
     for recurring in account.Parent.GetRecurringTransactions():
         recurringCache[recurring.ID] = recurring
         
     Publisher.sendMessage("batch.start")
     for result in self.dbconn.cursor().execute('SELECT * FROM transactions WHERE accountId=?', (account.ID,)).fetchall():
         t = self.result2transaction(result, account, recurringCache=recurringCache)
         transactions.append(t)
     Publisher.sendMessage("batch.end")
     return transactions
开发者ID:assem-ch,项目名称:wxbanker,代码行数:15,代码来源:persistentstore.py

示例13: testToggleShowZero

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def testToggleShowZero(self):
     # Create two accounts, make sure they are visible.
     a = self.Model.CreateAccount("A")
     b = self.Model.CreateAccount("B")
     b.AddTransaction(1)
     self.assertEqual(self.AccountListCtrl.GetVisibleCount(), 2)
     
     # Disable showing zero balance accounts, make sure the menu item is unchecked and one account is hidden.
     Publisher.sendMessage("user.showzero_toggled", False)
     self.assertFalse( self.Frame.MenuBar.showZeroMenuItem.IsChecked() )
     self.assertEqual(self.AccountListCtrl.GetVisibleCount(), 1)
     
     # Make sure that a balance going to / coming from zero results in a visibility toggle.
     b.AddTransaction(-1)
     self.assertEqual(self.AccountListCtrl.GetVisibleCount(), 0)
开发者ID:assem-ch,项目名称:wxbanker,代码行数:17,代码来源:guitests.py

示例14: onWarning

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
 def onWarning(self, message):
     warning = message.topic[1]
     if warning == "dirty exit":
         event = message.data
         title = _("Save changes?")
         msg = _("You have made changes since the last save. Would you like to save before exiting?")
         msg += "\n\n" + _("Note that enabling auto-save from the File menu will eliminate the need for manual saving.")
         dlg = wx.MessageDialog(self, msg, title, style=wx.CANCEL|wx.YES_NO|wx.ICON_WARNING)
         result = dlg.ShowModal()
         if result == wx.ID_YES:
             Publisher.sendMessage("user.saved")
         elif result == wx.ID_CANCEL:
             # The user cancelled the close, so cancel the event skip.
             event.Skip(False)
         dlg.Destroy()
开发者ID:assem-ch,项目名称:wxbanker,代码行数:17,代码来源:main.py

示例15: Create

# 需要导入模块: from wxbanker.lib.pubsub import Publisher [as 别名]
# 或者: from wxbanker.lib.pubsub.Publisher import sendMessage [as 别名]
    def Create(self, accountName):
        self.ThrowExceptionOnInvalidName(accountName)

        currency = 0
        if len(self):
            # If the list contains items, the currency needs to be consistent.
            currency = self[-1].Currency

        account = self.Store.CreateAccount(accountName, currency)
        # Make sure this account knows its parent.
        account.Parent = self
        self.append(account)
        self.sort()
        Publisher.sendMessage("account.created.%s" % accountName, account)
        return account
开发者ID:assem-ch,项目名称:wxbanker,代码行数:17,代码来源:accountlist.py


注:本文中的wxbanker.lib.pubsub.Publisher.sendMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。