-
Notifications
You must be signed in to change notification settings - Fork 0
/
itrade_wxmain.py
118 lines (98 loc) · 4.2 KB
/
itrade_wxmain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python
# ============================================================================
# Project Name : iTrade
# Module Name : itrade_wxmain.py
#
# Description: wxPython main
#
# The Original Code is iTrade code (http://itrade.sourceforge.net).
#
# The Initial Developer of the Original Code is Gilles Dumortier.
#
# Portions created by the Initial Developer are Copyright (C) 2004-2008 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see http://www.gnu.org/licenses/gpl.html
#
# History Rev Description
# 2005-03-20 dgil Wrote it from scratch
# 2006-01-2x dgil Split module. itrade_wxmatrix.py for matrix code !
# 2007-01-2x dgil Notebook re-architecture -> itrade_wxbook.py
# ============================================================================
# ============================================================================
# Imports
# ============================================================================
# python system
import os
import logging
# iTrade system
import itrade_config
# wxPython system
if not itrade_config.nowxversion:
import itrade_wxversion
import wx
import itrade_logging
from itrade_portfolio import loadPortfolio
from itrade_matrix import createMatrix
# iTrade wxPython system
from itrade_wxbook import iTradeMainWindow
# ============================================================================
# iTrade_SplashScreen
# ============================================================================
class iTrade_SplashScreen(wx.SplashScreen):
def __init__(self,app):
image = wx.Image(os.path.join(itrade_config.dirRes, "itrade.jpg"))
wx.SplashScreen.__init__(self,
image.ConvertToBitmap(),
wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_NO_TIMEOUT,
0, None, -1)
# ============================================================================
# iTradeApp
# ============================================================================
class iTradeApp(wx.App):
def OnInit(self):
splash = iTrade_SplashScreen(self)
splash.Show()
provider = wx.SimpleHelpProvider()
wx.HelpProvider_Set(provider)
wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
self._init_app()
splash.Destroy()
return True
def _init_app(self):
#itrade_logging.setLevel(logging.DEBUG)
#print '--- load current portfolio ---'
portfolio = loadPortfolio()
#print 'Portfolio : %s:%s:%s:%s:%f ' % (portfolio.filename(), portfolio.name(), portfolio.accountref(), portfolio.market(), portfolio.vat())
print '--- build a matrix -----------'
matrix = createMatrix(portfolio.filename(), portfolio)
frame = iTradeMainWindow(None, portfolio, matrix)
self.SetTopWindow(frame)
# ============================================================================
# start_iTradeWindow
# ============================================================================
def start_iTradeWindow():
app = iTradeApp(False)
app.MainLoop()
# ============================================================================
# Test me
# ============================================================================
if __name__=='__main__':
itrade_logging.setLevel(logging.INFO)
start_iTradeWindow()
# ============================================================================
# That's all folks !
# ============================================================================