objdictgen/objdictedit.py
author etisserant
Tue, 17 Jul 2007 18:20:50 +0200
changeset 241 4ecc2f3690f4
parent 232 e435bbec1759
child 245 d43ebbed895f
permissions -rwxr-xr-x
Fixed mutex typo in win32
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
#!/usr/bin/env python
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
#This file is part of CanFestival, a library implementing CanOpen Stack. 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
#
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
#
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
#See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
#
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
#This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
#modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
#License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
#version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
#
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
#This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
#but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
#Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
#
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
#You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
#License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    23
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    24
from wxPython.wx import *
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    25
from wxPython.grid import *
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    26
import wx
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    27
import wx.grid
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    28
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    29
from types import *
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    30
import os, re, platform, sys, time, traceback, getopt
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
__version__ = "$Revision$"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    33
206
6787754b251b Bugs corrected on objdictedit and networkdict
greg
parents: 205
diff changeset
    34
from node import OD_Subindex, OD_MultipleSubindexes, OD_IdenticalSubindexes, OD_IdenticalIndexes
6787754b251b Bugs corrected on objdictedit and networkdict
greg
parents: 205
diff changeset
    35
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    36
from nodemanager import *
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
    37
from subindextable import *
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
    38
from commondialogs import *
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
from doc_index.DS301_index import *
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    40
72
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    41
try:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    42
    from wxPython.html import *
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    43
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    44
    wxEVT_HTML_URL_CLICK = wxNewId()
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    45
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    46
    def EVT_HTML_URL_CLICK(win, func):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    47
        win.Connect(-1, -1, wxEVT_HTML_URL_CLICK, func)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    48
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    49
    class wxHtmlWindowUrlClick(wxPyEvent):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    50
        def __init__(self, linkinfo):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    51
            wxPyEvent.__init__(self)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    52
            self.SetEventType(wxEVT_HTML_URL_CLICK)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    53
            self.linkinfo = (linkinfo.GetHref(), linkinfo.GetTarget())
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    54
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    55
    class wxUrlClickHtmlWindow(wxHtmlWindow):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    56
        """ HTML window that generates and OnLinkClicked event.
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    57
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    58
        Use this to avoid having to override HTMLWindow
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    59
        """
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    60
        def OnLinkClicked(self, linkinfo):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    61
            wxPostEvent(self, wxHtmlWindowUrlClick(linkinfo))
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    62
    
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    63
#-------------------------------------------------------------------------------
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    64
#                                Html Frame
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    65
#-------------------------------------------------------------------------------
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    66
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    67
    [wxID_HTMLFRAME, wxID_HTMLFRAMEHTMLCONTENT] = [wx.NewId() for _init_ctrls in range(2)]
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    68
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    69
    class HtmlFrame(wx.Frame):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    70
        def _init_ctrls(self, prnt):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    71
            # generated method, don't edit
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    72
            wx.Frame.__init__(self, id=wxID_HTMLFRAME, name='HtmlFrame',
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    73
                  parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    74
                  style=wx.DEFAULT_FRAME_STYLE, title='')
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    75
            self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=wxID_HTMLFRAME)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    76
            
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    77
            self.HtmlContent = wxUrlClickHtmlWindow(id=wxID_HTMLFRAMEHTMLCONTENT,
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    78
                  name='HtmlContent', parent=self, pos=wx.Point(0, 0),
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    79
                  size=wx.Size(-1, -1), style=wxHW_SCROLLBAR_AUTO|wxHW_NO_SELECTION)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    80
            EVT_HTML_URL_CLICK(self.HtmlContent, self.OnLinkClick)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    81
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    82
        def __init__(self, parent, opened):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    83
            self._init_ctrls(parent)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    84
            self.HtmlFrameOpened = opened
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    85
        
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    86
        def SetHtmlCode(self, htmlcode):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    87
            self.HtmlContent.SetPage(htmlcode)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    88
            
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    89
        def SetHtmlPage(self, htmlpage):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    90
            self.HtmlContent.LoadPage(htmlpage)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    91
            
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    92
        def OnCloseFrame(self, event):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    93
            self.HtmlFrameOpened.remove(self.GetTitle())
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    94
            event.Skip()
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    95
        
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    96
        def OnLinkClick(self, event):
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    97
            url = event.linkinfo[0]
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    98
            try:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
    99
                import webbrowser
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   100
            except ImportError:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   101
                wxMessageBox('Please point your browser at: %s' % url)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   102
            else:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   103
                webbrowser.open(url)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   104
    
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   105
    Html_Window = True
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   106
except:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   107
    Html_Window = False
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   108
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   109
def create(parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   110
    return objdictedit(parent)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   111
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   112
def usage():
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   113
    print "\nUsage of objdictedit.py :"
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   114
    print "\n   %s [Filepath, ...]\n"%sys.argv[0]
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   115
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   116
try:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   117
    opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   118
except getopt.GetoptError:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   119
    # print help information and exit:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   120
    usage()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   121
    sys.exit(2)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   122
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   123
for o, a in opts:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   124
    if o in ("-h", "--help"):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   125
        usage()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   126
        sys.exit()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   127
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   128
filesOpen = args
158
b505f7116a1c Moved DS-301 PDF into objdictgen. Fixed installation on linux. Now TestMasterSlave is also installed in $PREFIX/bin.
etisserant
parents: 149
diff changeset
   129
ScriptDirectory = sys.path[0]
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   130
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   131
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   132
[wxID_OBJDICTEDIT, wxID_OBJDICTEDITFILEOPENED, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   133
 wxID_OBJDICTEDITHELPBAR,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   134
] = [wx.NewId() for _init_ctrls in range(3)]
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   135
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   136
[wxID_OBJDICTEDITADDMENUITEMS0, wxID_OBJDICTEDITADDMENUITEMS1, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   137
 wxID_OBJDICTEDITADDMENUITEMS2, wxID_OBJDICTEDITADDMENUITEMS3, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   138
 wxID_OBJDICTEDITADDMENUITEMS4, wxID_OBJDICTEDITADDMENUITEMS5, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   139
] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   140
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   141
[wxID_OBJDICTEDITFILEMENUITEMS0, wxID_OBJDICTEDITFILEMENUITEMS1, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   142
 wxID_OBJDICTEDITFILEMENUITEMS2, wxID_OBJDICTEDITFILEMENUITEMS4, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   143
 wxID_OBJDICTEDITFILEMENUITEMS5, wxID_OBJDICTEDITFILEMENUITEMS6, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   144
 wxID_OBJDICTEDITFILEMENUITEMS7, wxID_OBJDICTEDITFILEMENUITEMS8,
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   145
 wxID_OBJDICTEDITFILEMENUITEMS9,
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   146
] = [wx.NewId() for _init_coll_FileMenu_Items in range(9)]
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   147
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   148
[wxID_OBJDICTEDITEDITMENUITEMS0, wxID_OBJDICTEDITEDITMENUITEMS1, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   149
 wxID_OBJDICTEDITEDITMENUITEMS2, wxID_OBJDICTEDITEDITMENUITEMS4, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   150
 wxID_OBJDICTEDITEDITMENUITEMS6, wxID_OBJDICTEDITEDITMENUITEMS7, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   151
 wxID_OBJDICTEDITEDITMENUITEMS8, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   152
] = [wx.NewId() for _init_coll_EditMenu_Items in range(7)]
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   153
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   154
[wxID_OBJDICTEDITHELPMENUITEMS0, wxID_OBJDICTEDITHELPMENUITEMS1,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   155
 wxID_OBJDICTEDITHELPMENUITEMS2,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   156
] = [wx.NewId() for _init_coll_HelpMenu_Items in range(3)]
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   157
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   158
class objdictedit(wx.Frame):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   159
    def _init_coll_menuBar1_Menus(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   160
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   161
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   162
        parent.Append(menu=self.FileMenu, title='File')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   163
        parent.Append(menu=self.EditMenu, title='Edit')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   164
        parent.Append(menu=self.AddMenu, title='Add')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   165
        parent.Append(menu=self.HelpMenu, title='Help')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   166
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   167
    def _init_coll_EditMenu_Items(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   168
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   169
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   170
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS4,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   171
              kind=wx.ITEM_NORMAL, text='Refresh\tCTRL+R')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   172
        parent.AppendSeparator()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   173
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS1,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   174
              kind=wx.ITEM_NORMAL, text='Undo\tCTRL+Z')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   175
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   176
              kind=wx.ITEM_NORMAL, text='Redo\tCTRL+Y')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   177
        parent.AppendSeparator()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   178
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS6,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   179
              kind=wx.ITEM_NORMAL, text='Node infos')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   180
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS2,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   181
              kind=wx.ITEM_NORMAL, text='DS-301 Profile')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   182
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS8,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   183
              kind=wx.ITEM_NORMAL, text='DS-302 Profile')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   184
        parent.Append(help='', id=wxID_OBJDICTEDITEDITMENUITEMS7,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   185
              kind=wx.ITEM_NORMAL, text='Other Profile')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   186
        self.Bind(wx.EVT_MENU, self.OnUndoMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   187
              id=wxID_OBJDICTEDITEDITMENUITEMS1)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   188
        self.Bind(wx.EVT_MENU, self.OnRedoMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   189
              id=wxID_OBJDICTEDITEDITMENUITEMS0)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   190
        self.Bind(wx.EVT_MENU, self.OnCommunicationMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   191
              id=wxID_OBJDICTEDITEDITMENUITEMS2)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   192
        self.Bind(wx.EVT_MENU, self.OnRefreshMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   193
              id=wxID_OBJDICTEDITEDITMENUITEMS4)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   194
        self.Bind(wx.EVT_MENU, self.OnNodeInfosMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   195
              id=wxID_OBJDICTEDITEDITMENUITEMS6)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   196
        self.Bind(wx.EVT_MENU, self.OnEditProfileMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   197
              id=wxID_OBJDICTEDITEDITMENUITEMS7)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   198
        self.Bind(wx.EVT_MENU, self.OnOtherCommunicationMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   199
              id=wxID_OBJDICTEDITEDITMENUITEMS8)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   200
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   201
    def _init_coll_HelpMenu_Items(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   202
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   203
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   204
        parent.Append(help='', id=wxID_OBJDICTEDITHELPMENUITEMS0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   205
              kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   206
        self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   207
              id=wxID_OBJDICTEDITHELPMENUITEMS0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   208
        parent.Append(help='', id=wxID_OBJDICTEDITHELPMENUITEMS1,
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   209
              kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   210
        self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu,
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   211
              id=wxID_OBJDICTEDITHELPMENUITEMS1)
72
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   212
        if Html_Window:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   213
            parent.Append(help='', id=wxID_OBJDICTEDITHELPMENUITEMS2,
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   214
                  kind=wx.ITEM_NORMAL, text='About')
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   215
            self.Bind(wx.EVT_MENU, self.OnAboutMenu,
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   216
                  id=wxID_OBJDICTEDITHELPMENUITEMS2)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   217
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   218
    def _init_coll_FileMenu_Items(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   219
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   220
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   221
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS5,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   222
              kind=wx.ITEM_NORMAL, text='New\tCTRL+N')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   223
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   224
              kind=wx.ITEM_NORMAL, text='Open\tCTRL+O')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   225
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS1,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   226
              kind=wx.ITEM_NORMAL, text='Save\tCTRL+S')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   227
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS6,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   228
              kind=wx.ITEM_NORMAL, text='Save As...\tALT+S')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   229
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS2,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   230
              kind=wx.ITEM_NORMAL, text='Close\tCTRL+W')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   231
        parent.AppendSeparator()
171
db7a030babb2 EDS import
etisserant
parents: 158
diff changeset
   232
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS7,
db7a030babb2 EDS import
etisserant
parents: 158
diff changeset
   233
              kind=wx.ITEM_NORMAL, text='Import EDS file')
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   234
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS9,
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   235
              kind=wx.ITEM_NORMAL, text='Export to EDS file')
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   236
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS8,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   237
              kind=wx.ITEM_NORMAL, text='Build Dictionary\tCTRL+B')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   238
        parent.AppendSeparator()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   239
        parent.Append(help='', id=wxID_OBJDICTEDITFILEMENUITEMS4,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   240
              kind=wx.ITEM_NORMAL, text='Exit')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   241
        self.Bind(wx.EVT_MENU, self.OnOpenMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   242
              id=wxID_OBJDICTEDITFILEMENUITEMS0)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   243
        self.Bind(wx.EVT_MENU, self.OnSaveMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   244
              id=wxID_OBJDICTEDITFILEMENUITEMS1)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   245
        self.Bind(wx.EVT_MENU, self.OnCloseMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   246
              id=wxID_OBJDICTEDITFILEMENUITEMS2)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   247
        self.Bind(wx.EVT_MENU, self.OnQuitMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   248
              id=wxID_OBJDICTEDITFILEMENUITEMS4)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   249
        self.Bind(wx.EVT_MENU, self.OnNewMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   250
              id=wxID_OBJDICTEDITFILEMENUITEMS5)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   251
        self.Bind(wx.EVT_MENU, self.OnSaveAsMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   252
              id=wxID_OBJDICTEDITFILEMENUITEMS6)
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   253
        self.Bind(wx.EVT_MENU, self.OnImportEDSMenu,
171
db7a030babb2 EDS import
etisserant
parents: 158
diff changeset
   254
              id=wxID_OBJDICTEDITFILEMENUITEMS7)
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   255
        self.Bind(wx.EVT_MENU, self.OnExportCMenu,
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   256
              id=wxID_OBJDICTEDITFILEMENUITEMS8)
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   257
        self.Bind(wx.EVT_MENU, self.OnExportEDSMenu,
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   258
              id=wxID_OBJDICTEDITFILEMENUITEMS9)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   259
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   260
    def _init_coll_AddMenu_Items(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   261
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   262
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   263
        parent.Append(help='', id=wxID_OBJDICTEDITADDMENUITEMS0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   264
              kind=wx.ITEM_NORMAL, text='SDO Server')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   265
        parent.Append(help='', id=wxID_OBJDICTEDITADDMENUITEMS1,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   266
              kind=wx.ITEM_NORMAL, text='SDO Client')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   267
        parent.Append(help='', id=wxID_OBJDICTEDITADDMENUITEMS2,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   268
              kind=wx.ITEM_NORMAL, text='PDO Transmit')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   269
        parent.Append(help='', id=wxID_OBJDICTEDITADDMENUITEMS3,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   270
              kind=wx.ITEM_NORMAL, text='PDO Receive')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   271
        parent.Append(help='', id=wxID_OBJDICTEDITADDMENUITEMS4,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   272
              kind=wx.ITEM_NORMAL, text='Map Variable')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   273
        parent.Append(help='', id=wxID_OBJDICTEDITADDMENUITEMS5,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   274
              kind=wx.ITEM_NORMAL, text='User Type')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   275
        self.Bind(wx.EVT_MENU, self.OnAddSDOServerMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   276
              id=wxID_OBJDICTEDITADDMENUITEMS0)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   277
        self.Bind(wx.EVT_MENU, self.OnAddSDOClientMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   278
              id=wxID_OBJDICTEDITADDMENUITEMS1)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   279
        self.Bind(wx.EVT_MENU, self.OnAddPDOTransmitMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   280
              id=wxID_OBJDICTEDITADDMENUITEMS2)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   281
        self.Bind(wx.EVT_MENU, self.OnAddPDOReceiveMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   282
              id=wxID_OBJDICTEDITADDMENUITEMS3)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   283
        self.Bind(wx.EVT_MENU, self.OnAddMapVariableMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   284
              id=wxID_OBJDICTEDITADDMENUITEMS4)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   285
        self.Bind(wx.EVT_MENU, self.OnAddUserTypeMenu,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   286
              id=wxID_OBJDICTEDITADDMENUITEMS5)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   287
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   288
    def _init_coll_HelpBar_Fields(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   289
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   290
        parent.SetFieldsCount(3)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   291
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   292
        parent.SetStatusText(number=0, text='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   293
        parent.SetStatusText(number=1, text='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   294
        parent.SetStatusText(number=2, text='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   295
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   296
        parent.SetStatusWidths([100, 110, -1])
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   297
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   298
    def _init_utils(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   299
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   300
        self.menuBar1 = wx.MenuBar()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   301
        self.menuBar1.SetEvtHandlerEnabled(True)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   302
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   303
        self.FileMenu = wx.Menu(title='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   304
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   305
        self.EditMenu = wx.Menu(title='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   306
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   307
        self.AddMenu = wx.Menu(title='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   308
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   309
        self.HelpMenu = wx.Menu(title='')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   310
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   311
        self._init_coll_menuBar1_Menus(self.menuBar1)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   312
        self._init_coll_FileMenu_Items(self.FileMenu)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   313
        self._init_coll_EditMenu_Items(self.EditMenu)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   314
        self._init_coll_AddMenu_Items(self.AddMenu)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   315
        self._init_coll_HelpMenu_Items(self.HelpMenu)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   316
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   317
    def _init_ctrls(self, prnt):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   318
        # generated method, don't edit
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   319
        wx.Frame.__init__(self, id=wxID_OBJDICTEDIT, name='objdictedit',
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   320
              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   321
              style=wx.DEFAULT_FRAME_STYLE, title='Objdictedit')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   322
        self._init_utils()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   323
        self.SetClientSize(wx.Size(1000, 700))
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   324
        self.SetMenuBar(self.menuBar1)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   325
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=wxID_OBJDICTEDIT)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   326
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   327
        self.FileOpened = wx.Notebook(id=wxID_OBJDICTEDITFILEOPENED,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   328
              name='FileOpened', parent=self, pos=wx.Point(0, 0),
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   329
              size=wx.Size(0, 0), style=0)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   330
        self.FileOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   331
              self.OnFileSelectedChanged, id=wxID_OBJDICTEDITFILEOPENED)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   332
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   333
        self.HelpBar = wx.StatusBar(id=wxID_OBJDICTEDITHELPBAR, name='HelpBar',
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   334
              parent=self, style=wxST_SIZEGRIP)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   335
        self._init_coll_HelpBar_Fields(self.HelpBar)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   336
        self.SetStatusBar(self.HelpBar)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   337
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   338
    def __init__(self, parent):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   339
        self._init_ctrls(parent)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   340
        self.HtmlFrameOpened = []
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   341
        
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   342
        self.Manager = NodeManager(ScriptDirectory)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   343
        for filepath in filesOpen:
232
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   344
            result = self.Manager.OpenFileInCurrent(filepath)
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   345
            if type(result) == IntType:
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   346
                new_editingpanel = EditingPanel(self, self.Manager)
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   347
                new_editingpanel.SetIndex(result)
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   348
                self.FileOpened.AddPage(new_editingpanel, "")
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   349
            window = self.FileOpened.GetPage(0)
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   350
            if window:
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   351
                self.Manager.ChangeCurrentNode(window.GetIndex())
e435bbec1759 Bug on file loading from shell command fixed
lbessard
parents: 227
diff changeset
   352
                self.FileOpened.SetSelection(0)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   353
        if self.Manager.CurrentDS302Defined(): 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   354
            self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, True)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   355
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   356
            self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, False)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   357
        self.RefreshEditMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   358
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   359
        self.RefreshProfileMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   360
        self.RefreshTitle()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   361
        self.RefreshMainMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   362
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   363
    def GetNoteBook(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   364
        return self.FileOpened
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   365
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   366
    def OnAddSDOServerMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   367
        self.Manager.AddSDOServerToCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   368
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   369
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   370
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   371
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   372
    def OnAddSDOClientMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   373
        self.Manager.AddSDOClientToCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   374
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   375
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   376
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   377
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   378
    def OnAddPDOTransmitMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   379
        self.Manager.AddPDOTransmitToCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   380
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   381
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   382
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   383
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   384
    def OnAddPDOReceiveMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   385
        self.Manager.AddPDOReceiveToCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   386
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   387
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   388
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   389
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   390
    def OnAddMapVariableMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   391
        self.AddMapVariable()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   392
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   393
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   394
    def OnAddUserTypeMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   395
        self.AddUserType()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   396
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   397
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   398
    def OnFileSelectedChanged(self, event):
43
56ab4f38075e Bug on NoteBook in Windows corrected
lbessard
parents: 39
diff changeset
   399
        selected = event.GetSelection()
37
c6ff23a48232 Some fixes for GUI running Windows
etisserant
parents: 30
diff changeset
   400
        # At init selected = -1
c6ff23a48232 Some fixes for GUI running Windows
etisserant
parents: 30
diff changeset
   401
        if selected >= 0:
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   402
            window = self.FileOpened.GetPage(selected)
223
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   403
            if window:
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   404
                self.Manager.ChangeCurrentNode(window.GetIndex())
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   405
                self.RefreshBufferState()
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   406
                self.RefreshStatusBar()
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   407
                self.RefreshProfileMenu()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   408
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   409
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   410
    def OnHelpDS301Menu(self, event):
72
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   411
        find_index = False
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   412
        selected = self.FileOpened.GetSelection()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   413
        if selected >= 0:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   414
            window = self.FileOpened.GetPage(selected)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   415
            result = window.GetSelection()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   416
            if result:
72
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   417
                find_index = True
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   418
                index, subIndex = result
158
b505f7116a1c Moved DS-301 PDF into objdictgen. Fixed installation on linux. Now TestMasterSlave is also installed in $PREFIX/bin.
etisserant
parents: 149
diff changeset
   419
                result = OpenPDFDocIndex(index, ScriptDirectory)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   420
                if type(result) == StringType:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   421
                    message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   422
                    message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   423
                    message.Destroy()
72
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   424
        if not find_index:
158
b505f7116a1c Moved DS-301 PDF into objdictgen. Fixed installation on linux. Now TestMasterSlave is also installed in $PREFIX/bin.
etisserant
parents: 149
diff changeset
   425
            result = OpenPDFDocIndex(None, ScriptDirectory)
72
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   426
            if type(result) == StringType:
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   427
                message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   428
                message.ShowModal()
68524f7c58b5 Code for avoiding possible problem on Window while importing html module
lbessard
parents: 68
diff changeset
   429
                message.Destroy()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   430
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   431
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   432
    def OnHelpCANFestivalMenu(self, event):
158
b505f7116a1c Moved DS-301 PDF into objdictgen. Fixed installation on linux. Now TestMasterSlave is also installed in $PREFIX/bin.
etisserant
parents: 149
diff changeset
   433
        #self.OpenHtmlFrame("CAN Festival Reference", os.path.join(ScriptDirectory, "doc/canfestival.html"), wx.Size(1000, 600))
b505f7116a1c Moved DS-301 PDF into objdictgen. Fixed installation on linux. Now TestMasterSlave is also installed in $PREFIX/bin.
etisserant
parents: 149
diff changeset
   434
        os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   435
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   436
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   437
    def OnAboutMenu(self, event):
158
b505f7116a1c Moved DS-301 PDF into objdictgen. Fixed installation on linux. Now TestMasterSlave is also installed in $PREFIX/bin.
etisserant
parents: 149
diff changeset
   438
        self.OpenHtmlFrame("About CAN Festival", os.path.join(ScriptDirectory, "doc/about.html"), wx.Size(500, 450))
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   439
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   440
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   441
    def OpenHtmlFrame(self, title, file, size):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   442
        if title not in self.HtmlFrameOpened:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   443
            self.HtmlFrameOpened.append(title)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   444
            window = HtmlFrame(self, self.HtmlFrameOpened)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   445
            window.SetTitle(title)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   446
            window.SetHtmlPage(file)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   447
            window.SetClientSize(size)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   448
            window.Show()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   449
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   450
    def OnQuitMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   451
        self.Close()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   452
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   453
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   454
    def OnCloseFrame(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   455
        if self.Manager.OneFileHasChanged():
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   456
            dialog = wxMessageDialog(self, "There are changes, do you want to save?",  "Close Application", wxYES_NO|wxCANCEL|wxICON_QUESTION)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   457
            answer = dialog.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   458
            dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   459
            if answer == wxID_YES:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   460
                self.Manager.ChangeCurrentNode(0)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   461
                for i in xrange(self.FileOpened.GetPageCount()):
223
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   462
                    window = self.FileOpened.GetPage(i)
461f5516176b Bug on Domain data writing in gen_cfile fixed
lbessard
parents: 219
diff changeset
   463
                    self.Manager.ChangeCurrentNode(window.GetIndex())
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   464
                    if self.Manager.CurrentIsSaved():
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   465
                        self.Manager.CloseCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   466
                    else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   467
                        self.Save()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   468
                        self.Manager.CloseCurrent(True)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   469
                event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   470
            elif answer == wxID_NO:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   471
                for i in xrange(self.FileOpened.GetPageCount()):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   472
                    self.Manager.CloseCurrent(True)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   473
                wxCallAfter(self.Close)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   474
                event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   475
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   476
            event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   477
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   478
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   479
#                             Refresh Functions
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   480
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   481
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   482
    def RefreshTitle(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   483
        if self.FileOpened.GetPageCount() > 0:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   484
            self.SetTitle("Objdictedit - %s"%self.Manager.GetCurrentFilename())
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   485
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   486
            self.SetTitle("Objdictedit")
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   487
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   488
    def OnRefreshMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   489
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   490
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   491
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   492
    def RefreshCurrentIndexList(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   493
        selected = self.FileOpened.GetSelection()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   494
        window = self.FileOpened.GetPage(selected)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   495
        window.RefreshIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   496
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   497
    def RefreshStatusBar(self):
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   498
        if self.HelpBar:
209
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   499
            selected = self.FileOpened.GetSelection()
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   500
            if selected >= 0:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   501
                window = self.FileOpened.GetPage(selected)
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   502
                selection = window.GetSelection()
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   503
                if selection:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   504
                    index, subIndex = selection
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   505
                    if self.Manager.IsCurrentEntry(index):
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   506
                        self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0)
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   507
                        self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1)
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   508
                        entryinfos = self.Manager.GetEntryInfos(index)
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   509
                        name = entryinfos["name"]
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   510
                        category = "Optional"
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   511
                        if entryinfos["need"]:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   512
                            category = "Mandatory"
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   513
                        struct = "VAR"
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   514
                        number = ""
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   515
                        if entryinfos["struct"] & OD_IdenticalIndexes:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   516
                            number = " possibly defined %d times"%entryinfos["nbmax"]
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   517
                        if entryinfos["struct"] & OD_IdenticalSubindexes:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   518
                            struct = "REC"
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   519
                        elif entryinfos["struct"] & OD_MultipleSubindexes:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   520
                            struct = "ARRAY"
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   521
                        text = "%s: %s entry of struct %s%s."%(name,category,struct,number)
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   522
                        self.HelpBar.SetStatusText(text, 2)
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   523
                    else:
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   524
                        for i in xrange(3):
2cb34a4ac65a Bug on RefreshStatusBar corrected
lbessard
parents: 206
diff changeset
   525
                            self.HelpBar.SetStatusText("", i)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   526
                else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   527
                    for i in xrange(3):
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   528
                        self.HelpBar.SetStatusText("", i)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   529
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   530
    def RefreshMainMenu(self):
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   531
        if self.FileMenu:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   532
            if self.FileOpened.GetPageCount() > 0:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   533
                self.menuBar1.EnableTop(1, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   534
                self.menuBar1.EnableTop(2, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   535
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS1, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   536
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS2, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   537
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS6, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   538
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS8, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   539
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS9, True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   540
            else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   541
                self.menuBar1.EnableTop(1, False)      
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   542
                self.menuBar1.EnableTop(2, False)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   543
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS1, False)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   544
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS2, False)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   545
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS6, False)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   546
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS8, False)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   547
                self.FileMenu.Enable(wxID_OBJDICTEDITFILEMENUITEMS9, False)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   548
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   549
    def RefreshEditMenu(self):
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   550
        if self.FileMenu:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   551
            if self.FileOpened.GetPageCount() > 0:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   552
                undo, redo = self.Manager.GetCurrentBufferState()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   553
                self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS1, undo)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   554
                self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS0, redo)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   555
            else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   556
                self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS1, False)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   557
                self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS0, False)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   558
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   559
    def RefreshProfileMenu(self):
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   560
        if self.EditMenu:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   561
            profile = self.Manager.GetCurrentProfileName()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   562
            edititem = self.EditMenu.FindItemById(wxID_OBJDICTEDITEDITMENUITEMS7)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   563
            if edititem:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   564
                length = self.AddMenu.GetMenuItemCount()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   565
                for i in xrange(length-6):
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   566
                    additem = self.AddMenu.FindItemByPosition(6)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   567
                    self.AddMenu.Delete(additem.GetId())
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   568
                if profile not in ("None", "DS-301"):
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   569
                    edititem.SetText("%s Profile"%profile)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   570
                    edititem.Enable(True)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   571
                    self.AddMenu.AppendSeparator()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   572
                    for text, indexes in self.Manager.GetCurrentSpecificMenu():
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   573
                        new_id = wx.NewId()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   574
                        self.AddMenu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=text)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   575
                        self.Bind(wx.EVT_MENU, self.GetProfileCallBack(text), id=new_id)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   576
                else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   577
                    edititem.SetText("Other Profile")
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   578
                    edititem.Enable(False)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   579
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   580
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   581
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   582
#                            Buffer Functions
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   583
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   584
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   585
    def RefreshBufferState(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   586
        fileopened = self.Manager.GetAllFilenames()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   587
        for idx, filename in enumerate(fileopened):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   588
            self.FileOpened.SetPageText(idx, filename)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   589
        self.RefreshEditMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   590
        self.RefreshTitle()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   591
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   592
    def OnUndoMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   593
        self.Manager.LoadCurrentPrevious()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   594
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   595
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   596
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   597
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   598
    def OnRedoMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   599
        self.Manager.LoadCurrentNext()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   600
        self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   601
        self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   602
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   603
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   604
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   605
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   606
#                         Load and Save Funtions
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   607
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   608
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   609
    def OnNewMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   610
        self.FilePath = ""
206
6787754b251b Bugs corrected on objdictedit and networkdict
greg
parents: 205
diff changeset
   611
        dialog = CreateNodeDialog(self, ScriptDirectory)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   612
        if dialog.ShowModal() == wxID_OK:
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   613
            name, id, nodetype, description = dialog.GetValues()
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   614
            profile, filepath = dialog.GetProfile()
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   615
            NMT = dialog.GetNMTManagement()
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   616
            options = dialog.GetOptions()
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   617
            result = self.Manager.CreateNewNode(name, id, nodetype, description, profile, filepath, NMT, options)
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   618
            if type(result) == IntType:
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   619
                new_editingpanel = EditingPanel(self, self.Manager)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   620
                new_editingpanel.SetIndex(result)
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   621
                self.FileOpened.AddPage(new_editingpanel, "")
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   622
                self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   623
                self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, False)
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   624
                if "DS302" in options:
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   625
                    self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, True)
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   626
                self.RefreshBufferState()
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   627
                self.RefreshProfileMenu()
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   628
                self.RefreshMainMenu()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   629
            else:
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   630
                message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   631
                message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   632
                message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   633
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   634
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   635
    def OnOpenMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   636
        filepath = self.Manager.GetCurrentFilePath()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   637
        if filepath != "":
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   638
            directory = os.path.dirname(filepath)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   639
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   640
            directory = os.getcwd()
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   641
        dialog = wxFileDialog(self, "Choose a file", directory, "",  "OD files (*.od)|*.od|All files|*.*", wxOPEN|wxCHANGE_DIR)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   642
        if dialog.ShowModal() == wxID_OK:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   643
            filepath = dialog.GetPath()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   644
            if os.path.isfile(filepath):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   645
                result = self.Manager.OpenFileInCurrent(filepath)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   646
                if type(result) == IntType:
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   647
                    new_editingpanel = EditingPanel(self, self.Manager)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   648
                    new_editingpanel.SetIndex(result)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   649
                    self.FileOpened.AddPage(new_editingpanel, "")
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   650
                    self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   651
                    if self.Manager.CurrentDS302Defined(): 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   652
                        self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, True)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   653
                    else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   654
                        self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, False)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   655
                    self.RefreshEditMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   656
                    self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   657
                    self.RefreshProfileMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   658
                    self.RefreshMainMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   659
                else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   660
                    message = wxMessageDialog(self, e.args[0], "Error", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   661
                    message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   662
                    message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   663
        dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   664
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   665
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   666
    def OnSaveMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   667
        self.Save()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   668
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   669
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   670
    def OnSaveAsMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   671
        self.SaveAs()
30
a5dd050b28cb Some bugs found corrected
lbessard
parents: 0
diff changeset
   672
        event.Skip()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   673
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   674
    def Save(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   675
        result = self.Manager.SaveCurrentInFile()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   676
        if not result:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   677
            self.SaveAs()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   678
        elif type(result) != StringType:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   679
            self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   680
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   681
            message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   682
            message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   683
            message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   684
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   685
    def SaveAs(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   686
        filepath = self.Manager.GetCurrentFilePath()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   687
        if filepath != "":
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   688
            directory, filename = os.path.split(filepath)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   689
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   690
            directory, filename = os.getcwd(), "%s.od"%self.Manager.GetCurrentNodeInfos()[0]
59
3a553c789116 Some bugs reported by Francis Dupin corrected.
lbessard
parents: 44
diff changeset
   691
        dialog = wxFileDialog(self, "Choose a file", directory, filename,  "OD files (*.od)|*.od|All files|*.*", wxSAVE|wxOVERWRITE_PROMPT|wxCHANGE_DIR)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   692
        if dialog.ShowModal() == wxID_OK:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   693
            filepath = dialog.GetPath()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   694
            if os.path.isdir(os.path.dirname(filepath)):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   695
                result = self.Manager.SaveCurrentInFile(filepath)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   696
                if type(result) != StringType:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   697
                    self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   698
                else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   699
                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   700
                    message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   701
                    message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   702
            else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   703
                message = wxMessageDialog(self, "%s is not a valid folder!"%os.path.dirname(filepath), "Error", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   704
                message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   705
                message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   706
        dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   707
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   708
    def OnCloseMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   709
        answer = wxID_YES
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   710
        result = self.Manager.CloseCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   711
        if not result:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   712
            dialog = wxMessageDialog(self, "There are changes, do you want to save?",  "Close File", wxYES_NO|wxCANCEL|wxICON_QUESTION)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   713
            answer = dialog.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   714
            dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   715
            if answer == wxID_YES:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   716
                self.OnSaveMenu(event)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   717
                if self.Manager.CurrentIsSaved():
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   718
                    self.Manager.CloseCurrent()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   719
            elif answer == wxID_NO:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   720
                self.Manager.CloseCurrent(True)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   721
        if self.FileOpened.GetPageCount() > self.Manager.GetBufferNumber():
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   722
            current = self.FileOpened.GetSelection()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   723
            self.FileOpened.DeletePage(current)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   724
            if self.FileOpened.GetPageCount() > 0:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   725
                self.FileOpened.SetSelection(min(current, self.FileOpened.GetPageCount() - 1))
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   726
            self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   727
            self.RefreshMainMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   728
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   729
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   730
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   731
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   732
#                         Import and Export Functions
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   733
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   734
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   735
    def OnImportEDSMenu(self, event):
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   736
        dialog = wxFileDialog(self, "Choose a file", os.getcwd(), "",  "EDS files (*.eds)|*.eds|All files|*.*", wxOPEN|wxCHANGE_DIR)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   737
        if dialog.ShowModal() == wxID_OK:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   738
            filepath = dialog.GetPath()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   739
            if os.path.isfile(filepath):
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   740
                result = self.Manager.ImportCurrentFromEDSFile(filepath)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   741
                if type(result) == IntType:
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   742
                    new_editingpanel = EditingPanel(self, self.Manager)
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   743
                    new_editingpanel.SetIndex(result)
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   744
                    self.FileOpened.AddPage(new_editingpanel, "")
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   745
                    self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   746
                    self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   747
                    self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   748
                    self.RefreshProfileMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   749
                    self.RefreshMainMenu()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   750
                    message = wxMessageDialog(self, "Import successful", "Information", wxOK|wxICON_INFORMATION)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   751
                    message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   752
                    message.Destroy()
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   753
                else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   754
                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   755
                    message.ShowModal()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   756
                    message.Destroy()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   757
            else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   758
                message = wxMessageDialog(self, "\"%s\" is not a valid file!"%filepath, "Error", wxOK|wxICON_ERROR)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   759
                message.ShowModal()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   760
                message.Destroy()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   761
        dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   762
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   763
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   764
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   765
    def OnExportEDSMenu(self, event):
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   766
        dialog = wxFileDialog(self, "Choose a file", os.getcwd(), self.Manager.GetCurrentNodeInfos()[0], "EDS files (*.eds)|*.eds|All files|*.*", wxSAVE|wxOVERWRITE_PROMPT|wxCHANGE_DIR)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   767
        if dialog.ShowModal() == wxID_OK:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   768
            filepath = dialog.GetPath()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   769
            if os.path.isdir(os.path.dirname(filepath)):
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   770
                path, extend = os.path.splitext(filepath)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   771
                if extend in ("", "."):
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   772
                    filepath = path + ".eds"
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   773
                result = self.Manager.ExportCurrentToEDSFile(filepath)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   774
                if not result:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   775
                    message = wxMessageDialog(self, "Export successful", "Information", wxOK|wxICON_INFORMATION)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   776
                    message.ShowModal()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   777
                    message.Destroy()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   778
                else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   779
                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   780
                    message.ShowModal()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   781
                    message.Destroy()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   782
            else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   783
                message = wxMessageDialog(self, "\"%s\" is not a valid folder!"%os.path.dirname(filepath), "Error", wxOK|wxICON_ERROR)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   784
                message.ShowModal()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   785
                message.Destroy()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   786
        dialog.Destroy()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   787
        event.Skip()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   788
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   789
    def OnExportCMenu(self, event):
227
f76c64f66097 Bugs on cfile generation fixed
lbessard
parents: 223
diff changeset
   790
        dialog = wxFileDialog(self, "Choose a file", os.getcwd(), self.Manager.GetCurrentNodeInfos()[0],  "CANFestival C files (*.c)|*.c|All files|*.*", wxSAVE|wxOVERWRITE_PROMPT|wxCHANGE_DIR)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   791
        if dialog.ShowModal() == wxID_OK:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   792
            filepath = dialog.GetPath()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   793
            if os.path.isdir(os.path.dirname(filepath)):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   794
                path, extend = os.path.splitext(filepath)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   795
                if extend in ("", "."):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   796
                    filepath = path + ".c"
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   797
                result = self.Manager.ExportCurrentToCFile(filepath)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   798
                if not result:
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   799
                    message = wxMessageDialog(self, "Export successful", "Information", wxOK|wxICON_INFORMATION)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   800
                    message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   801
                    message.Destroy()
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   802
                else:
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   803
                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   804
                    message.ShowModal()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   805
                    message.Destroy()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   806
            else:
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   807
                message = wxMessageDialog(self, "\"%s\" is not a valid folder!"%os.path.dirname(filepath), "Error", wxOK|wxICON_ERROR)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   808
                message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   809
                message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   810
        dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   811
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   812
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   813
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   814
#                          Editing Profiles functions
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   815
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   816
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   817
    def OnCommunicationMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   818
        dictionary,current = self.Manager.GetCurrentCommunicationLists()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   819
        self.EditProfile("Edit DS-301 Profile", dictionary, current)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   820
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   821
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   822
    def OnOtherCommunicationMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   823
        dictionary,current = self.Manager.GetCurrentDS302Lists()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   824
        self.EditProfile("Edit DS-301 Profile", dictionary, current)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   825
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   826
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   827
    def OnEditProfileMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   828
        title = "Edit %s Profile"%self.Manager.GetCurrentProfileName()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   829
        dictionary,current = self.Manager.GetCurrentProfileLists()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   830
        self.EditProfile(title, dictionary, current)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   831
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   832
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   833
    def EditProfile(self, title, dictionary, current):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   834
        dialog = CommunicationDialog(self)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   835
        dialog.SetTitle(title)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   836
        dialog.SetIndexDictionary(dictionary)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   837
        dialog.SetCurrentList(current)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   838
        dialog.RefreshLists()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   839
        if dialog.ShowModal() == wxID_OK:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   840
            new_profile = dialog.GetCurrentList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   841
            addinglist = []
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   842
            removinglist = []
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   843
            for index in new_profile:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   844
                if index not in current:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   845
                    addinglist.append(index)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   846
            for index in current:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   847
                if index not in new_profile:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   848
                    removinglist.append(index)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   849
            self.Manager.ManageEntriesOfCurrent(addinglist, removinglist)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   850
            self.Manager.BufferCurrentNode()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   851
            self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   852
            self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   853
        dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   854
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   855
    def GetProfileCallBack(self, text):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   856
        def ProfileCallBack(event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   857
            self.Manager.AddSpecificEntryToCurrent(text)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   858
            self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   859
            self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   860
            event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   861
        return ProfileCallBack
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   862
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   863
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   864
#                         Edit Node informations function
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   865
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   866
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   867
    def OnNodeInfosMenu(self, event):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   868
        dialog = NodeInfosDialog(self)
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   869
        name, id, type, description = self.Manager.GetCurrentNodeInfos()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   870
        dialog.SetValues(name, id, type, description)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   871
        if dialog.ShowModal() == wxID_OK:
182
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   872
            name, id, type, description = dialog.GetValues()
988f2b302aa6 Adding support for importing and exporting EDS files
lbessard
parents: 176
diff changeset
   873
            self.Manager.SetCurrentNodeInfos(name, id, type, description)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   874
            self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   875
            self.RefreshProfileMenu()
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   876
            selected = self.FileOpened.GetSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   877
            if selected >= 0:
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   878
                window = self.FileOpened.GetPage(selected)
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   879
                window.RefreshTable()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   880
        event.Skip()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   881
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   882
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   883
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   884
#                           Add User Types and Variables
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   885
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   886
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   887
    def AddMapVariable(self):
39
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   888
        index = self.Manager.GetCurrentNextMapIndex()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   889
        if index:
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   890
            dialog = MapVariableDialog(self)
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   891
            dialog.SetIndex(index)
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   892
            if dialog.ShowModal() == wxID_OK:
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   893
                index, name, struct, number = dialog.GetValues()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   894
                result = self.Manager.AddMapVariableToCurrent(index, name, struct, number)
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   895
                if type(result) != StringType:
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   896
                    self.RefreshBufferState()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   897
                    self.RefreshCurrentIndexList()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   898
                else:
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   899
                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   900
                    message.ShowModal()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   901
                    message.Destroy()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   902
            dialog.Destroy()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   903
        else:
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   904
            message = wxMessageDialog(self, result, "No map variable index left!", wxOK|wxICON_ERROR)
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   905
            message.ShowModal()
3e94ee906bc6 Add incremented index in Add Map Variable
lbessard
parents: 37
diff changeset
   906
            message.Destroy()
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   907
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   908
    def AddUserType(self):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   909
        dialog = UserTypeDialog(self)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   910
        dialog.SetTypeList(self.Manager.GetCustomisableTypes())
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   911
        if dialog.ShowModal() == wxID_OK:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   912
            type, min, max, length = dialog.GetValues()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   913
            result = self.Manager.AddUserTypeToCurrent(type, min, max, length)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents: 182
diff changeset
   914
            if not result:
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   915
                self.RefreshBufferState()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   916
                self.RefreshCurrentIndexList()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   917
            else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   918
                message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   919
                message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   920
                message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   921
        dialog.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   922
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   923
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   924
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   925
#                               Exception Handler
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   926
#-------------------------------------------------------------------------------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   927
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   928
Max_Traceback_List_Size = 20
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   929
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   930
def Display_Exception_Dialog(e_type,e_value,e_tb):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   931
    trcbck_lst = []
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   932
    for i,line in enumerate(traceback.extract_tb(e_tb)):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   933
        trcbck = " " + str(i+1) + ". "
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   934
        if line[0].find(os.getcwd()) == -1:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   935
            trcbck += "file : " + str(line[0]) + ",   "
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   936
        else:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   937
            trcbck += "file : " + str(line[0][len(os.getcwd()):]) + ",   "
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   938
        trcbck += "line : " + str(line[1]) + ",   " + "function : " + str(line[2])
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   939
        trcbck_lst.append(trcbck)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   940
        
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   941
    # Allow clicking....
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   942
    cap = wx.Window_GetCapture()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   943
    if cap:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   944
        cap.ReleaseMouse()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   945
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   946
    dlg = wx.SingleChoiceDialog(None, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   947
        """
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   948
An error happens.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   949
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   950
Click on OK for saving an error report.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   951
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   952
Please contact LOLITech at:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   953
+33 (0)3 29 52 95 67
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   954
bugs_objdictedit@lolitech.fr
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   955
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   956
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   957
Error:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   958
""" +
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   959
        str(e_type) + " : " + str(e_value), 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   960
        "Error",
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   961
        trcbck_lst)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   962
    try:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   963
        res = (dlg.ShowModal() == wx.ID_OK)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   964
    finally:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   965
        dlg.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   966
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   967
    return res
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   968
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   969
def Display_Error_Dialog(e_value):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   970
    message = wxMessageDialog(None, str(e_value), "Error", wxOK|wxICON_ERROR)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   971
    message.ShowModal()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   972
    message.Destroy()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   973
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   974
def get_last_traceback(tb):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   975
    while tb.tb_next:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   976
        tb = tb.tb_next
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   977
    return tb
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   978
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   979
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   980
def format_namespace(d, indent='    '):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   981
    return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   982
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   983
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   984
ignored_exceptions = [] # a problem with a line in a module is only reported once per session
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   985
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   986
def wxAddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   987
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   988
    def handle_exception(e_type, e_value, e_traceback):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   989
        traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   990
        last_tb = get_last_traceback(e_traceback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   991
        ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   992
        if str(e_value).startswith("!!!"):
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   993
            Display_Error_Dialog(e_value)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   994
        elif ex not in ignored_exceptions:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   995
            ignored_exceptions.append(ex)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   996
            result = Display_Exception_Dialog(e_type,e_value,e_traceback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   997
            if result:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   998
                info = {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   999
                    'app-title' : wx.GetApp().GetAppName(), # app_title
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1000
                    'app-version' : app_version,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1001
                    'wx-version' : wx.VERSION_STRING,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1002
                    'wx-platform' : wx.Platform,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1003
                    'python-version' : platform.python_version(), #sys.version.split()[0],
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1004
                    'platform' : platform.platform(),
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1005
                    'e-type' : e_type,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1006
                    'e-value' : e_value,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1007
                    'date' : time.ctime(),
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1008
                    'cwd' : os.getcwd(),
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1009
                    }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1010
                if e_traceback:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1011
                    info['traceback'] = ''.join(traceback.format_tb(e_traceback)) + '%s: %s' % (e_type, e_value)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1012
                    last_tb = get_last_traceback(e_traceback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1013
                    exception_locals = last_tb.tb_frame.f_locals # the locals at the level of the stack trace where the exception actually occurred
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1014
                    info['locals'] = format_namespace(exception_locals)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1015
                    if 'self' in exception_locals:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1016
                        info['self'] = format_namespace(exception_locals['self'].__dict__)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1017
                
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1018
                output = open(path+os.sep+"bug_report_"+info['date'].replace(':','-').replace(' ','_')+".txt",'w')
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1019
                lst = info.keys()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1020
                lst.sort()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1021
                for a in lst:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1022
                    output.write(a+":\n"+str(info[a])+"\n\n")
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1023
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1024
    #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1025
    sys.excepthook = handle_exception
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1026
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1027
if __name__ == '__main__':
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1028
    app = wxPySimpleApp()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1029
    wxInitAllImageHandlers()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1030
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1031
    # Install a exception handle for bug reports
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1032
    wxAddExceptHook(os.getcwd(),__version__)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1033
    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1034
    frame = objdictedit(None)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1035
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1036
    frame.Show()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
  1037
    app.MainLoop()