mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-15 17:20:07 +01:00
Add TipProvider and helpers to wx.adv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,7 @@ INCLUDES = [
|
||||
'datectrl',
|
||||
'calctrl',
|
||||
'hyperlink',
|
||||
'tipdlg',
|
||||
|
||||
|
||||
# TODOs -
|
||||
@@ -51,7 +52,6 @@ INCLUDES = [
|
||||
#'splash',
|
||||
#'taskbar',
|
||||
#'timectrl',
|
||||
#'tipdlg',
|
||||
#'treelist',
|
||||
#'wizard',
|
||||
|
||||
|
||||
45
etg/tipdlg.py
Normal file
45
etg/tipdlg.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: etg/tipdlg.py
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 12-Apr-2012
|
||||
# Copyright: (c) 2012 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_adv"
|
||||
NAME = "tipdlg" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ "wxTipProvider",
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/tipdlg.h>')
|
||||
module.find('wxCreateFileTipProvider').factory = True
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
38
unittests/test_tipdlg.py
Normal file
38
unittests/test_tipdlg.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import wx.adv
|
||||
import os
|
||||
|
||||
tipFile = os.path.join(os.path.dirname(__file__), 'tips.txt')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class tipdlg_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_tipdlg1(self):
|
||||
tp = wx.adv.CreateFileTipProvider(tipFile, 0);
|
||||
wx.CallLater(25, self._closeTipDialog)
|
||||
wx.adv.ShowTip(self.frame, tp)
|
||||
|
||||
|
||||
def test_tipdlg2(self):
|
||||
class MyTipProvider(wx.adv.TipProvider):
|
||||
def GetTip(self):
|
||||
return "This is my tip"
|
||||
|
||||
wx.CallLater(25, self._closeTipDialog)
|
||||
wx.adv.ShowTip(self.frame, MyTipProvider(0))
|
||||
|
||||
|
||||
def _closeTipDialog(self):
|
||||
#self.myYield()
|
||||
for w in wx.GetTopLevelWindows():
|
||||
if isinstance(w, wx.Dialog):
|
||||
w.EndModal(wx.ID_CANCEL)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
1
unittests/tips.txt
Normal file
1
unittests/tips.txt
Normal file
@@ -0,0 +1 @@
|
||||
Here is a tip from a text file. See test_tipdlg.py
|
||||
Reference in New Issue
Block a user