RessourceEditor.py
changeset 64 dd6f693e46a1
parent 58 39cd981ff242
child 80 c798a68c5560
equal deleted inserted replaced
63:04a02b4b2a57 64:dd6f693e46a1
    20 #
    20 #
    21 #You should have received a copy of the GNU General Public
    21 #You should have received a copy of the GNU General Public
    22 #License along with this library; if not, write to the Free Software
    22 #License along with this library; if not, write to the Free Software
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24 
    24 
    25 from wxPython.wx import *
       
    26 from wxPython.grid import *
       
    27 import wx
    25 import wx
       
    26 import wx.grid
    28 
    27 
    29 #-------------------------------------------------------------------------------
    28 #-------------------------------------------------------------------------------
    30 #                            Resource Editor class
    29 #                            Resource Editor class
    31 #-------------------------------------------------------------------------------
    30 #-------------------------------------------------------------------------------
    32 
    31 
    33 class ResourceTable(wxPyGridTableBase):
    32 class ResourceTable(wx.grid.PyGridTableBase):
    34     
    33     
    35     """
    34     """
    36     A custom wxGrid Table using user supplied data
    35     A custom wx.grid.Grid Table using user supplied data
    37     """
    36     """
    38     def __init__(self, parent, data, colnames):
    37     def __init__(self, parent, data, colnames):
    39         # The base class must be initialized *first*
    38         # The base class must be initialized *first*
    40         wxPyGridTableBase.__init__(self)
    39         wx.grid.PyGridTableBase.__init__(self)
    41         self.data = data
    40         self.data = data
    42         self.colnames = colnames
    41         self.colnames = colnames
    43         self.Parent = parent
    42         self.Parent = parent
    44         
    43         
    45         self.ColAlignements = []
    44         self.ColAlignements = []
    91         if colname in self.colnames:
    90         if colname in self.colnames:
    92             self.data[row][colname] = value
    91             self.data[row][colname] = value
    93     
    92     
    94     def ResetView(self, grid):
    93     def ResetView(self, grid):
    95         """
    94         """
    96         (wxGrid) -> Reset the grid view.   Call this to
    95         (wx.grid.Grid) -> Reset the grid view.   Call this to
    97         update the grid if rows and columns have been added or deleted
    96         update the grid if rows and columns have been added or deleted
    98         """
    97         """
    99         grid.BeginBatch()
    98         grid.BeginBatch()
   100         for current, new, delmsg, addmsg in [
    99         for current, new, delmsg, addmsg in [
   101             (self._rows, self.GetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
   100             (self._rows, self.GetNumberRows(), wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
   102             (self._cols, self.GetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
   101             (self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
   103         ]:
   102         ]:
   104             if new < current:
   103             if new < current:
   105                 msg = wxGridTableMessage(self,delmsg,new,current-new)
   104                 msg = wx.grid.GridTableMessage(self,delmsg,new,current-new)
   106                 grid.ProcessTableMessage(msg)
   105                 grid.ProcessTableMessage(msg)
   107             elif new > current:
   106             elif new > current:
   108                 msg = wxGridTableMessage(self,addmsg,new-current)
   107                 msg = wx.grid.GridTableMessage(self,addmsg,new-current)
   109                 grid.ProcessTableMessage(msg)
   108                 grid.ProcessTableMessage(msg)
   110                 self.UpdateValues(grid)
   109                 self.UpdateValues(grid)
   111         grid.EndBatch()
   110         grid.EndBatch()
   112 
   111 
   113         self._rows = self.GetNumberRows()
   112         self._rows = self.GetNumberRows()
   120         grid.ForceRefresh()
   119         grid.ForceRefresh()
   121 
   120 
   122     def UpdateValues(self, grid):
   121     def UpdateValues(self, grid):
   123         """Update all displayed values"""
   122         """Update all displayed values"""
   124         # This sends an event to the grid table to update all of the values
   123         # This sends an event to the grid table to update all of the values
   125         msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
   124         msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
   126         grid.ProcessTableMessage(msg)
   125         grid.ProcessTableMessage(msg)
   127 
   126 
   128     def _updateColAttrs(self, grid):
   127     def _updateColAttrs(self, grid):
   129         """
   128         """
   130         wxGrid -> update the column attributes to add the
   129         wx.grid.Grid -> update the column attributes to add the
   131         appropriate renderer given the column name.
   130         appropriate renderer given the column name.
   132 
   131 
   133         Otherwise default to the default renderer.
   132         Otherwise default to the default renderer.
   134         """
   133         """
   135         
   134         
   136         for col in range(self.GetNumberCols()):
   135         for col in range(self.GetNumberCols()):
   137             attr = wxGridCellAttr()
   136             attr = wx.grid.GridCellAttr()
   138             attr.SetAlignment(self.ColAlignements[col], wxALIGN_CENTRE)
   137             attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
   139             grid.SetColAttr(col, attr)
   138             grid.SetColAttr(col, attr)
   140             grid.SetColSize(col, self.ColSizes[col])
   139             grid.SetColSize(col, self.ColSizes[col])
   141         
   140         
   142         for row in range(self.GetNumberRows()):
   141         for row in range(self.GetNumberRows()):
   143             for col in range(self.GetNumberCols()):
   142             for col in range(self.GetNumberCols()):
   144                 editor = None
   143                 editor = None
   145                 renderer = None
   144                 renderer = None
   146                 colname = self.GetColLabelValue(col)
   145                 colname = self.GetColLabelValue(col)
   147                 grid.SetReadOnly(row, col, False)
   146                 grid.SetReadOnly(row, col, False)
   148                 if colname in ["Name","Interval"]:
   147                 if colname in ["Name","Interval"]:
   149                     editor = wxGridCellTextEditor()
   148                     editor = wx.grid.GridCellTextEditor()
   150                     renderer = wxGridCellStringRenderer()
   149                     renderer = wx.grid.GridCellStringRenderer()
   151                     if colname == "Interval" and self.GetValueByName(row, "Single") != "":
   150                     if colname == "Interval" and self.GetValueByName(row, "Single") != "":
   152                         grid.SetReadOnly(row, col, True)
   151                         grid.SetReadOnly(row, col, True)
   153                 elif colname == "Single":
   152                 elif colname == "Single":
   154                     editor = wxGridCellChoiceEditor()
   153                     editor = wx.grid.GridCellChoiceEditor()
   155                     editor.SetParameters(self.Parent.VariableList)
   154                     editor.SetParameters(self.Parent.VariableList)
   156                     if self.GetValueByName(row, "Interval") != "":
   155                     if self.GetValueByName(row, "Interval") != "":
   157                         grid.SetReadOnly(row, col, True)
   156                         grid.SetReadOnly(row, col, True)
   158                 elif colname == "Type":
   157                 elif colname == "Type":
   159                     editor = wxGridCellChoiceEditor()
   158                     editor = wx.grid.GridCellChoiceEditor()
   160                     editor.SetParameters(self.Parent.TypeList)
   159                     editor.SetParameters(self.Parent.TypeList)
   161                 elif colname == "Priority":
   160                 elif colname == "Priority":
   162                     editor = wxGridCellNumberEditor()
   161                     editor = wx.grid.GridCellNumberEditor()
   163                     editor.SetParameters("0,65535")
   162                     editor.SetParameters("0,65535")
   164                 elif colname == "Task":
   163                 elif colname == "Task":
   165                     editor = wxGridCellChoiceEditor()
   164                     editor = wx.grid.GridCellChoiceEditor()
   166                     editor.SetParameters(self.Parent.TaskList)
   165                     editor.SetParameters(self.Parent.TaskList)
   167                     
   166                     
   168                 grid.SetCellEditor(row, col, editor)
   167                 grid.SetCellEditor(row, col, editor)
   169                 grid.SetCellRenderer(row, col, renderer)
   168                 grid.SetCellRenderer(row, col, renderer)
   170                 
   169                 
   171                 grid.SetCellBackgroundColour(row, col, wxWHITE)
   170                 grid.SetCellBackgroundColour(row, col, wx.WHITE)
   172     
   171     
   173     def SetData(self, data):
   172     def SetData(self, data):
   174         self.data = data
   173         self.data = data
   175     
   174     
   176     def GetData(self):
   175     def GetData(self):
   197     def Empty(self):
   196     def Empty(self):
   198         self.data = []
   197         self.data = []
   199         self.editors = []
   198         self.editors = []
   200 
   199 
   201 
   200 
   202 [wxID_RESOURCEEDITOR, wxID_RESOURCEEDITORSTATICTEXT1,
   201 [ID_RESOURCEEDITOR, ID_RESOURCEEDITORSTATICTEXT1,
   203  wxID_RESOURCEEDITORSTATICTEXT2, wxID_RESOURCEEDITORINSTANCESGRID,
   202  ID_RESOURCEEDITORSTATICTEXT2, ID_RESOURCEEDITORINSTANCESGRID,
   204  wxID_RESOURCEEDITORTASKSGRID, wxID_RESOURCEEDITORADDINSTANCEBUTTON,
   203  ID_RESOURCEEDITORTASKSGRID, ID_RESOURCEEDITORADDINSTANCEBUTTON,
   205  wxID_RESOURCEEDITORDELETEINSTANCEBUTTON, wxID_RESOURCEEDITORUPINSTANCEBUTTON,
   204  ID_RESOURCEEDITORDELETEINSTANCEBUTTON, ID_RESOURCEEDITORUPINSTANCEBUTTON,
   206  wxID_RESOURCEEDITORDOWNINSTANCEBUTTON, wxID_RESOURCEEDITORADDTASKBUTTON,
   205  ID_RESOURCEEDITORDOWNINSTANCEBUTTON, ID_RESOURCEEDITORADDTASKBUTTON,
   207  wxID_RESOURCEEDITORDELETETASKBUTTON, wxID_RESOURCEEDITORUPTASKBUTTON,
   206  ID_RESOURCEEDITORDELETETASKBUTTON, ID_RESOURCEEDITORUPTASKBUTTON,
   208  wxID_RESOURCEEDITORDOWNTASKBUTTON,
   207  ID_RESOURCEEDITORDOWNTASKBUTTON,
   209 ] = [wx.NewId() for _init_ctrls in range(13)]
   208 ] = [wx.NewId() for _init_ctrls in range(13)]
   210 
   209 
   211 class ResourceEditor(wx.Panel):
   210 class ResourceEditor(wx.Panel):
   212     
   211     
   213     def _init_coll_InstancesSizer_Growables(self, parent):
   212     def _init_coll_InstancesSizer_Growables(self, parent):
   214         # generated method, don't edit
       
   215 
       
   216         parent.AddGrowableCol(0)
   213         parent.AddGrowableCol(0)
   217         parent.AddGrowableRow(1)
   214         parent.AddGrowableRow(1)
   218 
   215 
   219     def _init_coll_InstancesSizer_Items(self, parent):
   216     def _init_coll_InstancesSizer_Items(self, parent):
   220         # generated method, don't edit
   217         parent.AddSizer(self.InstancesButtonsSizer, 0, border=0, flag=wx.GROW)
   221 
   218         parent.AddWindow(self.InstancesGrid, 0, border=0, flag=wx.GROW)
   222         parent.AddSizer(self.InstancesButtonsSizer, 0, border=0, flag=wxGROW)
       
   223         parent.AddWindow(self.InstancesGrid, 0, border=0, flag=wxGROW)
       
   224 
   219 
   225     def _init_coll_InstancesButtonsSizer_Growables(self, parent):
   220     def _init_coll_InstancesButtonsSizer_Growables(self, parent):
   226         # generated method, don't edit
       
   227 
       
   228         parent.AddGrowableCol(0)
   221         parent.AddGrowableCol(0)
   229         parent.AddGrowableRow(0)
   222         parent.AddGrowableRow(0)
   230 
   223 
   231     def _init_coll_InstancesButtonsSizer_Items(self, parent):
   224     def _init_coll_InstancesButtonsSizer_Items(self, parent):
   232         # generated method, don't edit
   225         parent.AddWindow(self.staticText2, 0, border=0, flag=wx.ALIGN_BOTTOM)
   233 
       
   234         parent.AddWindow(self.staticText2, 0, border=0, flag=wxALIGN_BOTTOM)
       
   235         parent.AddWindow(self.AddInstanceButton, 0, border=0, flag=0)
   226         parent.AddWindow(self.AddInstanceButton, 0, border=0, flag=0)
   236         parent.AddWindow(self.DeleteInstanceButton, 0, border=0, flag=0)
   227         parent.AddWindow(self.DeleteInstanceButton, 0, border=0, flag=0)
   237         parent.AddWindow(self.UpInstanceButton, 0, border=0, flag=0)
   228         parent.AddWindow(self.UpInstanceButton, 0, border=0, flag=0)
   238         parent.AddWindow(self.DownInstanceButton, 0, border=0, flag=0)
   229         parent.AddWindow(self.DownInstanceButton, 0, border=0, flag=0)
   239 
   230 
   240     def _init_coll_TasksSizer_Growables(self, parent):
   231     def _init_coll_TasksSizer_Growables(self, parent):
   241         # generated method, don't edit
       
   242 
       
   243         parent.AddGrowableCol(0)
   232         parent.AddGrowableCol(0)
   244         parent.AddGrowableRow(1)
   233         parent.AddGrowableRow(1)
   245 
   234 
   246     def _init_coll_TasksSizer_Items(self, parent):
   235     def _init_coll_TasksSizer_Items(self, parent):
   247         # generated method, don't edit
   236         parent.AddSizer(self.TasksButtonsSizer, 0, border=0, flag=wx.GROW)
   248 
   237         parent.AddWindow(self.TasksGrid, 0, border=0, flag=wx.GROW)
   249         parent.AddSizer(self.TasksButtonsSizer, 0, border=0, flag=wxGROW)
       
   250         parent.AddWindow(self.TasksGrid, 0, border=0, flag=wxGROW)
       
   251 
   238 
   252     def _init_coll_TasksButtonsSizer_Growables(self, parent):
   239     def _init_coll_TasksButtonsSizer_Growables(self, parent):
   253         # generated method, don't edit
       
   254 
       
   255         parent.AddGrowableCol(0)
   240         parent.AddGrowableCol(0)
   256         parent.AddGrowableRow(0)
   241         parent.AddGrowableRow(0)
   257 
   242 
   258     def _init_coll_TasksButtonsSizer_Items(self, parent):
   243     def _init_coll_TasksButtonsSizer_Items(self, parent):
   259         # generated method, don't edit
   244         parent.AddWindow(self.staticText1, 0, border=0, flag=wx.ALIGN_BOTTOM)
   260 
       
   261         parent.AddWindow(self.staticText1, 0, border=0, flag=wxALIGN_BOTTOM)
       
   262         parent.AddWindow(self.AddTaskButton, 0, border=0, flag=0)
   245         parent.AddWindow(self.AddTaskButton, 0, border=0, flag=0)
   263         parent.AddWindow(self.DeleteTaskButton, 0, border=0, flag=0)
   246         parent.AddWindow(self.DeleteTaskButton, 0, border=0, flag=0)
   264         parent.AddWindow(self.UpTaskButton, 0, border=0, flag=0)
   247         parent.AddWindow(self.UpTaskButton, 0, border=0, flag=0)
   265         parent.AddWindow(self.DownTaskButton, 0, border=0, flag=0)
   248         parent.AddWindow(self.DownTaskButton, 0, border=0, flag=0)
   266 
   249 
   267     def _init_coll_MainGridSizer_Items(self, parent):
   250     def _init_coll_MainGridSizer_Items(self, parent):
   268         # generated method, don't edit
   251         parent.AddSizer(self.TasksSizer, 0, border=0, flag=wx.GROW)
   269 
   252         parent.AddSizer(self.InstancesSizer, 0, border=0, flag=wx.GROW)
   270         parent.AddSizer(self.TasksSizer, 0, border=0, flag=wxGROW)
       
   271         parent.AddSizer(self.InstancesSizer, 0, border=0, flag=wxGROW)
       
   272 
   253 
   273     def _init_coll_MainGridSizer_Growables(self, parent):
   254     def _init_coll_MainGridSizer_Growables(self, parent):
   274         # generated method, don't edit
       
   275 
       
   276         parent.AddGrowableCol(0)
   255         parent.AddGrowableCol(0)
   277         parent.AddGrowableRow(0)
   256         parent.AddGrowableRow(0)
   278         parent.AddGrowableRow(1)
   257         parent.AddGrowableRow(1)
   279 
   258 
   280     def _init_sizers(self):
   259     def _init_sizers(self):
   281         # generated method, don't edit
       
   282         self.MainGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
   260         self.MainGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
   283 
       
   284         self.InstancesSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
   261         self.InstancesSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
   285 
       
   286         self.InstancesButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
   262         self.InstancesButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
   287 
       
   288         self.TasksSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
   263         self.TasksSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
   289 
       
   290         self.TasksButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
   264         self.TasksButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
   291 
   265 
   292         self._init_coll_MainGridSizer_Growables(self.MainGridSizer)
   266         self._init_coll_MainGridSizer_Growables(self.MainGridSizer)
   293         self._init_coll_MainGridSizer_Items(self.MainGridSizer)
   267         self._init_coll_MainGridSizer_Items(self.MainGridSizer)
   294         self._init_coll_InstancesSizer_Growables(self.InstancesSizer)
   268         self._init_coll_InstancesSizer_Growables(self.InstancesSizer)
   301         self._init_coll_TasksButtonsSizer_Items(self.TasksButtonsSizer)
   275         self._init_coll_TasksButtonsSizer_Items(self.TasksButtonsSizer)
   302 
   276 
   303         self.SetSizer(self.MainGridSizer)
   277         self.SetSizer(self.MainGridSizer)
   304 
   278 
   305     def _init_ctrls(self, prnt):
   279     def _init_ctrls(self, prnt):
   306         # generated method, don't edit
   280         wx.Panel.__init__(self, id=ID_RESOURCEEDITOR, name='', parent=prnt,
   307         wx.Panel.__init__(self, id=wxID_RESOURCEEDITOR, name='', parent=prnt,
       
   308               pos=wx.Point(0, 0), size=wx.Size(-1, -1),
   281               pos=wx.Point(0, 0), size=wx.Size(-1, -1),
   309               style=wx.SUNKEN_BORDER)
   282               style=wx.SUNKEN_BORDER)
   310         
   283         
   311         self.staticText1 = wx.StaticText(id=wxID_RESOURCEEDITORSTATICTEXT1,
   284         self.staticText1 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT1,
   312               label=u'Tasks:', name='staticText2', parent=self, pos=wx.Point(0,
   285               label=u'Tasks:', name='staticText2', parent=self, pos=wx.Point(0,
   313               0), size=wx.Size(60, 17), style=wxALIGN_CENTER)
   286               0), size=wx.Size(60, 17), style=wx.ALIGN_CENTER)
   314 
   287 
   315         self.TasksGrid = wx.grid.Grid(id=wxID_RESOURCEEDITORTASKSGRID,
   288         self.TasksGrid = wx.grid.Grid(id=ID_RESOURCEEDITORTASKSGRID,
   316               name='TasksGrid', parent=self, pos=wx.Point(0, 0), 
   289               name='TasksGrid', parent=self, pos=wx.Point(0, 0), 
   317               size=wx.Size(-1, -1), style=wxVSCROLL)
   290               size=wx.Size(-1, -1), style=wx.VSCROLL)
   318         self.TasksGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
   291         self.TasksGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
   319               'Sans'))
   292               'Sans'))
   320         self.TasksGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
   293         self.TasksGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
   321               False, 'Sans'))
   294               False, 'Sans'))
   322         EVT_GRID_CELL_CHANGE(self.TasksGrid, self.OnTasksGridCellChange)
   295         self.TasksGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnTasksGridCellChange)
   323 
   296 
   324         self.AddTaskButton = wx.Button(id=wxID_RESOURCEEDITORADDTASKBUTTON, label='Add Task',
   297         self.AddTaskButton = wx.Button(id=ID_RESOURCEEDITORADDTASKBUTTON, label='Add Task',
   325               name='AddTaskButton', parent=self, pos=wx.Point(0, 0),
   298               name='AddTaskButton', parent=self, pos=wx.Point(0, 0),
   326               size=wx.Size(102, 32), style=0)
   299               size=wx.Size(102, 32), style=0)
   327         EVT_BUTTON(self, wxID_RESOURCEEDITORADDTASKBUTTON, self.OnAddTaskButton)
   300         self.Bind(wx.EVT_BUTTON, self.OnAddTaskButton, id=ID_RESOURCEEDITORADDTASKBUTTON)
   328 
   301 
   329         self.DeleteTaskButton = wx.Button(id=wxID_RESOURCEEDITORDELETETASKBUTTON, label='Delete Task',
   302         self.DeleteTaskButton = wx.Button(id=ID_RESOURCEEDITORDELETETASKBUTTON, label='Delete Task',
   330               name='DeleteTaskButton', parent=self, pos=wx.Point(0, 0),
   303               name='DeleteTaskButton', parent=self, pos=wx.Point(0, 0),
   331               size=wx.Size(102, 32), style=0)
   304               size=wx.Size(102, 32), style=0)
   332         EVT_BUTTON(self, wxID_RESOURCEEDITORDELETETASKBUTTON, self.OnDeleteTaskButton)
   305         self.Bind(wx.EVT_BUTTON, self.OnDeleteTaskButton, id=ID_RESOURCEEDITORDELETETASKBUTTON)
   333 
   306 
   334         self.UpTaskButton = wx.Button(id=wxID_RESOURCEEDITORUPTASKBUTTON, label='^',
   307         self.UpTaskButton = wx.Button(id=ID_RESOURCEEDITORUPTASKBUTTON, label='^',
   335               name='UpTaskButton', parent=self, pos=wx.Point(0, 0),
   308               name='UpTaskButton', parent=self, pos=wx.Point(0, 0),
   336               size=wx.Size(32, 32), style=0)
   309               size=wx.Size(32, 32), style=0)
   337         EVT_BUTTON(self, wxID_RESOURCEEDITORUPTASKBUTTON, self.OnUpTaskButton)
   310         self.Bind(wx.EVT_BUTTON, self.OnUpTaskButton, id=ID_RESOURCEEDITORUPTASKBUTTON)
   338 
   311 
   339         self.DownTaskButton = wx.Button(id=wxID_RESOURCEEDITORDOWNTASKBUTTON, label='v',
   312         self.DownTaskButton = wx.Button(id=ID_RESOURCEEDITORDOWNTASKBUTTON, label='v',
   340               name='DownTaskButton', parent=self, pos=wx.Point(0, 0),
   313               name='DownTaskButton', parent=self, pos=wx.Point(0, 0),
   341               size=wx.Size(32, 32), style=0)
   314               size=wx.Size(32, 32), style=0)
   342         EVT_BUTTON(self, wxID_RESOURCEEDITORDOWNTASKBUTTON, self.OnDownTaskButton)
   315         self.Bind(wx.EVT_BUTTON, self.OnDownTaskButton, id=ID_RESOURCEEDITORDOWNTASKBUTTON)
   343 
   316 
   344         self.staticText2 = wx.StaticText(id=wxID_RESOURCEEDITORSTATICTEXT2,
   317         self.staticText2 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT2,
   345               label=u'Instances:', name='staticText1', parent=self,
   318               label=u'Instances:', name='staticText1', parent=self,
   346               pos=wx.Point(0, 0), size=wx.Size(85, 17), style=wxALIGN_CENTER)
   319               pos=wx.Point(0, 0), size=wx.Size(85, 17), style=wx.ALIGN_CENTER)
   347 
   320 
   348         self.InstancesGrid = wx.grid.Grid(id=wxID_RESOURCEEDITORINSTANCESGRID,
   321         self.InstancesGrid = wx.grid.Grid(id=ID_RESOURCEEDITORINSTANCESGRID,
   349               name='InstancesGrid', parent=self, pos=wx.Point(0, 0), 
   322               name='InstancesGrid', parent=self, pos=wx.Point(0, 0), 
   350               size=wx.Size(-1, -1), style=wxVSCROLL)
   323               size=wx.Size(-1, -1), style=wx.VSCROLL)
   351         self.InstancesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
   324         self.InstancesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
   352               'Sans'))
   325               'Sans'))
   353         self.InstancesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
   326         self.InstancesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
   354               False, 'Sans'))
   327               False, 'Sans'))
   355         EVT_GRID_CELL_CHANGE(self.InstancesGrid, self.OnInstancesGridCellChange)
   328         self.InstancesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnInstancesGridCellChange)
   356 
   329 
   357         self.AddInstanceButton = wx.Button(id=wxID_RESOURCEEDITORADDINSTANCEBUTTON, label='Add Instance',
   330         self.AddInstanceButton = wx.Button(id=ID_RESOURCEEDITORADDINSTANCEBUTTON, label='Add Instance',
   358               name='AddInstanceButton', parent=self, pos=wx.Point(0, 0),
   331               name='AddInstanceButton', parent=self, pos=wx.Point(0, 0),
   359               size=wx.Size(122, 32), style=0)
   332               size=wx.Size(122, 32), style=0)
   360         EVT_BUTTON(self, wxID_RESOURCEEDITORADDINSTANCEBUTTON, self.OnAddInstanceButton)
   333         self.Bind(wx.EVT_BUTTON, self.OnAddInstanceButton, id=ID_RESOURCEEDITORADDINSTANCEBUTTON)
   361 
   334 
   362         self.DeleteInstanceButton = wx.Button(id=wxID_RESOURCEEDITORDELETEINSTANCEBUTTON, label='Delete Instance',
   335         self.DeleteInstanceButton = wx.Button(id=ID_RESOURCEEDITORDELETEINSTANCEBUTTON, label='Delete Instance',
   363               name='DeleteInstanceButton', parent=self, pos=wx.Point(0, 0),
   336               name='DeleteInstanceButton', parent=self, pos=wx.Point(0, 0),
   364               size=wx.Size(122, 32), style=0)
   337               size=wx.Size(122, 32), style=0)
   365         EVT_BUTTON(self, wxID_RESOURCEEDITORDELETEINSTANCEBUTTON, self.OnDeleteInstanceButton)
   338         self.Bind(wx.EVT_BUTTON, self.OnDeleteInstanceButton, id=ID_RESOURCEEDITORDELETEINSTANCEBUTTON)
   366 
   339 
   367         self.UpInstanceButton = wx.Button(id=wxID_RESOURCEEDITORUPINSTANCEBUTTON, label='^',
   340         self.UpInstanceButton = wx.Button(id=ID_RESOURCEEDITORUPINSTANCEBUTTON, label='^',
   368               name='UpInstanceButton', parent=self, pos=wx.Point(0, 0),
   341               name='UpInstanceButton', parent=self, pos=wx.Point(0, 0),
   369               size=wx.Size(32, 32), style=0)
   342               size=wx.Size(32, 32), style=0)
   370         EVT_BUTTON(self, wxID_RESOURCEEDITORUPINSTANCEBUTTON, self.OnUpInstanceButton)
   343         self.Bind(wx.EVT_BUTTON, self.OnUpInstanceButton, id=ID_RESOURCEEDITORUPINSTANCEBUTTON)
   371 
   344 
   372         self.DownInstanceButton = wx.Button(id=wxID_RESOURCEEDITORDOWNINSTANCEBUTTON, label='v',
   345         self.DownInstanceButton = wx.Button(id=ID_RESOURCEEDITORDOWNINSTANCEBUTTON, label='v',
   373               name='DownInstanceButton', parent=self, pos=wx.Point(0, 0),
   346               name='DownInstanceButton', parent=self, pos=wx.Point(0, 0),
   374               size=wx.Size(32, 32), style=0)
   347               size=wx.Size(32, 32), style=0)
   375         EVT_BUTTON(self, wxID_RESOURCEEDITORDOWNINSTANCEBUTTON, self.OnDownInstanceButton)
   348         self.Bind(wx.EVT_BUTTON, self.OnDownInstanceButton, id=ID_RESOURCEEDITORDOWNINSTANCEBUTTON)
   376 
   349 
   377         self._init_sizers()
   350         self._init_sizers()
   378 
   351 
   379     def __init__(self, parent, window, controler):
   352     def __init__(self, parent, window, controler):
   380         self._init_ctrls(parent)
   353         self._init_ctrls(parent)
   382         self.Parent = window
   355         self.Parent = window
   383         self.Controler = controler
   356         self.Controler = controler
   384         
   357         
   385         self.TasksDefaultValue = {"Name" : "", "Single" : "", "Interval" : "", "Priority" : 0}
   358         self.TasksDefaultValue = {"Name" : "", "Single" : "", "Interval" : "", "Priority" : 0}
   386         self.TasksTable = ResourceTable(self, [], ["Name", "Single", "Interval", "Priority"])
   359         self.TasksTable = ResourceTable(self, [], ["Name", "Single", "Interval", "Priority"])
   387         self.TasksTable.SetColAlignements([wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_RIGHT, wxALIGN_RIGHT])
   360         self.TasksTable.SetColAlignements([wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_RIGHT, wx.ALIGN_RIGHT])
   388         self.TasksTable.SetColSizes([200, 100, 100, 100])
   361         self.TasksTable.SetColSizes([200, 100, 100, 100])
   389         self.TasksGrid.SetTable(self.TasksTable)
   362         self.TasksGrid.SetTable(self.TasksTable)
   390         self.TasksGrid.SetRowLabelSize(0)
   363         self.TasksGrid.SetRowLabelSize(0)
   391         self.TasksTable.ResetView(self.TasksGrid)
   364         self.TasksTable.ResetView(self.TasksGrid)
   392 
   365 
   393         self.InstancesDefaultValue = {"Name" : "", "Type" : "", "Task" : ""}
   366         self.InstancesDefaultValue = {"Name" : "", "Type" : "", "Task" : ""}
   394         self.InstancesTable = ResourceTable(self, [], ["Name", "Type", "Task"])
   367         self.InstancesTable = ResourceTable(self, [], ["Name", "Type", "Task"])
   395         self.InstancesTable.SetColAlignements([wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT])
   368         self.InstancesTable.SetColAlignements([wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT])
   396         self.InstancesTable.SetColSizes([200, 150, 150])
   369         self.InstancesTable.SetColSizes([200, 150, 150])
   397         self.InstancesGrid.SetTable(self.InstancesTable)
   370         self.InstancesGrid.SetTable(self.InstancesTable)
   398         self.InstancesGrid.SetRowLabelSize(0)
   371         self.InstancesGrid.SetRowLabelSize(0)
   399         self.InstancesTable.ResetView(self.InstancesGrid)
   372         self.InstancesTable.ResetView(self.InstancesGrid)
   400 
   373