コード例 #1
0
ファイル: itrade_wxcurrency.py プロジェクト: wjssx/itrade
    def OnRefresh(self, e):
        x = 0
        lst = currencies.m_currencies
        max = len(lst)
        keepGoing = True
        if self.hasFocus():
            dlg = wx.ProgressDialog(message('currency_refreshing'), "", max,
                                    self, wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
        else:
            dlg = None
        for eachKey in lst:
            if not keepGoing:
                break
            curTo = eachKey[:3]
            curFrom = eachKey[3:]
            if dlg:
                (keepGoing, skip) = dlg.Update(x,
                                               "%s -> %s" % (curFrom, curTo))
            currencies.get(curTo, curFrom)
            self.refreshLine(eachKey, x, True)
            x = x + 1

        currencies.save()
        if dlg:
            dlg.Destroy()
コード例 #2
0
    def OnUpdateConvert(self, event):
        # can be long ...
        wx.SetCursor(wx.HOURGLASS_CURSOR)

        # update currency rate if needed
        if not currencies.used(self.m_destcur, self.m_orgcur):
            currencies.inuse(self.m_destcur, self.m_orgcur, True)
            currencies.get(self.m_destcur, self.m_orgcur)

        # get the value and convert
        o = self.wxOrgVal.GetValue()
        d = convert(self.m_destcur, self.m_orgcur, o)
        self.wxDestVal.SetLabel('%.3f' % d)

        # should be enough !
        wx.SetCursor(wx.STANDARD_CURSOR)
コード例 #3
0
    def OnUpdateConvert(self,event):
        # can be long ...
        wx.SetCursor(wx.HOURGLASS_CURSOR)

        # update currency rate if needed
        if not currencies.used(self.m_destcur,self.m_orgcur):
            currencies.inuse(self.m_destcur,self.m_orgcur,True)
            currencies.get(self.m_destcur,self.m_orgcur)

        # get the value and convert
        o = self.wxOrgVal.GetValue()
        d = convert(self.m_destcur,self.m_orgcur,o)
        self.wxDestVal.SetLabel('%.3f' % d)

        # should be enough !
        wx.SetCursor(wx.STANDARD_CURSOR)
コード例 #4
0
    def OnRefresh(self,e):
        x = 0
        lst = currencies.m_currencies
        max = len(lst)
        keepGoing = True
        if self.hasFocus():
            dlg = wx.ProgressDialog(message('currency_refreshing'),"",max,self,wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
        else:
            dlg = None
        for eachKey in lst:
            if keepGoing:
                curTo = eachKey[:3]
                curFrom = eachKey[3:]
                if dlg:
                    keepGoing = dlg.Update(x,"%s -> %s" % (curFrom,curTo))
                currencies.get(curTo,curFrom)
                self.refreshLine(eachKey,x,True)
                x = x + 1

        currencies.save()
        if dlg:
            dlg.Destroy()