6 |
# Read the file COPYING coming with Thuban for details. |
# Read the file COPYING coming with Thuban for details. |
7 |
|
|
8 |
""" |
""" |
9 |
Extend thuban with a locator tool. |
xtend thuban with a locator tool. |
10 |
|
|
11 |
Collect positions of mouse clicks (in map coordinates) in a text control. |
Collect positions of mouse clicks (in map coordinates) in a text control. |
12 |
|
|
23 |
import os, sys |
import os, sys |
24 |
import string |
import string |
25 |
|
|
26 |
from wxPython import wx |
import wx |
27 |
from wxPython.lib.layoutf import Layoutf |
from wx.lib.layoutf import Layoutf |
28 |
|
|
29 |
from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor |
from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor |
30 |
from Thuban.UI.command import registry, ToolCommand |
from Thuban.UI.command import registry, ToolCommand |
37 |
import Thuban |
import Thuban |
38 |
|
|
39 |
class DynamicMessageDialog(NonModalDialog): |
class DynamicMessageDialog(NonModalDialog): |
40 |
"""Similar to the wxScrolledMessageDialog, contents dynamically |
"""Similar to the wx.ScrolledMessageDialog, contents dynamically |
41 |
changeable by calling applications. |
changeable by calling applications. |
42 |
|
|
43 |
""" |
""" |
44 |
def __init__(self, parent, msg, name, caption, pos = wx.wxDefaultPosition): |
def __init__(self, parent, msg, name, caption, pos = wx.DefaultPosition): |
45 |
NonModalDialog.__init__(self, parent, name, caption) |
NonModalDialog.__init__(self, parent, name, caption) |
46 |
x, y = pos |
x, y = pos |
47 |
if x == -1 and y == -1: |
if x == -1 and y == -1: |
48 |
self.CenterOnScreen(wx.wxBOTH) |
self.CenterOnScreen(wx.BOTH) |
49 |
text = wx.wxTextCtrl(self, -1, msg, wx.wxDefaultPosition, |
text = wx.TextCtrl(self, -1, msg, wx.DefaultPosition, |
50 |
wx.wxDefaultSize, |
wx.DefaultSize, |
51 |
wx.wxTE_MULTILINE | wx.wxTE_READONLY) |
wx.TE_MULTILINE | wx.TE_READONLY) |
52 |
ok = wx.wxButton(self, wx.wxID_OK, "OK") |
ok = wx.Button(self, wx.ID_OK, "OK") |
53 |
text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok))) |
text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok))) |
54 |
ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,))) |
ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,))) |
55 |
wx.EVT_BUTTON(self, wx.wxID_OK, self.OnClose) |
wx.EVT_BUTTON(self, wx.ID_OK, self.OnClose) |
56 |
self.text = text |
self.text = text |
57 |
self.SetAutoLayout(1) |
self.SetAutoLayout(1) |
58 |
self.Layout() |
self.Layout() |