editors/Viewer.py
changeset 1245 d34ba528346b
parent 1244 336d515096b1
child 1246 101625efb1c1
equal deleted inserted replaced
1244:336d515096b1 1245:d34ba528346b
  2239             self.RefreshVisibleElements()
  2239             self.RefreshVisibleElements()
  2240             variable.Refresh()
  2240             variable.Refresh()
  2241         dialog.Destroy()
  2241         dialog.Destroy()
  2242 
  2242 
  2243     def AddNewConnection(self, bbox):
  2243     def AddNewConnection(self, bbox):
  2244         dialog = ConnectionDialog(self.ParentWindow, self.Controler)
  2244         dialog = ConnectionDialog(self.ParentWindow, self.Controler, self.TagName)
  2245         dialog.SetPreviewFont(self.GetFont())
  2245         dialog.SetPreviewFont(self.GetFont())
  2246         dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
  2246         dialog.SetMinElementSize((bbox.width, bbox.height))
  2247         dialog.SetPouElementNames(self.Controler.GetEditedElementVariables(self.TagName, self.Debug))
       
  2248         dialog.SetMinConnectionSize((bbox.width, bbox.height))
       
  2249         if dialog.ShowModal() == wx.ID_OK:
  2247         if dialog.ShowModal() == wx.ID_OK:
  2250             id = self.GetNewId()
  2248             id = self.GetNewId()
  2251             values = dialog.GetValues()
  2249             values = dialog.GetValues()
  2252             connection = FBD_Connector(self, values["type"], values["name"], id)
  2250             connection = FBD_Connector(self, values["type"], values["name"], id)
  2253             connection.SetPosition(bbox.x, bbox.y)
  2251             connection.SetPosition(bbox.x, bbox.y)
  2260             self.RefreshVisibleElements()
  2258             self.RefreshVisibleElements()
  2261             connection.Refresh()
  2259             connection.Refresh()
  2262         dialog.Destroy()
  2260         dialog.Destroy()
  2263 
  2261 
  2264     def AddNewComment(self, bbox):
  2262     def AddNewComment(self, bbox):
  2265         if wx.VERSION >= (2, 5, 0):
  2263         dialog = wx.TextEntryDialog(self.ParentWindow, 
  2266             dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), "", wx.OK|wx.CANCEL|wx.TE_MULTILINE)
  2264                                     _("Edit comment"), 
  2267         else:
  2265                                     _("Please enter comment text"), 
  2268             dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), "", wx.OK|wx.CANCEL)
  2266                                     "", wx.OK|wx.CANCEL|wx.TE_MULTILINE)
  2269         dialog.SetClientSize(wx.Size(400, 200))
  2267         dialog.SetClientSize(wx.Size(400, 200))
  2270         if dialog.ShowModal() == wx.ID_OK:
  2268         if dialog.ShowModal() == wx.ID_OK:
  2271             value = dialog.GetValue()
  2269             value = dialog.GetValue()
  2272             id = self.GetNewId()
  2270             id = self.GetNewId()
  2273             comment = Comment(self, value, id)
  2271             comment = Comment(self, value, id)
  2545                 self.RefreshScrollBars()
  2543                 self.RefreshScrollBars()
  2546                 variable.Refresh(rect)
  2544                 variable.Refresh(rect)
  2547         dialog.Destroy()
  2545         dialog.Destroy()
  2548 
  2546 
  2549     def EditConnectionContent(self, connection):
  2547     def EditConnectionContent(self, connection):
  2550         dialog = ConnectionDialog(self.ParentWindow, self.Controler, True)
  2548         dialog = ConnectionDialog(self.ParentWindow, self.Controler, self.TagName, True)
  2551         dialog.SetPreviewFont(self.GetFont())
  2549         dialog.SetPreviewFont(self.GetFont())
  2552         dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
  2550         dialog.SetMinElementSize(connection.GetSize())
  2553         dialog.SetPouElementNames(self.Controler.GetEditedElementVariables(self.TagName, self.Debug))
       
  2554         dialog.SetMinConnectionSize(connection.GetSize())
       
  2555         values = {"name" : connection.GetName(), "type" : connection.GetType()}
  2551         values = {"name" : connection.GetName(), "type" : connection.GetType()}
  2556         dialog.SetValues(values)
  2552         dialog.SetValues(values)
  2557         result = dialog.ShowModal()
  2553         result = dialog.ShowModal()
  2558         dialog.Destroy()
  2554         dialog.Destroy()
  2559         if result in [wx.ID_OK, wx.ID_YESTOALL]:
  2555         if result in [wx.ID_OK, wx.ID_YESTOALL]:
  2760             self.RefreshVisibleElements()
  2756             self.RefreshVisibleElements()
  2761             actionblock.Refresh(rect)
  2757             actionblock.Refresh(rect)
  2762         dialog.Destroy()
  2758         dialog.Destroy()
  2763 
  2759 
  2764     def EditCommentContent(self, comment):
  2760     def EditCommentContent(self, comment):
  2765         if wx.VERSION >= (2, 5, 0):
  2761         dialog = wx.TextEntryDialog(self.ParentWindow, 
  2766             dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), comment.GetContent(), wx.OK|wx.CANCEL|wx.TE_MULTILINE)
  2762                                     _("Edit comment"), 
  2767         else:
  2763                                     _("Please enter comment text"), 
  2768             dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), comment.GetContent(), wx.OK|wx.CANCEL)
  2764                                     comment.GetContent(), 
       
  2765                                     wx.OK|wx.CANCEL|wx.TE_MULTILINE)
  2769         dialog.SetClientSize(wx.Size(400, 200))
  2766         dialog.SetClientSize(wx.Size(400, 200))
  2770         if dialog.ShowModal() == wx.ID_OK:
  2767         if dialog.ShowModal() == wx.ID_OK:
  2771             value = dialog.GetValue()
  2768             value = dialog.GetValue()
  2772             rect = comment.GetRedrawRect(1, 1)
  2769             rect = comment.GetRedrawRect(1, 1)
  2773             comment.SetContent(value)
  2770             comment.SetContent(value)