The branch, twofactorauth has been updated via 37e42dd89f9a033ae45c8a2920e3899d8013a882 (commit) from 78580340d5e68ba25c2a7366c2f5fc709bbe6264 (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: x2go/backends/printing/_file.py | 8 ++++---- x2go/client.py | 4 +++- x2go/printactions.py | 24 +++++++++++++++++++----- x2go/printqueue.py | 4 ++-- x2go/xserver.py | 9 ++++++--- 5 files changed, 34 insertions(+), 15 deletions(-) The diff of changes is: diff --git a/x2go/backends/printing/_file.py b/x2go/backends/printing/_file.py index 2497520..17c908c 100644 --- a/x2go/backends/printing/_file.py +++ b/x2go/backends/printing/_file.py @@ -95,18 +95,18 @@ class X2goClientPrintingFILE(inifiles.X2goIniFile): elif _general_pdfview and _view_open: _view_command = self.get('view', 'command') - self._print_action = printactions.X2goPrintActionPDFVIEW(pdfview_cmd=_view_command, logger=self.logger) + self._print_action = printactions.X2goPrintActionPDFVIEW(client_instance=self.client_instance, pdfview_cmd=_view_command, logger=self.logger) elif _general_pdfview and not _view_open: - self._print_action = printactions.X2goPrintActionPDFSAVE(logger=self.logger) + self._print_action = printactions.X2goPrintActionPDFSAVE(client_instance=self.client_instance, logger=self.logger) elif not _general_pdfview and not _print_startcmd: _cups_defaultprinter = self.get('CUPS', 'defaultprinter') - self._print_action = printactions.X2goPrintActionPRINT(printer=_cups_defaultprinter, logger=self.logger) + self._print_action = printactions.X2goPrintActionPRINT(client_instance=self.client_instance, printer=_cups_defaultprinter, logger=self.logger) elif not _general_pdfview and _print_startcmd: _print_command = self.get('print', 'command') - self._print_action = printactions.X2goPrintActionPRINTCMD(print_cmd=_print_command, logger=self.logger) + self._print_action = printactions.X2goPrintActionPRINTCMD(client_instance=self.client_instance, print_cmd=_print_command, logger=self.logger) @property def print_action(self): diff --git a/x2go/client.py b/x2go/client.py index 846f50f..f6e196c 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -276,7 +276,9 @@ class X2goClient(object): def HOOK_no_known_xserver_found(self): self.logger('the Python X2go module could not find any usable XServer application, you will not be able to start X2go sessions without XServer', loglevel=log.loglevel_WARN) def HOOK_open_print_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN'): - self.logger('HOOK_open_print_dialog: incoming print job,, %s'' detected by X2goClient hook method' % filename, loglevel=log.loglevel_WARN) + self.logger('HOOK_open_print_dialog: incoming print job ,, %s'' detected by X2goClient hook method' % filename, loglevel=log.loglevel_WARN) + def HOOK_printaction_error(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN', err_msg='GENERIC_ERROR') + self.logger('HOOK_printaction_error: incoming print job ,, %s'' caused error: %s' % (filename, err_msg), loglevel=log.loglevel_ERROR) def HOOK_on_control_session_death(self, profile_name): self.logger('HOOK_on_control_session_death: the control session of profile %s has died unexpectedly' % profile_name, loglevel=log.loglevel_WARN) diff --git a/x2go/printactions.py b/x2go/printactions.py index b171b52..877b5aa 100644 --- a/x2go/printactions.py +++ b/x2go/printactions.py @@ -136,7 +136,7 @@ class X2goPrintActionPDFVIEW(X2goPrintAction): pdfview_cmd = None - def __init__(self, pdfview_cmd=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, client_instance=None, pdfview_cmd=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @param pdfview_cmd: command that starts the external PDF viewer application @type pdfview_cmd: C{str} @@ -151,6 +151,7 @@ class X2goPrintActionPDFVIEW(X2goPrintAction): if pdfview_cmd is None: pdfview_cmd = defaults.DEFAULT_PDFVIEW_CMD self.pdfview_cmd = pdfview_cmd + self.client_instance = client_instance X2goPrintAction.__init__(self, logger=logger, loglevel=loglevel) def do_print(self, pdf_file, job_title, spool_dir, ): @@ -169,7 +170,17 @@ class X2goPrintActionPDFVIEW(X2goPrintAction): shutil.copy2(pdf_file, _hr_filename) if sys.platform == "win32": self.logger('printing incoming job with Python\'s os.startfile(): %s' % pdf_file, loglevel=log.loglevel_DEBUG) - os.startfile(_hr_filename) + try: + os.startfile(_hr_filename) + except WindowsError, win_err: + if self.client_instance: + self.HOOK_printaction_error(_hr_filename, + profile_name=self.profile_name, + session_name=self.session_name, + err_msg=str(win_err) + ) + else: + self.logger('Encountered WindowsError: %s' % str(win_err), loglevel=log.loglevel_ERROR) else: cmd_line = [ self.pdfview_cmd, _hr_filename, ] self.logger('printing incoming job with command: %s' % ' '.join(cmd_line), loglevel=log.loglevel_DEBUG) @@ -190,7 +201,7 @@ class X2goPrintActionPDFSAVE(X2goPrintAction): save_to_folder = None - def __init__(self, save_to_folder=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, client_instance=None, save_to_folder=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @param save_to_folder: saving location for incoming print jobs (PDF files) @type save_to_folder: C{str} @@ -205,6 +216,7 @@ class X2goPrintActionPDFSAVE(X2goPrintAction): if save_to_folder is None: save_to_folder = os.path.expanduser(defaults.DEFAULT_PDFSAVE_LOCATION) self.save_to_folder = save_to_folder + self.client_instance = client_instance X2goPrintAction.__init__(self, logger=None, loglevel=loglevel) def do_print(self, pdf_file, job_title, spool_dir): @@ -234,7 +246,7 @@ class X2goPrintActionPRINT(X2goPrintAction): __name__ = 'PRINT' __decription__= 'UNIX/Win32GDI printing' - def __init__(self, printer=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, client_instance=None, printer=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @param printer: name of the preferred printer, if C{None} the system's/user's default printer will be used @type printer: C{str} @@ -247,6 +259,7 @@ class X2goPrintActionPRINT(X2goPrintAction): """ self.printer = printer + self.client_instance = client_instance X2goPrintAction.__init__(self, logger=logger, loglevel=loglevel) def do_print(self, pdf_file, job_title, spool_dir, ): @@ -307,7 +320,7 @@ class X2goPrintActionPRINTCMD(X2goPrintAction): __name__ = 'PRINTCMD' __decription__= 'Print via a command (like LPR)' - def __init__(self, print_cmd=None, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, client_instance=None, print_cmd=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @param print_cmd: external command to be called on incoming print jobs @type print_cmd: C{str} @@ -321,6 +334,7 @@ class X2goPrintActionPRINTCMD(X2goPrintAction): """ if print_cmd is None: print_cmd = defaults.DEFAULT_PRINTCMD_CMD + self.client_instance = client_instance self.print_cmd = print_cmd X2goPrintAction.__init__(self, logger=logger, loglevel=loglevel) diff --git a/x2go/printqueue.py b/x2go/printqueue.py index 9d2f250..1553a87 100644 --- a/x2go/printqueue.py +++ b/x2go/printqueue.py @@ -221,8 +221,8 @@ def x2go_printjob_handler(job_file=None, pdf_file=None, job_title=None, print_ac ) print_action = _printing.print_action - print_action.profile_name = parent_thread.profile_name - print_action.session_name = parent_thread.session_name + print_action.profile_name = parent_thread.profile_name + print_action.session_name = parent_thread.session_name logger('action for printing is: %s' % print_action, loglevel=log.loglevel_DEBUG) print_action.do_print(pdf_file=os.path.join(parent_thread.spool_dir, pdf_file), diff --git a/x2go/xserver.py b/x2go/xserver.py index ddf5458..2e92a63 100644 --- a/x2go/xserver.py +++ b/x2go/xserver.py @@ -197,8 +197,11 @@ class X2goXServer(threading.Thread): while self._keepalive: gevent.sleep(1) self.logger('terminating running XServer ,,%s\'\'' % self.xserver_name, loglevel=log.loglevel_DEBUG) - p.terminate() - + try: + p.terminate() + except WindowsError: + pass + def stop_thread(self): """\ STILL UNDOCUMENTED @@ -206,4 +209,4 @@ class X2goXServer(threading.Thread): """ self.logger('stop_thread() method has been called', loglevel=log.loglevel_DEBUG) self._keepalive = False - + hooks/post-receive -- python-x2go.git (Python X2Go Client API) 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 "python-x2go.git" (Python X2Go Client API).