[Commits] (morgen) Adding a simple alert dialog

commits at osafoundation.org commits at osafoundation.org
Wed Aug 25 10:00:03 PDT 2004


Commit by: morgen
Modified files:
chandler/application/dialogs/Alert.wdr None 1.1
chandler/application/dialogs/Alert_wdr.xrc None 1.1
chandler/application/dialogs/Util.py 1.3 1.4

Log message:
Adding a simple alert dialog


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/Alert.wdr?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/Alert_wdr.xrc?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/Util.py.diff?r1=text&tr1=1.3&r2=text&tr2=1.4

Index: chandler/application/dialogs/Util.py
diff -u chandler/application/dialogs/Util.py:1.3 chandler/application/dialogs/Util.py:1.4
--- chandler/application/dialogs/Util.py:1.3	Mon Aug 23 11:59:07 2004
+++ chandler/application/dialogs/Util.py	Wed Aug 25 10:00:01 2004
@@ -1,8 +1,10 @@
-__version__ = "$Revision: 1.3 $"
-__date__ = "$Date: 2004/08/23 18:59:07 $"
+__version__ = "$Revision: 1.4 $"
+__date__ = "$Date: 2004/08/25 17:00:01 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
+import os
+import application.Globals
 import wx
 
 # A helper method and class for allowing the user to modify an item's attributes
@@ -261,3 +263,27 @@
         self.SetSizer(sizer)
         self.SetAutoLayout(True)
         sizer.Fit(self)
+
+
+# A simple alert dialog
+
+def showAlert(parent, message):
+        xrcFile = os.path.join(application.Globals.chandlerDirectory,
+         'application', 'dialogs', 'Alert_wdr.xrc')
+        resources = wx.xrc.XmlResource(xrcFile)
+        frame = alertDialog(parent, resources, message=message)
+        frame.ShowModal()
+        frame.Destroy()
+
+class alertDialog(wx.Dialog):
+    def __init__(self, parent, resources, message=""):
+        pre = wx.PreDialog()
+        self.resources = resources
+        resources.LoadOnDialog(pre, parent, 'Alert')
+        self.this = pre.this
+        text = wx.xrc.XRCCTRL(self, "ID_TEXT")
+        text.SetLabel(message)
+        wx.EVT_BUTTON( self, wx.xrc.XRCID( "ID_OK" ), self.OnOk )
+
+    def OnOk(self, evt):
+        self.EndModal(True)



More information about the Commits mailing list