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

Source Code for Module Gnumed.timelinelib.wxgui.dialogs.feedback.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 webbrowser 
20   
21  import wx 
22   
23  from timelinelib.wxgui.dialogs.feedback.controller import FeedbackDialogController 
24  from timelinelib.wxgui.framework import Dialog 
25   
26   
27 -class FeedbackDialog(Dialog):
28 29 """ 30 <BoxSizerVertical> 31 <StaticText name="info" border="LEFT|TOP|RIGHT" /> 32 <FlexGridSizer columns="2" growableColumns="1" growableRows="2" proportion="1" border="ALL"> 33 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(to_text)" /> 34 <TextCtrl name="to_text" style="TE_READONLY" /> 35 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(subject_text)" /> 36 <TextCtrl name="subject_text" /> 37 <StaticText align="ALIGN_TOP" label="$(body_text)" /> 38 <TextCtrlSelect name="body_text" height="200" style="TE_MULTILINE" /> 39 <StaticText align="ALIGN_CENTER_VERTICAL" label="$(send_with_text)" /> 40 <BoxSizerHorizontal> 41 <Button label="$(default_button_text)" borderType="SMALL" border="RIGHT" event_EVT_BUTTON="on_default_click" /> 42 <Button label="$(gmail_button_text)" borderType="SMALL" border="RIGHT" event_EVT_BUTTON="on_gmail_click" /> 43 <Button label="$(other_button_text)" border="RIGHT" event_EVT_BUTTON="on_other_click" /> 44 <StretchSpacer /> 45 <DialogButtonsCloseSizer /> 46 </BoxSizerHorizontal> 47 </FlexGridSizer> 48 </BoxSizerVertical> 49 """ 50
51 - def __init__(self, parent, info, subject, body):
52 Dialog.__init__(self, FeedbackDialogController, parent, { 53 "title_text": _("Email Feedback"), 54 "to_text": _("To:"), 55 "subject_text": _("Subject:"), 56 "body_text": _("Body:"), 57 "send_with_text": _("Send With:"), 58 "default_button_text": _("Default client"), 59 "gmail_button_text": _("Gmail"), 60 "other_button_text": _("Other"), 61 }, title=_("Email Feedback"), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) 62 self.controller.on_init(webbrowser, info, subject, body) 63 self.body_text.SetFocus()
64
65 - def SetInfoText(self, text):
66 self.info.SetLabel(text) 67 self.SetSizerAndFit(self.GetSizer())
68
69 - def GetToText(self):
70 return self.to_text.GetValue()
71
72 - def SetToText(self, text):
73 self.to_text.SetValue(text)
74
75 - def GetSubjectText(self):
76 return self.subject_text.GetValue()
77
78 - def SetSubjectText(self, text):
79 self.subject_text.SetValue(text)
80
81 - def GetBodyText(self):
82 return self.body_text.GetValue()
83
84 - def SetBodyText(self, text):
85 self.body_text.SetValue(text)
86
87 - def SelectAllBodyText(self):
88 self.body_text.SelectAll()
89 90
91 -def show_feedback_dialog(info, subject, body, parent=None):
92 dialog = FeedbackDialog(parent, info, subject, body) 93 dialog.ShowModal() 94 dialog.Destroy()
95