Ver código fonte

wxGUI/gmodeler: replace wx.TextEntryDialog with gui_core.TextEntryDialog (fix set comment multiline input)
(merge https://trac.osgeo.org/grass/changeset/67519 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@67522 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 9 anos atrás
pai
commit
1dd4e3d629
2 arquivos alterados com 14 adições e 9 exclusões
  1. 7 5
      gui/wxpython/gmodeler/frame.py
  2. 7 4
      gui/wxpython/gui_core/dialogs.py

+ 7 - 5
gui/wxpython/gmodeler/frame.py

@@ -40,7 +40,7 @@ from core.gconsole        import GConsole, \
 from gui_core.goutput     import GConsoleWindow
 from core.debug           import Debug
 from core.gcmd            import GMessage, GException, GWarning, GError, RunCommand
-from gui_core.dialogs     import GetImageHandlers
+from gui_core.dialogs     import GetImageHandlers, TextEntryDialog
 from gui_core.ghelp       import ShowAboutDialog
 from gui_core.preferences import PreferencesBaseDialog
 from core.settings        import UserSettings
@@ -742,8 +742,9 @@ class ModelFrame(wx.Frame):
 
     def OnAddComment(self, event):
         """Add comment to the model"""
-        dlg = wx.TextEntryDialog(parent = self, message = _("Comment:"), caption = _("Add comment"),
-                                 style = wx.OK | wx.CANCEL | wx.CENTRE | wx.TE_MULTILINE)
+        dlg = TextEntryDialog(parent = self, message = _("Comment:"), caption = _("Add comment"),
+                              textStyle = wx.TE_MULTILINE, textSize = (300, 75))
+        
         if dlg.ShowModal() == wx.ID_OK:
             comment = dlg.GetValue()
             if not comment:
@@ -1365,8 +1366,9 @@ class ModelEvtHandler(ogl.ShapeEvtHandler):
     
     def OnSetComment(self, event):
         shape = self.GetShape()
-        dlg = wx.TextEntryDialog(parent = self.frame, message = _("Comment:"), caption = _("Set comment"),
-                                 defaultValue = shape.GetComment(), style = wx.OK | wx.CANCEL | wx.CENTRE | wx.TE_MULTILINE)
+        dlg = TextEntryDialog(parent = self.frame, message = _("Comment:"), caption = _("Set comment"),
+                              defaultValue = shape.GetComment(),
+                              textStyle = wx.TE_MULTILINE, textSize = (300, 75))
         if dlg.ShowModal() == wx.ID_OK:
             comment = dlg.GetValue()
             shape.SetComment(comment)

+ 7 - 4
gui/wxpython/gui_core/dialogs.py

@@ -2730,8 +2730,9 @@ class TextEntryDialog(wx.Dialog):
     It differs from wx.TextEntryDialog because it allows adding validator.
     """
     def __init__(self, parent, message, caption='',
-                 defaultValue='', validator=wx.DefaultValidator,
-                 style=wx.OK | wx.CANCEL, **kwargs):
+                 defaultValue='', validator=wx.DefaultValidator, 
+                 style=wx.OK | wx.CANCEL | wx.CENTRE, textStyle=0, textSize=(300, -1),
+                 **kwargs):
         wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=caption, **kwargs)
 
         vbox = wx.BoxSizer(wx.VERTICAL)
@@ -2739,8 +2740,10 @@ class TextEntryDialog(wx.Dialog):
         stline = wx.StaticText(self, id=wx.ID_ANY, label=message)
         vbox.Add(item=stline, proportion=0, flag=wx.EXPAND | wx.ALL, border=10)
 
-        self._textCtrl = wx.TextCtrl(self, id=wx.ID_ANY, size = (300, -1),
-                                     value=defaultValue, validator=validator)
+        self._textCtrl = wx.TextCtrl(self, id=wx.ID_ANY,
+                                     value=defaultValue, validator=validator, style=textStyle)
+        self._textCtrl.SetInitialSize(textSize)
+        
         vbox.Add(item=self._textCtrl, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10)
         self._textCtrl.SetFocus()