43 def usage(): |
43 def usage(): |
44 print "\nUsage of Beremiz.py :" |
44 print "\nUsage of Beremiz.py :" |
45 print "\n %s [Projectpath] [Buildpath]\n"%sys.argv[0] |
45 print "\n %s [Projectpath] [Buildpath]\n"%sys.argv[0] |
46 |
46 |
47 try: |
47 try: |
48 opts, args = getopt.getopt(sys.argv[1:], "hu:", ["help", "updatecheck="]) |
48 opts, args = getopt.getopt(sys.argv[1:], "hue:", ["help", "updatecheck=", "extend="]) |
49 except getopt.GetoptError: |
49 except getopt.GetoptError: |
50 # print help information and exit: |
50 # print help information and exit: |
51 usage() |
51 usage() |
52 sys.exit(2) |
52 sys.exit(2) |
53 |
53 |
|
54 extensions=[] |
|
55 |
54 for o, a in opts: |
56 for o, a in opts: |
55 if o in ("-h", "--help"): |
57 if o in ("-h", "--help"): |
56 usage() |
58 usage() |
57 sys.exit() |
59 sys.exit() |
58 if o in ("-u", "--updatecheck"): |
60 if o in ("-u", "--updatecheck"): |
59 updateinfo_url = a |
61 updateinfo_url = a |
|
62 if o in ("-e", "--extend"): |
|
63 extensions.append(a) |
60 |
64 |
61 if len(args) > 2: |
65 if len(args) > 2: |
62 usage() |
66 usage() |
63 sys.exit() |
67 sys.exit() |
64 elif len(args) == 1: |
68 elif len(args) == 1: |
149 from ProjectController import ProjectController, MATIEC_ERROR_MODEL |
153 from ProjectController import ProjectController, MATIEC_ERROR_MODEL |
150 from util.MiniTextControler import MiniTextControler |
154 from util.MiniTextControler import MiniTextControler |
151 from util.ProcessLogger import ProcessLogger |
155 from util.ProcessLogger import ProcessLogger |
152 |
156 |
153 from docutil import OpenHtmlFrame |
157 from docutil import OpenHtmlFrame |
154 from PLCOpenEditor import IDEFrame, AppendMenu, TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES, USE_AUI |
158 from PLCOpenEditor import IDEFrame, AppendMenu, TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES |
155 from PLCOpenEditor import EditorPanel, Viewer, TextViewer, GraphicViewer, ResourceEditor, ConfigurationEditor, DataTypeEditor |
159 from PLCOpenEditor import EditorPanel, Viewer, TextViewer, GraphicViewer, ResourceEditor, ConfigurationEditor, DataTypeEditor |
156 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY |
160 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY |
157 |
161 |
158 SCROLLBAR_UNIT = 10 |
162 SCROLLBAR_UNIT = 10 |
159 WINDOW_COLOUR = wx.Colour(240,240,240) |
163 WINDOW_COLOUR = wx.Colour(240,240,240) |
507 name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), |
511 name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), |
508 size=wx.Size(0, 0), style=wx.TE_MULTILINE|wx.TE_RICH2) |
512 size=wx.Size(0, 0), style=wx.TE_MULTILINE|wx.TE_RICH2) |
509 self.LogConsole.Bind(wx.EVT_LEFT_DCLICK, self.OnLogConsoleDClick) |
513 self.LogConsole.Bind(wx.EVT_LEFT_DCLICK, self.OnLogConsoleDClick) |
510 self.MainTabs["LogConsole"] = (self.LogConsole, _("Log Console")) |
514 self.MainTabs["LogConsole"] = (self.LogConsole, _("Log Console")) |
511 self.BottomNoteBook.AddPage(*self.MainTabs["LogConsole"]) |
515 self.BottomNoteBook.AddPage(*self.MainTabs["LogConsole"]) |
512 if USE_AUI: |
516 self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogConsole), wx.RIGHT) |
513 self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogConsole), wx.RIGHT) |
|
514 |
517 |
515 self._init_beremiz_sizers() |
518 self._init_beremiz_sizers() |
516 |
519 |
517 def __init__(self, parent, projectOpen=None, buildpath=None, ctr=None, debug=True): |
520 def __init__(self, parent, projectOpen=None, buildpath=None, ctr=None, debug=True): |
518 IDEFrame.__init__(self, parent, debug) |
521 IDEFrame.__init__(self, parent, debug) |
1916 |
1919 |
1917 if __name__ == '__main__': |
1920 if __name__ == '__main__': |
1918 # Install a exception handle for bug reports |
1921 # Install a exception handle for bug reports |
1919 AddExceptHook(os.getcwd(),updateinfo_url) |
1922 AddExceptHook(os.getcwd(),updateinfo_url) |
1920 |
1923 |
|
1924 # Load extensions |
|
1925 for extfilename in extensions: |
|
1926 sys.path.append(os.path.split(os.path.realpath(extfilename))[0]) |
|
1927 execfile(a, locals()) |
|
1928 |
1921 frame = Beremiz(None, projectOpen, buildpath) |
1929 frame = Beremiz(None, projectOpen, buildpath) |
1922 splash.Close() |
1930 splash.Close() |
1923 #wx.Yield() |
|
1924 frame.Show() |
1931 frame.Show() |
1925 app.MainLoop() |
1932 app.MainLoop() |