Module Gnumed.wxpython.gmGuiTest
GNUmed GUI widget testing framework.
Functions
def setup_widget_test_env(patient=-1)
-
Expand source code
def setup_widget_test_env(patient=-1): """Setup widget test environment. - connect to DB - setup praxis branch - setup active patient, asking for patient if not given - setup wx app - setup wx frame as topwindow Does *not* run app.MainLoop(). You will have to do that yourself like so: main_frame = setup_widget_test_env(...) my_widget = cWidgetClass(main_frame, ...) my_widget.whatever_else_is_necessary(...) wx.GetApp().MainLoop() Returns: main frame, which can be used to instantiate widgets """ gmPG2.request_login_params(setup_pool = True, force_tui = True) if not __activate_patient(patient = patient): sys.exit() gmPraxis.gmCurrentPraxisBranch.from_first_branch() gmStaff.set_current_provider_to_logged_on_user() app = inspection.InspectableApp() app.SetAssertMode(wx.APP_ASSERT_EXCEPTION | wx.APP_ASSERT_LOG) app.InitInspection() frame = wx.Frame(None, id = -1, title = _('GNUmed widget test'), size = (800, 600)) frame.CentreOnScreen(wx.BOTH) app.SetTopWindow(frame) frame.Show(True) app.ShowInspectionTool() return frame
Setup widget test environment.
- connect to DB
- setup praxis branch
- setup active patient, asking for patient if not given
- setup wx app
- setup wx frame as topwindow
Does not run app.MainLoop(). You will have to do that yourself like so:
main_frame = setup_widget_test_env(…) my_widget = cWidgetClass(main_frame, …) my_widget.whatever_else_is_necessary(…) wx.GetApp().MainLoop()
Returns
main frame, which can be used to instantiate widgets
def test_widget(widget_class,
*widget_args,
patient: int = -1,
size=None,
setup_db: bool = True,
**widget_kwargs)-
Expand source code
def test_widget(widget_class, *widget_args, patient:int=-1, size=None, setup_db:bool=True, **widget_kwargs): if setup_db: gmPG2.request_login_params(setup_pool = True, force_tui = True) gmPraxis.gmCurrentPraxisBranch.from_first_branch() if not __activate_patient(patient = patient): sys.exit() app = inspection.InspectableApp() app.SetAssertMode(wx.APP_ASSERT_EXCEPTION | wx.APP_ASSERT_LOG) app.InitInspection() if size is None: size = (800, 600) frame = wx.Frame(None, id = -1, title = _('GNUmed widget test: %s') % widget_class, size = size) frame.CentreOnScreen(wx.BOTH) app.SetTopWindow(frame) widget = widget_class(frame, *widget_args, **widget_kwargs) frame.Show(True) app.ShowInspectionTool() try: app.MainLoop() except Exception: gmLog2.log_stack_trace(message = 'test failure') return widget