~ubuntu-branches/ubuntu/hardy/gnue-common/hardy

« back to all changes in this revision

Viewing changes to src/cursing/MsgBoxTimer.py

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-03-09 11:06:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050309110631-8gvvn39q7tjz1kj6
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file is part of GNU Enterprise.
 
3
#
 
4
# GNU Enterprise is free software; you can redistribute it
 
5
# and/or modify it under the terms of the GNU General Public
 
6
# License as published by the Free Software Foundation; either
 
7
# version 2, or (at your option) any later version.
 
8
#
 
9
# GNU Enterprise is distributed in the hope that it will be
 
10
# useful, but WITHOUT ANY WARRANTY; without even the implied
 
11
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 
12
# PURPOSE. See the GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public
 
15
# License along with program; see the file COPYING. If not,
 
16
# write to the Free Software Foundation, Inc., 59 Temple Place
 
17
# - Suite 330, Boston, MA 02111-1307, USA.
 
18
#
 
19
# Copyright 2002-2005 Free Software Foundation
 
20
#
 
21
# FILE:
 
22
# MsgBoxTimer.py
 
23
#
 
24
# DESCRIPTION:
 
25
#
 
26
# NOTES:
 
27
#
 
28
 
 
29
 
 
30
from constants import *
 
31
from Button import Button
 
32
from Label import Label
 
33
from Dialog import Dialog
 
34
 
 
35
class MsgBoxTimer(Dialog):
 
36
  """
 
37
    A sample 'standard' OK dialog box for short messages.
 
38
  """
 
39
  def __init__(self, Parent, Message, **properties):
 
40
    SIOInstance = Parent.Screen()
 
41
    sMCOL = SIOInstance.MAXCOL
 
42
    sMROW = SIOInstance.MAXROW
 
43
    MsgLen = len(Message)
 
44
 
 
45
    DialogWidth = MsgLen + 4
 
46
    DialogHeight = 6
 
47
 
 
48
    # adjust dialog, if need be, to hold OK btn comfortably
 
49
    if DialogWidth < 6:
 
50
      DialogWidth = 10
 
51
 
 
52
    r1 = (sMROW - DialogHeight) / 2
 
53
    r2 = r1 + DialogHeight
 
54
 
 
55
    c1 = (sMCOL - DialogWidth) / 2
 
56
    c2 = c1 + DialogWidth
 
57
 
 
58
    Dialog.__init__(self, Parent, r1, c1, r2, c2, **properties)
 
59
 
 
60
    tCmd = Button(self, "TheBtn", 5, (DialogWidth - 6) / 2, 6, "OK")
 
61
    tCmd.EXITFORM = 1
 
62
    self.AddDialogControl(tCmd)
 
63
    self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
 
64
 
 
65
  def Show(self):
 
66
    self.Screen().LoLight()
 
67
##    t = self.RunDialog()
 
68
    return t
 
69
 
 
70
 
 
71
 
 
72
class PopupTimer(wxTimer):
 
73
  def __init__(self, method, *args, **params):
 
74
    self.__method = method
 
75
    self.__args = args
 
76
    self.__params = params
 
77
    wxTimer.__init__(self)
 
78
 
 
79
  def Notify(self):
 
80
    self.__method(*self.__args, **self.__params)
 
81
 
 
82
 
 
83
 
 
84