BeremizIDE.py
changeset 1783 3311eea28d56
parent 1782 5b6ad7a7fd9d
child 1792 4d1de8b0183f
equal deleted inserted replaced
1782:5b6ad7a7fd9d 1783:3311eea28d56
    30 import shutil
    30 import shutil
    31 import random
    31 import random
    32 import time
    32 import time
    33 import version
    33 import version
    34 
    34 
    35 import util.paths as paths
       
    36 from types import ListType
    35 from types import ListType
    37 
       
    38 beremiz_dir = paths.AbsDir(__file__)
       
    39 
       
    40 
       
    41 def Bpath(*args):
       
    42     return os.path.join(beremiz_dir, *args)
       
    43 
       
    44 
    36 
    45 import wx.lib.buttons
    37 import wx.lib.buttons
    46 import wx.lib.statbmp
    38 import wx.lib.statbmp
    47 import wx.stc
    39 import wx.stc
    48 import cPickle
    40 import cPickle
    51 import re
    43 import re
    52 import platform
    44 import platform
    53 import time
    45 import time
    54 import traceback
    46 import traceback
    55 import commands
    47 import commands
    56 
    48 import threading
       
    49 from threading import Lock, Timer, currentThread
       
    50 from time import time as gettime
       
    51 
       
    52 import util.paths as paths
    57 from docutil import OpenHtmlFrame
    53 from docutil import OpenHtmlFrame
    58 from editors.EditorPanel import EditorPanel
    54 from editors.EditorPanel import EditorPanel
    59 from editors.Viewer import Viewer
    55 from editors.Viewer import Viewer
    60 from editors.TextViewer import TextViewer
    56 from editors.TextViewer import TextViewer
    61 from editors.ResourceEditor import ConfigurationEditor, ResourceEditor
    57 from editors.ResourceEditor import ConfigurationEditor, ResourceEditor
    65 from controls.LogViewer import LogViewer
    61 from controls.LogViewer import LogViewer
    66 from controls.CustomStyledTextCtrl import CustomStyledTextCtrl
    62 from controls.CustomStyledTextCtrl import CustomStyledTextCtrl
    67 from controls import EnhancedStatusBar as esb
    63 from controls import EnhancedStatusBar as esb
    68 from dialogs.AboutDialog import ShowAboutDialog
    64 from dialogs.AboutDialog import ShowAboutDialog
    69 
    65 
    70 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY, ITEM_PROJECT, ITEM_RESOURCE
    66 from PLCControler import \
       
    67     LOCATION_CONFNODE, \
       
    68     LOCATION_MODULE, \
       
    69     LOCATION_GROUP, \
       
    70     LOCATION_VAR_INPUT, \
       
    71     LOCATION_VAR_OUTPUT, \
       
    72     LOCATION_VAR_MEMORY, \
       
    73     ITEM_PROJECT, \
       
    74     ITEM_RESOURCE
       
    75 
    71 from ProjectController import ProjectController, GetAddMenuItems, MATIEC_ERROR_MODEL, ITEM_CONFNODE
    76 from ProjectController import ProjectController, GetAddMenuItems, MATIEC_ERROR_MODEL, ITEM_CONFNODE
    72 
    77 
       
    78 from IDEFrame import \
       
    79     TITLE,\
       
    80     EDITORTOOLBAR,\
       
    81     FILEMENU,\
       
    82     EDITMENU,\
       
    83     DISPLAYMENU,\
       
    84     PROJECTTREE,\
       
    85     POUINSTANCEVARIABLESPANEL,\
       
    86     LIBRARYTREE,\
       
    87     SCALING,\
       
    88     PAGETITLES,\
       
    89     IDEFrame, \
       
    90     AppendMenu,\
       
    91     EncodeFileSystemPath, \
       
    92     DecodeFileSystemPath
       
    93 
       
    94 from util.BitmapLibrary import GetBitmap
       
    95 
       
    96 
       
    97 beremiz_dir = paths.AbsDir(__file__)
       
    98 
       
    99 
       
   100 def Bpath(*args):
       
   101     return os.path.join(beremiz_dir, *args)
       
   102 
    73 
   103 
    74 MAX_RECENT_PROJECTS = 9
   104 MAX_RECENT_PROJECTS = 9
       
   105 
    75 
   106 
    76 if wx.Platform == '__WXMSW__':
   107 if wx.Platform == '__WXMSW__':
    77     faces = {
   108     faces = {
    78         'mono': 'Courier New',
   109         'mono': 'Courier New',
    79         'size': 8,
   110         'size': 8,
    82     faces = {
   113     faces = {
    83         'mono': 'Courier',
   114         'mono': 'Courier',
    84         'size': 10,
   115         'size': 10,
    85     }
   116     }
    86 
   117 
    87 from threading import Lock, Timer, currentThread
   118 
    88 MainThread = currentThread().ident
   119 MainThread = currentThread().ident
    89 REFRESH_PERIOD = 0.1
   120 REFRESH_PERIOD = 0.1
    90 from time import time as gettime
       
    91 
   121 
    92 
   122 
    93 class LogPseudoFile:
   123 class LogPseudoFile:
    94     """ Base class for file like objects to facilitate StdOut for the Shell."""
   124     """ Base class for file like objects to facilitate StdOut for the Shell."""
    95     def __init__(self, output, risecall):
   125     def __init__(self, output, risecall):
   200     def isatty(self):
   230     def isatty(self):
   201         return False
   231         return False
   202 
   232 
   203 
   233 
   204 ID_FILEMENURECENTPROJECTS = wx.NewId()
   234 ID_FILEMENURECENTPROJECTS = wx.NewId()
   205 
       
   206 from IDEFrame import TITLE,\
       
   207                      EDITORTOOLBAR,\
       
   208                      FILEMENU,\
       
   209                      EDITMENU,\
       
   210                      DISPLAYMENU,\
       
   211                      PROJECTTREE,\
       
   212                      POUINSTANCEVARIABLESPANEL,\
       
   213                      LIBRARYTREE,\
       
   214                      SCALING,\
       
   215                      PAGETITLES,\
       
   216                      IDEFrame, AppendMenu,\
       
   217                      EncodeFileSystemPath, DecodeFileSystemPath
       
   218 from util.BitmapLibrary import GetBitmap
       
   219 
   235 
   220 
   236 
   221 class Beremiz(IDEFrame):
   237 class Beremiz(IDEFrame):
   222 
   238 
   223     def _init_utils(self):
   239     def _init_utils(self):
  1093 
  1109 
  1094 
  1110 
  1095 # -------------------------------------------------------------------------------
  1111 # -------------------------------------------------------------------------------
  1096 #                               Exception Handler
  1112 #                               Exception Handler
  1097 # -------------------------------------------------------------------------------
  1113 # -------------------------------------------------------------------------------
  1098 import threading
       
  1099 import traceback
       
  1100 
  1114 
  1101 Max_Traceback_List_Size = 20
  1115 Max_Traceback_List_Size = 20
  1102 
  1116 
  1103 
  1117 
  1104 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path):
  1118 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path):