canfestival/SlaveEditor.py
changeset 762 aaacc83aa86b
parent 738 413946c04c87
child 777 daa6941fe21a
equal deleted inserted replaced
761:7788545f4137 762:aaacc83aa86b
     1 
     1 
     2 import wx
     2 import wx
     3 
     3 
     4 from subindextable import EditingPanel
     4 from subindextable import EditingPanel
     5 from nodeeditor import NodeEditorTemplate
     5 from nodeeditor import NodeEditorTemplate
     6 from controls import EditorPanel
     6 from ConfTreeNodeEditor import ConfTreeNodeEditor
     7 
     7 
     8 [ID_SLAVEEDITORCONFNODEMENUNODEINFOS, ID_SLAVEEDITORCONFNODEMENUDS301PROFILE,
     8 [ID_SLAVEEDITORCONFNODEMENUNODEINFOS, ID_SLAVEEDITORCONFNODEMENUDS301PROFILE,
     9  ID_SLAVEEDITORCONFNODEMENUDS302PROFILE, ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE,
     9  ID_SLAVEEDITORCONFNODEMENUDS302PROFILE, ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE,
    10  ID_SLAVEEDITORCONFNODEMENUADD, 
    10  ID_SLAVEEDITORCONFNODEMENUADD, 
    11 ] = [wx.NewId() for _init_coll_ConfNodeMenu_Items in range(5)]
    11 ] = [wx.NewId() for _init_coll_ConfNodeMenu_Items in range(5)]
    13 [ID_SLAVEEDITORADDMENUSDOSERVER, ID_SLAVEEDITORADDMENUSDOCLIENT,
    13 [ID_SLAVEEDITORADDMENUSDOSERVER, ID_SLAVEEDITORADDMENUSDOCLIENT,
    14  ID_SLAVEEDITORADDMENUPDOTRANSMIT, ID_SLAVEEDITORADDMENUPDORECEIVE,
    14  ID_SLAVEEDITORADDMENUPDOTRANSMIT, ID_SLAVEEDITORADDMENUPDORECEIVE,
    15  ID_SLAVEEDITORADDMENUMAPVARIABLE, ID_SLAVEEDITORADDMENUUSERTYPE,
    15  ID_SLAVEEDITORADDMENUMAPVARIABLE, ID_SLAVEEDITORADDMENUUSERTYPE,
    16 ] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
    16 ] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
    17 
    17 
    18 class SlaveEditor(EditorPanel, NodeEditorTemplate):
    18 class SlaveEditor(ConfTreeNodeEditor, NodeEditorTemplate):
    19     
    19     
    20     def _init_Editor(self, prnt):
    20     def _init_ConfNodeEditor(self, prnt):
    21         self.Editor = EditingPanel(prnt, self, self.Controler, self.Editable)
    21         self.ConfNodeEditor = EditingPanel(prnt, self, self.Controler, self.Editable)
    22         
    22         
    23     def __init__(self, parent, controler, window, editable=True):
    23     def __init__(self, parent, controler, window, editable=True):
    24         self.Editable = editable
    24         self.Editable = editable
    25         EditorPanel.__init__(self, parent, "", window, controler)
    25         ConfTreeNodeEditor.__init__(self, parent, controler, window)
    26         NodeEditorTemplate.__init__(self, controler, window, False)
    26         NodeEditorTemplate.__init__(self, controler, window, False)
    27         
       
    28         img = wx.Bitmap(controler.GetIconPath(), wx.BITMAP_TYPE_PNG).ConvertToImage()
       
    29         self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16)))
       
    30     
    27     
    31     def __del__(self):
    28     def __del__(self):
    32         self.Controler.OnCloseEditor(self)
    29         self.Controler.OnCloseEditor(self)
    33     
    30     
    34     def GetConfNodeMenuItems(self):
    31     def GetConfNodeMenuItems(self):
    57                     (add_menu, (_('Add'), ID_SLAVEEDITORCONFNODEMENUADD))]
    54                     (add_menu, (_('Add'), ID_SLAVEEDITORCONFNODEMENUADD))]
    58         return []
    55         return []
    59     
    56     
    60     def RefreshConfNodeMenu(self, confnode_menu):
    57     def RefreshConfNodeMenu(self, confnode_menu):
    61         confnode_menu.Enable(ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, False)
    58         confnode_menu.Enable(ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, False)
    62     
       
    63     def GetTitle(self):
       
    64         fullname = self.Controler.CTNFullName()
       
    65         if not self.Controler.CurrentIsSaved():
       
    66             return "~%s~" % fullname
       
    67         return fullname
       
    68 
    59 
    69     def RefreshView(self):
    60     def RefreshView(self):
    70         self.Editor.RefreshIndexList()
    61         ConfTreeNodeEditor.RefreshView(self)
       
    62         self.ConfNodeEditor.RefreshIndexList()
    71 
    63 
    72     def RefreshCurrentIndexList(self):
    64     def RefreshCurrentIndexList(self):
    73         self.RefreshView()
    65         self.RefreshView()
    74     
    66     
    75     def RefreshBufferState(self):
    67     def RefreshBufferState(self):