[X2Go-Commits] pyhoca-gui.git - build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d (branch) updated: 0.0.29.0-38-gc7f2129

X2Go dev team git-admin at x2go.org
Tue Aug 27 13:21:15 CEST 2013


The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated
       via  c7f21295a90c5ad7d53a00359ef35186403d2fb2 (commit)
      from  d444350f168b5ad8dd5d49338d1cb14873738478 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 pyhoca/wxgui/printingprefs.py |  133 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 122 insertions(+), 11 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/printingprefs.py b/pyhoca/wxgui/printingprefs.py
index c4724bf..d5ff9c9 100644
--- a/pyhoca/wxgui/printingprefs.py
+++ b/pyhoca/wxgui/printingprefs.py
@@ -49,14 +49,14 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
         wx.Dialog.__init__(self, None, -1, style=wx.DEFAULT_DIALOG_STYLE, )
 
         self._availablePrintActions = {
-            'PDFVIEW': _(u'Open with PDF Viewer'),
+            'PDFVIEW': _(u'Open with PDF viewer'),
             'PDFSAVE': _(u'Save to a local folder'),
-            'PRINT': _(u'Print to a local Printer'),
-            'PRINTCMD': _(u'Run Custom Print Command'),
-            'DIALOG': _(u'Open this Dialog Window'),
+            'PRINT': _(u'Print to a local printer'),
+            'PRINTCMD': _(u'Run custom print command'),
+            'DIALOG': _(u'Open this dialog window'),
             }
         if self.mode != 'edit':
-            self._availablePrintActions['DIALOG'] = _(u'<Select a Print Action here>')
+            self._availablePrintActions['DIALOG'] = _(u'<Select a print action here>')
 
         self.client_printing = self._PyHocaGUI.client_printing
 
@@ -69,6 +69,33 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
             self.PrintActionLabel = wx.StaticText(self, -1, _(u"Default action for incoming print jobs")+':')
         self.PrintAction = wx.ComboBox(self, -1, choices=self._availablePrintActions.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY)
 
+        # widgets for print action PDFVIEW
+        self.PdfViewCmdLabel = wx.StaticText(self, -1, _(u'PDF viewer command') + ':', )
+        self.PdfViewCmd = wx.TextCtrl(self, -1, '', )
+        self.PdfViewCmdBrowseButton = wx.BitmapButton(self, -1, 
+                                                      wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY)
+                                                     )
+
+        # widgets for print action PDFSAVE
+        self.PdfSaveToFolderLabel = wx.StaticText(self, -1, _(u'Save PDFs to folder') + ':', )
+        self.PdfSaveToFolder = wx.TextCtrl(self, -1, '', )
+        self.PdfSaveToFolderBrowseButton = wx.BitmapButton(self, -1, 
+                                                           wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY)
+                                                          )
+
+        # widgets for print action PRINT
+        _printer_list = []
+        if X2GOCLIENT_OS == 'Windows':
+            pass
+        else:
+            pass
+        self.PrintPrinterLabel = wx.StaticText(self, -1, _(u'Use this printer') + ':', )
+        self.PrintPrinter = wx.ComboBox(self, -1, choices=_printer_list, style=wx.CB_DROPDOWN|wx.CB_READONLY)
+
+        # widgets for print action PRINTCMD
+        self.PrintCmdLabel = wx.StaticText(self, -1, _(u'Custom print command') + ':', )
+        self.PrintCmd = wx.TextCtrl(self, -1, '', )
+
         if self.mode == 'edit':
             self.OKButton = wx.Button(self, -1, _(u"Save"))
         else:
@@ -80,6 +107,8 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
         self.__update_fields()
         self.__do_layout()
 
+        self.Bind(wx.EVT_COMBOBOX, self.OnPrintActionChange, self.PrintAction)
+
         self.Bind(wx.EVT_BUTTON, self.OnOKButton, self.OKButton)
         self.Bind(wx.EVT_BUTTON, self.OnCancel, self.CancelButton)
 
@@ -95,12 +124,33 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
     def __do_layout(self):
 
         sizer_1 = wx.BoxSizer(wx.VERTICAL)
-        sizer_1_1 = wx.BoxSizer(wx.VERTICAL)
+        sizer_1_1 = wx.GridBagSizer(hgap=2, vgap=5)
+        sizer_1_1.Add(self.PrintActionLabel, pos=(0,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=7)
+        sizer_1_1.Add(self.PrintAction, pos=(0,1), )
+
+        sizer_1_1.Add(self.PdfViewCmdLabel, pos=(1,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=7)
         sizer_1_1_1 = wx.BoxSizer(wx.HORIZONTAL)
-        sizer_1_1_1.Add(self.PrintActionLabel, flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=7)
-        sizer_1_1_1.Add(self.PrintAction)
-        sizer_1_1.Add(sizer_1_1_1, flag=wx.BOTTOM, border=5)
+        sizer_1_1_1.Add(self.PdfViewCmd, proportion=1, flag=wx.EXPAND|wx.RIGHT, border=7, )
+        sizer_1_1_1.Add(self.PdfViewCmdBrowseButton, )
+        sizer_1_1.Add(sizer_1_1_1, pos=(1,1), flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, )
+
+        sizer_1_1.Add(self.PdfSaveToFolderLabel, pos=(2,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=7, )
+        sizer_1_1_2 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_1_1_2.Add(self.PdfSaveToFolder, proportion=1, flag=wx.EXPAND|wx.RIGHT, border=7, )
+        sizer_1_1_2.Add(self.PdfSaveToFolderBrowseButton, )
+        sizer_1_1.Add(sizer_1_1_2, pos=(2,1), flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, )
+
+        sizer_1_1.Add(self.PrintPrinterLabel, pos=(3,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=7, )
+        sizer_1_1_3 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_1_1_3.Add(self.PrintPrinter, proportion=1, flag=wx.EXPAND, )
+        sizer_1_1.Add(sizer_1_1_3, pos=(3,1), flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, )
+
+        sizer_1_1.Add(self.PrintCmdLabel, pos=(4,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=7, )
+        sizer_1_1_4 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_1_1_4.Add(self.PrintCmd, proportion=1, flag=wx.EXPAND, )
+        sizer_1_1.Add(sizer_1_1_4, pos=(4,1), flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, )
         sizer_1.Add(sizer_1_1, flag=wx.EXPAND|wx.ALL, border=10)
+
         # the bottom area with OK and Cancel buttons
         sizer_B = wx.BoxSizer(wx.HORIZONTAL)
         sizer_B.Add(self.OKButton, flag=wx.ALL, border=5)
@@ -123,9 +173,69 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
             self.PrintAction.SetValue(self._availablePrintActions[print_action_name])
         else:
             self.PrintAction.SetValue(print_action_name)
+        self._onPrintActionChange()
 
     def __update_from_screen(self):
-        pass
+        kwargs = {
+            'pdfview_cmd': self.PdfViewCmd.GetValue(),
+            'save_to_folder': self.PdfSaveToFolder.GetValue(),
+            'printer': self.PrintPrinter.GetValue(),
+            'print_cmd': self.PrintCmd.GetValue(),
+        }
+        self.client_printing.set_print_action(self._print_action, **kwargs)
+
+    @property
+    def _print_action(self):
+        return [ p for p in self._availablePrintActions.keys() if self._availablePrintActions[p] == self.PrintAction.GetValue() ][0]
+
+    def _onPrintActionChange(self):
+        if self._print_action == 'PDFVIEW':
+            self.PdfViewSelected()
+        elif self._print_action == 'PDFSAVE':
+            self.PdfSaveToFolderSelected()
+        elif self._print_action == 'PRINT':
+            self.PrintPrinterSelected()
+        elif self._print_action == 'PRINTCMD':
+            self.PrintCmdSelected()
+        else:
+            self._disable_PrintOptions()
+
+    def OnPrintActionChange(self, evt):
+        self._onPrintActionChange()
+
+    def _disable_PrintOptions(self):
+        self.PdfViewCmdLabel.Enable(False)
+        self.PdfViewCmd.Enable(False)
+        self.PdfViewCmdBrowseButton.Enable(False)
+        self.PdfSaveToFolderLabel.Enable(False)
+        self.PdfSaveToFolder.Enable(False)
+        self.PdfSaveToFolderBrowseButton.Enable(False)
+        self.PrintPrinterLabel.Enable(False)
+        self.PrintPrinter.Enable(False)
+        self.PrintCmdLabel.Enable(False)
+        self.PrintCmd.Enable(False)
+
+    def PdfViewSelected(self):
+        self._disable_PrintOptions()
+        self.PdfViewCmdLabel.Enable(True)
+        self.PdfViewCmd.Enable(True)
+        self.PdfViewCmdBrowseButton.Enable(True)
+
+    def PdfSaveToFolderSelected(self):
+        self._disable_PrintOptions()
+        self.PdfSaveToFolderLabel.Enable(True)
+        self.PdfSaveToFolder.Enable(True)
+        self.PdfSaveToFolderBrowseButton.Enable(True)
+
+    def PrintPrinterSelected(self):
+        self._disable_PrintOptions()
+        self.PrintPrinterLabel.Enable(True)
+        self.PrintPrinter.Enable(True)
+
+    def PrintCmdSelected(self):
+        self._disable_PrintOptions()
+        self.PrintCmdLabel.Enable(True)
+        self.PrintCmd.Enable(True)
 
     def __validate(self):
         validateOk = True
@@ -135,7 +245,7 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
         wx.BeginBusyCursor()
         self.__update_from_screen()
         if self.__validate():
-            pass
+            self.client_printing.write()
 
             wx.EndBusyCursor()
             self.Close()
@@ -144,6 +254,7 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog):
             wx.EndBusyCursor()
 
     def OnCancel(self, event):
+        self.client_printing.load()
         self.Close()
         self.Destroy()
 


hooks/post-receive
-- 
pyhoca-gui.git (Python X2Go Client (wxPython GUI))

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).




More information about the x2go-commits mailing list