RtmDialog.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # @file RtmDialog.py
5 # @brief rtc-link dialog class
6 # @date $Date: 2005-05-16 10:11:01 $
7 # @author Tsuyoshi Tanabe, Noriaki Ando <n-ando@aist.go.jp>
8 #
9 # Copyright (C) 2004-2005
10 # Task-intelligence Research Group,
11 # Intelligent Systems Research Institute,
12 # National Institute of
13 # Advanced Industrial Science and Technology (AIST), Japan
14 # All rights reserved.
15 #
16 # $Id$
17 #
18 
19 # RtmDialog.py Created on: 2005/01/20
20 # Author : Tsuyoshi Tanabe
21 
22 
23 """
24  wxPython を用いたダイアログ・モジュール
25 """
26 
27 import wx
28 import sys
29 
30 #---------------------------------------------------------------------------
31 # Create and set a help provider. Normally you would do this in
32 # the app's OnInit as it must be done before any SetHelpText calls.
33 provider = wx.SimpleHelpProvider()
34 wx.HelpProvider_Set(provider)
35 
36 #---------------------------------------------------------------------------
37 
38 class RtmDialog(wx.Dialog):
39  """ダイアログ表示用クラス"""
40  def __init__(
41  self, parent, ID, message, size=wx.DefaultSize, pos=wx.DefaultPosition
42  ):
43  """初期化。ダイアログの作成を行う。
44 
45  [引数]
46  parent -- 親Window
47  ID -- window ID
48  message -- 表示するメッセージ
49  size -- dialog のサイズ
50  pos -- dialog の位置 [戻り値] void
51 
52  [戻り値]
53  void
54  """
55 
56  style=wx.DEFAULT_DIALOG_STYLE
57  title="Ask Dialog"
58 
59  # Instead of calling wx.Dialog.__init__ we precreate the dialog
60  # so we can set an extra style that must be set before
61  # creation, and then we create the GUI dialog using the Create
62  # method.
63 
64  pre = wx.PreDialog()
65 # pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
66  pre.Create(parent, ID, title, pos, size, style)
67 
68  # This next step is the most important, it turns this Python
69  # object into the real wrapper of the dialog (instead of pre)
70  # as far as the wxPython extension is concerned.
71  self.this = pre.this
72 
73  # Now continue with the normal construction of the dialog
74  # contents
75  sizer = wx.BoxSizer(wx.VERTICAL)
76 
77  label = wx.StaticText(self, -1, message)
78  sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
79 
80  line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
81  sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
82 
83  box = wx.BoxSizer(wx.HORIZONTAL)
84 
85  btn = wx.Button(self, wx.ID_OK, " OK ")
86  btn.SetDefault()
87  box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
88 
89  btn = wx.Button(self, wx.ID_CANCEL, " Cancel ")
90  box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
91 
92  sizer.Add(box, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)
93 
94  self.SetSizer(sizer)
95  self.SetAutoLayout(True)
96  sizer.Fit(self)
97 
98 #---------------------------------------------------------------------------
99 
100 def except_mess(mess):
101  print "traceback code:",sys.exc_traceback.tb_frame.f_code
102  print "except line:",sys.exc_traceback.tb_lineno
103  print mess, sys.exc_type, sys.exc_value
def __init__(self, parent, ID, message, size=wx.DefaultSize, pos=wx.DefaultPosition)
Definition: RtmDialog.py:42
def except_mess(mess)
Definition: RtmDialog.py:100


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:44