Esempio n. 1
0
    def OnValid(self, event):
        self.m_filename = self.wxFilenameCtrl.GetValue().lower().strip()
        self.m_vat = (self.wxVATCtrl.GetValue() / 100) + 1
        self.m_term = self.wxTermCtrl.GetValue()
        self.m_risk = self.wxRiskCtrl.GetValue()

        if (self.m_operation == 'create' or self.m_operation
                == 'rename') and portfolios.existPortfolio(self.m_filename):
            self.wxFilenameCtrl.SetValue('')
            self.wxFilenameCtrl.SetFocus()
            iTradeError(self,
                        message('portfolio_exist_info') % self.m_filename,
                        message('portfolio_exist_info_title'))
            return

        self.m_name = self.wxNameCtrl.GetValue().strip()
        self.m_accountref = self.wxAccountRefCtrl.GetValue().strip()
        if self.m_operation == 'delete':
            idRet = iTradeYesNo(
                self,
                message('portfolio_delete_confirm') % self.m_name,
                message('portfolio_delete_confirm_title'))
            if idRet == wx.ID_NO:
                return
        if self.m_operation == 'rename':
            idRet = iTradeYesNo(
                self,
                message('portfolio_rename_confirm') % self.m_filename,
                message('portfolio_rename_confirm_title'))
            if idRet == wx.ID_NO:
                return
        self.EndModal(wx.ID_OK)
 def OnCancel(self, event):
     if self.m_dirty:
         #__dlg = wx.MessageDialog(self, message('listquote_dirty_save'), message('listquote_save_desc'), wx.CANCEL | wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
         #__idRet = dlg.ShowModal()
         #__xdlg.Destroy()
         idRet = iTradeYesNo(self,
                             message('listquote_dirty_save'),
                             message('listquote_save_desc'),
                             bCanCancel=True)
         if idRet == wx.ID_YES:
             self.OnSave(None)
             res = True
         elif idRet == wx.ID_NO:
             #__xdlg = wx.MessageDialog(self, message('listquote_nodirty_save'), message('listquote_save_desc'), wx.OK | wx.ICON_INFORMATION)
             #__xdlg.ShowModal()
             #__xdlg.Destroy()
             iTradeInformation(self, message('listquote_nodirty_save'),
                               message('listquote_save_desc'))
             res = True
         else:
             res = False
     else:
         res = True
     if res:
         self.EndModal(wx.ID_CANCEL)
 def OnRemoveCurrentQuote(self,e):
     quote = self.currentQuote()
     # ask a confirmation
     idRet = iTradeYesNo(self, message('remove_quote_info') % quote.name(), message('remove_quote_title'))
     if idRet == wx.ID_YES:
         if removeFromMatrix_iTradeQuote(self,self.m_matrix,quote):
             print 'OnRemoveCurrentQuote:',quote
             self.m_portfolio.setupCurrencies()
             self.RebuildList()
Esempio n. 4
0
def removeStops_iTradeQuote(win,quote):
    if not isinstance(quote,Quote):
        quote = quotes.lookupKey(quote)
    if quote:
        if quote.hasStops():
            iRet = iTradeYesNo(win,message('stops_remove_text')%quote.name(),message('stops_remove_caption'))
            if iRet==wx.ID_YES:
                quotes.removeStops(quote.key())
                return True
    return False
Esempio n. 5
0
def removeStops_iTradeQuote(win, quote):
    if not isinstance(quote, Quote):
        quote = quotes.lookupKey(quote)
    if quote:
        if quote.hasStops():
            iRet = iTradeYesNo(win,
                               message('stops_remove_text') % quote.name(),
                               message('stops_remove_caption'))
            if iRet == wx.ID_YES:
                quotes.removeStops(quote.key())
                return True
    return False
    def OnValid(self,event):
        self.m_filename = self.wxFilenameCtrl.GetValue().lower().strip()
        self.m_vat = (self.wxVATCtrl.GetValue()/100) + 1
        self.m_term = self.wxTermCtrl.GetValue()
        self.m_risk = self.wxRiskCtrl.GetValue()

        if (self.m_operation=='create' or self.m_operation=='rename') and portfolios.existPortfolio(self.m_filename):
            self.wxFilenameCtrl.SetValue('')
            self.wxFilenameCtrl.SetFocus()
            iTradeError(self, message('portfolio_exist_info') % self.m_filename, message('portfolio_exist_info_title'))
            return

        self.m_name = self.wxNameCtrl.GetValue().strip()
        self.m_accountref = self.wxAccountRefCtrl.GetValue().strip()
        if self.m_operation=='delete':
            idRet = iTradeYesNo(self, message('portfolio_delete_confirm')%self.m_name, message('portfolio_delete_confirm_title'))
            if idRet == wx.ID_NO:
                return
        if self.m_operation=='rename':
            idRet = iTradeYesNo(self, message('portfolio_rename_confirm')%self.m_filename, message('portfolio_rename_confirm_title'))
            if idRet == wx.ID_NO:
                return
        self.EndModal(wx.ID_OK)
 def OnClear(self,event):
     if self.m_market==None:
         market = message('all_markets')
         txt = message('clear_symbols_alldesc')
     else:
         market = self.m_market
         txt = message('clear_symbols_onedesc')
     #__xdlg = wx.MessageDialog(self, message('listquote_clear_confirm')%(market,txt), message('listquote_clear_confirm_title'), wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
     #__xidRet = dlg.ShowModal()
     #__xdlg.Destroy()
     idRet = iTradeYesNo(self, message('listquote_clear_confirm')%(market,txt), message('listquote_clear_confirm_title'))
     if idRet == wx.ID_YES:
         wx.SetCursor(wx.HOURGLASS_CURSOR)
         quotes.removeQuotes(self.m_market,self.m_qlist)
         self.m_dirty = True
         self.PopulateList()
     else: return
    def OnCheckSoftware(self,e):
        # can be long ...
        wx.SetCursor(wx.HOURGLASS_CURSOR)

        url = itrade_config.checkNewRelease()

        # restore
        wx.SetCursor(wx.STANDARD_CURSOR)

        if url=='ok':
            iTradeInformation(self,message('checksoftware_uptodate'),message('checksoftware_title'))
        elif url=='dev':
            iTradeInformation(self,message('checksoftware_development'),message('checksoftware_title'))
        elif url=='err':
            iTradeError(self,message('checksoftware_error'),message('checksoftware_title'))
        else:
            if iTradeYesNo(self,message('checksoftware_needupdate'),message('checksoftware_title'))==wx.ID_YES:
                iTradeLaunchBrowser(url,new=True)
    def OnClear(self, event):
        if self.m_market == None:
            market = message('all_markets')
            txt = message('clear_symbols_alldesc')
        else:
            market = self.m_market
            txt = message('clear_symbols_onedesc')
        #__xdlg = wx.MessageDialog(self, message('listquote_clear_confirm')%(market,txt), message('listquote_clear_confirm_title'), wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
        #__xidRet = dlg.ShowModal()
        #__xdlg.Destroy()
        idRet = iTradeYesNo(self,
                            message('listquote_clear_confirm') % (market, txt),
                            message('listquote_clear_confirm_title'))
        if idRet == wx.ID_NO: return

        wx.SetCursor(wx.HOURGLASS_CURSOR)
        quotes.removeQuotes(self.m_market, self.m_qlist)
        self.m_dirty = True
        self.PopulateList()
 def OnCancel(self,event):
     if self.m_dirty:
         #__dlg = wx.MessageDialog(self, message('listquote_dirty_save'), message('listquote_save_desc'), wx.CANCEL | wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
         #__idRet = dlg.ShowModal()
         #__xdlg.Destroy()
         idRet = iTradeYesNo(self, message('listquote_dirty_save'), message('listquote_save_desc'),bCanCancel=True)
         if idRet == wx.ID_YES:
             self.OnSave(None)
             res = True
         elif idRet == wx.ID_NO:
             #__xdlg = wx.MessageDialog(self, message('listquote_nodirty_save'), message('listquote_save_desc'), wx.OK | wx.ICON_INFORMATION)
             #__xdlg.ShowModal()
             #__xdlg.Destroy()
             iTradeInformation(self, message('listquote_nodirty_save'), message('listquote_save_desc'))
             res = True
         else:
             res = False
     else:
         res = True
     if res:
         self.EndModal(wx.ID_CANCEL)
Esempio n. 11
0
 def OnCacheEraseAll(self,e):
     idRet = iTradeYesNo(self, message('cache_erase_confirm_all'), message('cache_erase_confirm_title'))
     if idRet == wx.ID_YES:
         self.m_matrix.flushAll()
Esempio n. 12
0
 def OnCacheEraseNews(self,e):
     idRet = iTradeYesNo(self, message('cache_erase_confirm_news'), message('cache_erase_confirm_title'))
     if idRet == wx.ID_YES:
         self.m_matrix.flushNews()
Esempio n. 13
0
 def OnCacheEraseData(self,e):
     idRet = iTradeYesNo(self, message('cache_erase_confirm_data'), message('cache_erase_confirm_title'))
     if idRet == wx.ID_YES:
         self.m_matrix.flushTrades()