Package Gnumed :: Package timelinelib :: Package wxgui :: Package dialogs :: Package slideshow :: Module view
[frames] | no frames]

Source Code for Module Gnumed.timelinelib.wxgui.dialogs.slideshow.view

  1  # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018  Rickard Lindberg, Roger Lindberg 
  2  # 
  3  # This file is part of Timeline. 
  4  # 
  5  # Timeline is free software: you can redistribute it and/or modify 
  6  # it under the terms of the GNU General Public License as published by 
  7  # the Free Software Foundation, either version 3 of the License, or 
  8  # (at your option) any later version. 
  9  # 
 10  # Timeline is distributed in the hope that it will be useful, 
 11  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 13  # GNU General Public License for more details. 
 14  # 
 15  # You should have received a copy of the GNU General Public License 
 16  # along with Timeline.  If not, see <http://www.gnu.org/licenses/>. 
 17   
 18   
 19  import wx 
 20  import webbrowser 
 21   
 22  from timelinelib.wxgui.framework import Dialog 
 23  from timelinelib.wxgui.dialogs.slideshow.controller import SlideshowDialogController 
 24  from timelinelib.wxgui.utils import display_error_message 
 25  from timelinelib.wxgui.utils import get_user_ack 
 26   
 27   
28 -class SlideshowDialog(Dialog):
29 30 """ 31 <BoxSizerVertical> 32 <StaticBoxSizerVertical 33 label="$(events_label)" 34 border="ALL" 35 proportion="1"> 36 <RadioButton 37 label="Only visible events" 38 border="TOP|BOTTOM|LEFT" 39 name="rb_visible_events" /> 40 <RadioButton 41 label="All events" 42 border="BOTTOM|LEFT" 43 name="rb_all_events" /> 44 </StaticBoxSizerVertical> 45 <StaticBoxSizerVertical 46 label="$(target_dir_label)" 47 border="BOTTOM|LEFT|RIGHT" 48 proportion="0"> 49 <BoxSizerHorizontal> 50 <TextCtrl 51 border="BOTTOM|LEFT" 52 width="200" 53 name="tb_target_dir" /> 54 <Button 55 label="..." 56 border="BOTTOM|LEFT" 57 width="25" 58 name="tb_target" 59 event_EVT_BUTTON="on_change_dir" /> 60 </BoxSizerHorizontal> 61 </StaticBoxSizerVertical> 62 <DialogButtonsOkCancelSizer 63 border="LEFT|RIGHT|BOTTOM" 64 event_EVT_BUTTON__ID_OK="on_start" 65 /> 66 </BoxSizerVertical> 67 """ 68
69 - def __init__(self, parent, db, canvas):
70 self._db = db 71 self._canvas = canvas 72 Dialog.__init__(self, SlideshowDialogController, parent, { 73 "events_label": _("Select Events"), 74 "target_dir_label": _("Save html pages at") 75 }, title=_("Start Slide Show")) 76 self.controller.on_init(db, canvas)
77
78 - def ChangeDir(self):
79 dialog = wx.DirDialog(self, _("Select html pages directory"), "") 80 if dialog.ShowModal() == wx.ID_OK: 81 self.tb_target_dir.SetValue(dialog.GetPath()) 82 dialog.Destroy()
83
84 - def AllEventsSelected(self):
85 return self.rb_all_events.GetValue()
86
87 - def GetTargetDir(self):
88 return self.tb_target_dir.GetValue()
89
90 - def InvalidTargetDir(self, message):
91 display_error_message(message) 92 self.tb_target_dir.SetFocus()
93
94 - def GetUserAck(self, query):
95 return get_user_ack(query)
96
97 - def DisplayStartPage(self, page_path):
98 webbrowser.open(page_path, new=1)
99 100
101 -def open_slideshow_dialog(db, canvas):
102 dialog = SlideshowDialog(None, db, canvas) 103 try: 104 dialog.ShowModal() 105 finally: 106 dialog.Destroy()
107