91 | | def export_openDialog(self) : |
92 | | """Opens a dialog to ask username, password, etc...""" |
93 | | self.logDebug("Open dialog !") |
94 | | return ("jerome", "blah") |
| 91 | def export_openConfirmDialog(self, printername, username, jobid, jobtitle, jobsize) : |
| 92 | """Opens a dialog to ask the user to confirm or cancel the print job. |
| 93 | |
| 94 | Returns True to confirm, False to cancel. |
| 95 | """ |
| 96 | wx.CallAfter(self.frame.askConfirmation, printername, username, jobid, jobtitle, jobsize) |
| 97 | while self.frame.askConfirmationResult is None : |
| 98 | time.sleep(0.5) |
| 99 | retcode = self.frame.askConfirmationResult |
| 100 | self.frame.askConfirmationResult = None |
| 101 | return retcode |
144 | | try : |
145 | | self.tbicon = wxPython.wx.wxTaskBarIcon() |
146 | | except AttributeError : |
147 | | self.tbicon = None # No taskbar icon facility, old wxWidgets maybe |
148 | | |
149 | | self.greenicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-green.ico"), \ |
150 | | wxPython.wx.wxBITMAP_TYPE_ICO) |
151 | | self.redicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-red.ico"), \ |
152 | | wxPython.wx.wxBITMAP_TYPE_ICO) |
153 | | |
154 | | self.SetIcon(self.greenicon) |
155 | | if self.tbicon is not None : |
156 | | self.tbicon.SetIcon(self.greenicon, "PyKotIcon") |
157 | | wxPython.wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) |
158 | | wxPython.wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) |
159 | | |
160 | | self.TBMENU_RESTORE = wx.NewId() |
161 | | self.TBMENU_CLOSE = wx.NewId() |
162 | | wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \ |
163 | | self.OnTaskBarActivate) |
164 | | wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \ |
165 | | self.OnTaskBarClose) |
166 | | self.menu = wxPython.wx.wxMenu() |
167 | | self.menu.Append(self.TBMENU_RESTORE, _("Show Print Quota")) |
168 | | self.menu.Append(self.TBMENU_CLOSE, _("Quit")) |
169 | | |
| 152 | # try : |
| 153 | # self.tbicon = wxPython.wx.wxTaskBarIcon() |
| 154 | # except AttributeError : |
| 155 | # self.tbicon = None # No taskbar icon facility, old wxWidgets maybe |
| 156 | # |
| 157 | # self.greenicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-green.ico"), \ |
| 158 | # wxPython.wx.wxBITMAP_TYPE_ICO) |
| 159 | # self.redicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-red.ico"), \ |
| 160 | # wxPython.wx.wxBITMAP_TYPE_ICO) |
| 161 | # |
| 162 | # self.SetIcon(self.greenicon) |
| 163 | # if self.tbicon is not None : |
| 164 | # self.tbicon.SetIcon(self.greenicon, "PyKotIcon") |
| 165 | # wxPython.wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) |
| 166 | # wxPython.wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) |
| 167 | # |
| 168 | # self.TBMENU_RESTORE = wx.NewId() |
| 169 | # self.TBMENU_CLOSE = wx.NewId() |
| 170 | # wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \ |
| 171 | # self.OnTaskBarActivate) |
| 172 | # wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \ |
| 173 | # self.OnTaskBarClose) |
| 174 | # self.menu = wxPython.wx.wxMenu() |
| 175 | # self.menu.Append(self.TBMENU_RESTORE, _("Show Print Quota")) |
| 176 | # self.menu.Append(self.TBMENU_CLOSE, _("Quit")) |
| 177 | # |
| 228 | |
| 229 | def askConfirmation(self, printername, username, jobid, jobtitle, jobsize) : |
| 230 | """Asks for confirmation before printing.""" |
| 231 | message = _("""Hello %(username)s, |
| 232 | |
| 233 | You sent job %(jobid)s (%(jobtitle)s) to printer %(printername)s. |
| 234 | |
| 235 | This job seems to be %(jobsize)s pages long. |
| 236 | |
| 237 | Please confirm or cancel.""") % locals() |
| 238 | |
| 239 | dialog = wx.MessageDialog(self, message, _("Confirmation"), wx.OK | wx.CANCEL) |
| 240 | self.askConfirmationResult = dialog.ShowModal() |
| 241 | dialog.Destroy() |