etherlab/ConfigEditor.py
changeset 2437 105c20fdeb19
parent 2406 ffd091b51cd0
child 2439 f0a040f1de1b
equal deleted inserted replaced
2436:82bfc75bcd9d 2437:105c20fdeb19
     8 #                          Higen Motor : Donggu Kang
     8 #                          Higen Motor : Donggu Kang
     9 #
     9 #
    10 # See COPYING file for copyrights details.
    10 # See COPYING file for copyrights details.
    11 
    11 
    12 from __future__ import absolute_import
    12 from __future__ import absolute_import
       
    13 from __future__ import division
    13 import os
    14 import os
    14 import re
    15 import re
    15 from types import TupleType
    16 from types import TupleType
    16 
    17 
    17 import wx
    18 import wx
   322     def OnResize(self, event):
   323     def OnResize(self, event):
   323         self.EtherCATManagementEditor.GetBestSize()
   324         self.EtherCATManagementEditor.GetBestSize()
   324         xstart, ystart = self.EtherCATManagementEditor.GetViewStart()
   325         xstart, ystart = self.EtherCATManagementEditor.GetViewStart()
   325         window_size = self.EtherCATManagementEditor.GetClientSize()
   326         window_size = self.EtherCATManagementEditor.GetClientSize()
   326         maxx, maxy = self.EtherCATManagementEditor.GetMinSize()
   327         maxx, maxy = self.EtherCATManagementEditor.GetMinSize()
   327         posx = max(0, min(xstart, (maxx - window_size[0]) / SCROLLBAR_UNIT))
   328         posx = max(0, min(xstart, (maxx - window_size[0]) // SCROLLBAR_UNIT))
   328         posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT))
   329         posy = max(0, min(ystart, (maxy - window_size[1]) // SCROLLBAR_UNIT))
   329         self.EtherCATManagementEditor.Scroll(posx, posy)
   330         self.EtherCATManagementEditor.Scroll(posx, posy)
   330         self.EtherCATManagementEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
   331         self.EtherCATManagementEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
   331                                                     maxx / SCROLLBAR_UNIT,
   332                                                     maxx // SCROLLBAR_UNIT,
   332                                                     maxy / SCROLLBAR_UNIT,
   333                                                     maxy // SCROLLBAR_UNIT,
   333                                                     posx, posy)
   334                                                     posx, posy)
   334         event.Skip()
   335         event.Skip()
   335     # -------------------------------------------------------------------------------------------------------
   336     # -------------------------------------------------------------------------------------------------------
   336 
   337 
   337 
   338 
  1054     def OnResize(self, event):
  1055     def OnResize(self, event):
  1055         self.EthercatMasterEditor.GetBestSize()
  1056         self.EthercatMasterEditor.GetBestSize()
  1056         xstart, ystart = self.EthercatMasterEditor.GetViewStart()
  1057         xstart, ystart = self.EthercatMasterEditor.GetViewStart()
  1057         window_size = self.EthercatMasterEditor.GetClientSize()
  1058         window_size = self.EthercatMasterEditor.GetClientSize()
  1058         maxx, maxy = self.EthercatMasterEditorSizer.GetMinSize()
  1059         maxx, maxy = self.EthercatMasterEditorSizer.GetMinSize()
  1059         posx = max(0, min(xstart, (maxx - window_size[0]) / SCROLLBAR_UNIT))
  1060         posx = max(0, min(xstart, (maxx - window_size[0]) // SCROLLBAR_UNIT))
  1060         posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT))
  1061         posy = max(0, min(ystart, (maxy - window_size[1]) // SCROLLBAR_UNIT))
  1061         self.EthercatMasterEditor.Scroll(posx, posy)
  1062         self.EthercatMasterEditor.Scroll(posx, posy)
  1062         self.EthercatMasterEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
  1063         self.EthercatMasterEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
  1063                                                 maxx / SCROLLBAR_UNIT,
  1064                                                 maxx // SCROLLBAR_UNIT,
  1064                                                 maxy / SCROLLBAR_UNIT,
  1065                                                 maxy // SCROLLBAR_UNIT,
  1065                                                 posx, posy)
  1066                                                 posx, posy)
  1066         event.Skip()
  1067         event.Skip()
  1067 
  1068 
  1068     # def OnButtonClick(self, event):
  1069     # def OnButtonClick(self, event):
  1069     #    self.MasterState = self.Controler.getMasterState()
  1070     #    self.MasterState = self.Controler.getMasterState()
  1419     def OnResize(self, event):
  1420     def OnResize(self, event):
  1420         self.ModuleLibraryEditor.GetBestSize()
  1421         self.ModuleLibraryEditor.GetBestSize()
  1421         xstart, ystart = self.ModuleLibraryEditor.GetViewStart()
  1422         xstart, ystart = self.ModuleLibraryEditor.GetViewStart()
  1422         window_size = self.ModuleLibraryEditor.GetClientSize()
  1423         window_size = self.ModuleLibraryEditor.GetClientSize()
  1423         maxx, maxy = self.ModuleLibraryEditor.GetMinSize()
  1424         maxx, maxy = self.ModuleLibraryEditor.GetMinSize()
  1424         posx = max(0, min(xstart, (maxx - window_size[0]) / SCROLLBAR_UNIT))
  1425         posx = max(0, min(xstart, (maxx - window_size[0]) // SCROLLBAR_UNIT))
  1425         posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT))
  1426         posy = max(0, min(ystart, (maxy - window_size[1]) // SCROLLBAR_UNIT))
  1426         self.ModuleLibraryEditor.Scroll(posx, posy)
  1427         self.ModuleLibraryEditor.Scroll(posx, posy)
  1427         self.ModuleLibraryEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
  1428         self.ModuleLibraryEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
  1428                                                maxx / SCROLLBAR_UNIT,
  1429                                                maxx // SCROLLBAR_UNIT,
  1429                                                maxy / SCROLLBAR_UNIT,
  1430                                                maxy // SCROLLBAR_UNIT,
  1430                                                posx, posy)
  1431                                                posx, posy)
  1431         event.Skip()
  1432         event.Skip()