IDEFrame.py
changeset 1846 14b40afccd69
parent 1836 d42b6cf00fa6
child 1847 6198190bc121
equal deleted inserted replaced
1845:3abde7651c38 1846:14b40afccd69
   372     def _init_coll_EditMenu_Items(self, parent):
   372     def _init_coll_EditMenu_Items(self, parent):
   373         AppendMenu(parent, help='', id=wx.ID_UNDO,
   373         AppendMenu(parent, help='', id=wx.ID_UNDO,
   374                    kind=wx.ITEM_NORMAL, text=_(u'Undo') + '\tCTRL+Z')
   374                    kind=wx.ITEM_NORMAL, text=_(u'Undo') + '\tCTRL+Z')
   375         AppendMenu(parent, help='', id=wx.ID_REDO,
   375         AppendMenu(parent, help='', id=wx.ID_REDO,
   376                    kind=wx.ITEM_NORMAL, text=_(u'Redo') + '\tCTRL+Y')
   376                    kind=wx.ITEM_NORMAL, text=_(u'Redo') + '\tCTRL+Y')
   377         # AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO,
       
   378         #      kind=wx.ITEM_CHECK, text=_(u'Enable Undo/Redo'))
       
   379         enable_undo_redo = _(u'Enable Undo/Redo')  # Keeping text in translations for possible menu reactivation
       
   380         parent.AppendSeparator()
   377         parent.AppendSeparator()
   381         AppendMenu(parent, help='', id=wx.ID_CUT,
   378         AppendMenu(parent, help='', id=wx.ID_CUT,
   382                    kind=wx.ITEM_NORMAL, text=_(u'Cut') + '\tCTRL+X')
   379                    kind=wx.ITEM_NORMAL, text=_(u'Cut') + '\tCTRL+X')
   383         AppendMenu(parent, help='', id=wx.ID_COPY,
   380         AppendMenu(parent, help='', id=wx.ID_COPY,
   384                    kind=wx.ITEM_NORMAL, text=_(u'Copy') + '\tCTRL+C')
   381                    kind=wx.ITEM_NORMAL, text=_(u'Copy') + '\tCTRL+C')
  1738                 self._Refresh(TITLE, FILEMENU, EDITMENU)
  1735                 self._Refresh(TITLE, FILEMENU, EDITMENU)
  1739                 event.Skip()
  1736                 event.Skip()
  1740 
  1737 
  1741     def OnProjectTreeItemActivated(self, event):
  1738     def OnProjectTreeItemActivated(self, event):
  1742         selected = event.GetItem()
  1739         selected = event.GetItem()
  1743         name = self.ProjectTree.GetItemText(selected)
       
  1744         item_infos = self.ProjectTree.GetPyData(selected)
  1740         item_infos = self.ProjectTree.GetPyData(selected)
  1745         if item_infos["type"] == ITEM_PROJECT:
  1741         if item_infos["type"] == ITEM_PROJECT:
  1746             self.EditProjectSettings()
  1742             self.EditProjectSettings()
  1747         else:
  1743         else:
  1748             if item_infos["type"] in [ITEM_DATATYPE, ITEM_POU,
  1744             if item_infos["type"] in [ITEM_DATATYPE, ITEM_POU,
  1751                 self.EditProjectElement(item_infos["type"], item_infos["tagname"])
  1747                 self.EditProjectElement(item_infos["type"], item_infos["tagname"])
  1752             event.Skip()
  1748             event.Skip()
  1753 
  1749 
  1754     def ProjectTreeItemSelect(self, select_item):
  1750     def ProjectTreeItemSelect(self, select_item):
  1755         if select_item is not None and select_item.IsOk():
  1751         if select_item is not None and select_item.IsOk():
  1756             name = self.ProjectTree.GetItemText(select_item)
       
  1757             item_infos = self.ProjectTree.GetPyData(select_item)
  1752             item_infos = self.ProjectTree.GetPyData(select_item)
  1758             if item_infos["type"] in [ITEM_DATATYPE, ITEM_POU,
  1753             if item_infos["type"] in [ITEM_DATATYPE, ITEM_POU,
  1759                                       ITEM_CONFIGURATION, ITEM_RESOURCE,
  1754                                       ITEM_CONFIGURATION, ITEM_RESOURCE,
  1760                                       ITEM_TRANSITION, ITEM_ACTION]:
  1755                                       ITEM_TRANSITION, ITEM_ACTION]:
  1761                 self.EditProjectElement(item_infos["type"], item_infos["tagname"], True)
  1756                 self.EditProjectElement(item_infos["type"], item_infos["tagname"], True)
  2625         dc.SetDeviceOrigin(0, 0)
  2620         dc.SetDeviceOrigin(0, 0)
  2626         dc.printing = not self.Preview
  2621         dc.printing = not self.Preview
  2627 
  2622 
  2628         # Get the size of the DC in pixels
  2623         # Get the size of the DC in pixels
  2629         ppiPrinterX, ppiPrinterY = self.GetPPIPrinter()
  2624         ppiPrinterX, ppiPrinterY = self.GetPPIPrinter()
  2630         ppiScreenX, ppiScreenY = self.GetPPIScreen()
       
  2631         pw, ph = self.GetPageSizePixels()
  2625         pw, ph = self.GetPageSizePixels()
  2632         dw, dh = dc.GetSizeTuple()
  2626         dw, dh = dc.GetSizeTuple()
  2633         Xscale = (float(dw) * float(ppiPrinterX)) / (float(pw) * 25.4)
  2627         Xscale = (float(dw) * float(ppiPrinterX)) / (float(pw) * 25.4)
  2634         Yscale = (float(dh) * float(ppiPrinterY)) / (float(ph) * 25.4)
  2628         Yscale = (float(dh) * float(ppiPrinterY)) / (float(ph) * 25.4)
  2635 
  2629 
  2636         fontsize = self.FontSize * Yscale
  2630         fontsize = self.FontSize * Yscale
  2637         text_margin = self.TextMargin * Yscale
       
  2638 
  2631 
  2639         margin_left = self.Margins[0].x * Xscale
  2632         margin_left = self.Margins[0].x * Xscale
  2640         margin_top = self.Margins[0].y * Yscale
  2633         margin_top = self.Margins[0].y * Yscale
  2641         area_width = dw - self.Margins[1].x * Xscale - margin_left
  2634         area_width = dw - self.Margins[1].x * Xscale - margin_left
  2642         area_height = dh - self.Margins[1].y * Yscale - margin_top
  2635         area_height = dh - self.Margins[1].y * Yscale - margin_top