RtmDialog.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*- 
00003 #
00004 #  @file RtmDialog.py
00005 #  @brief rtc-link dialog class
00006 #  @date $Date: 2005-05-16 10:11:01 $
00007 #  @author Tsuyoshi Tanabe, Noriaki Ando <n-ando@aist.go.jp>
00008 # 
00009 #  Copyright (C) 2004-2005
00010 #      Task-intelligence Research Group,
00011 #      Intelligent Systems Research Institute,
00012 #      National Institute of
00013 #          Advanced Industrial Science and Technology (AIST), Japan
00014 #      All rights reserved.
00015 # 
00016 #  $Id: RtmDialog.py 775 2008-07-28 16:14:45Z n-ando $
00017 #
00018 
00019 # RtmDialog.py               Created on: 2005/01/20
00020 #                            Author    : Tsuyoshi Tanabe
00021 
00022 
00023 """
00024     wxPython を用いたダイアログ・モジュール
00025 """
00026 
00027 import  wx
00028 import  sys
00029 
00030 #---------------------------------------------------------------------------
00031 # Create and set a help provider.  Normally you would do this in
00032 # the app's OnInit as it must be done before any SetHelpText calls.
00033 provider = wx.SimpleHelpProvider()
00034 wx.HelpProvider_Set(provider)
00035 
00036 #---------------------------------------------------------------------------
00037 
00038 class RtmDialog(wx.Dialog):
00039     """ダイアログ表示用クラス"""
00040     def __init__(
00041             self, parent, ID, message, size=wx.DefaultSize, pos=wx.DefaultPosition
00042             ):
00043         """初期化。ダイアログの作成を行う。
00044 
00045         [引数]
00046         parent  -- 親Window
00047         ID      -- window ID
00048         message -- 表示するメッセージ
00049         size    -- dialog のサイズ
00050         pos     -- dialog の位置
00051 
00052         [戻り値]
00053         void
00054         """
00055 
00056         style=wx.DEFAULT_DIALOG_STYLE
00057         title="Ask Dialog"
00058 
00059         # Instead of calling wx.Dialog.__init__ we precreate the dialog
00060         # so we can set an extra style that must be set before
00061         # creation, and then we create the GUI dialog using the Create
00062         # method.
00063 
00064         pre = wx.PreDialog()
00065 #        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
00066         pre.Create(parent, ID, title, pos, size, style)
00067 
00068         # This next step is the most important, it turns this Python
00069         # object into the real wrapper of the dialog (instead of pre)
00070         # as far as the wxPython extension is concerned.
00071         self.this = pre.this
00072 
00073         # Now continue with the normal construction of the dialog
00074         # contents
00075         sizer = wx.BoxSizer(wx.VERTICAL)
00076 
00077         label = wx.StaticText(self, -1, message)
00078         sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
00079 
00080         line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
00081         sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
00082 
00083         box = wx.BoxSizer(wx.HORIZONTAL)
00084 
00085         btn = wx.Button(self, wx.ID_OK, " OK ")
00086         btn.SetDefault()
00087         box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
00088 
00089         btn = wx.Button(self, wx.ID_CANCEL, " Cancel ")
00090         box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
00091 
00092         sizer.Add(box, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)
00093 
00094         self.SetSizer(sizer)
00095         self.SetAutoLayout(True)
00096         sizer.Fit(self)
00097 
00098 #---------------------------------------------------------------------------
00099 
00100 def except_mess(mess):
00101     print "traceback code:",sys.exc_traceback.tb_frame.f_code
00102     print "except line:",sys.exc_traceback.tb_lineno
00103     print mess, sys.exc_type, sys.exc_value


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:06