[X2Go-Commits] python-x2go.git - build-baikal (branch) updated: 0.0.42.0-1-g6fa4503
X2Go dev team
git-admin at x2go.org
Wed Jan 8 15:30:16 CET 2014
The branch, build-baikal has been updated
via 6fa45031b5d85c49e78bfcd86bf429ff1da06311 (commit)
from 46ec399f2b03d2bff3309380251fc581d91be8f0 (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/terminal/_stdout.py | 48 ++---
x2go/client.py | 12 +-
x2go/defaults.py | 20 +-
x2go/dropbox.py | 267 -------------------------
x2go/mimebox.py | 267 +++++++++++++++++++++++++
x2go/{dropboxactions.py => mimeboxactions.py} | 134 ++++++-------
x2go/session.py | 35 ++--
x2go/utils.py | 14 +-
8 files changed, 398 insertions(+), 399 deletions(-)
delete mode 100644 x2go/dropbox.py
create mode 100644 x2go/mimebox.py
rename x2go/{dropboxactions.py => mimeboxactions.py} (58%)
The diff of changes is:
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 7234c86..84076c1 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -40,7 +40,7 @@ import copy
import x2go.rforward as rforward
import x2go.sftpserver as sftpserver
import x2go.printqueue as printqueue
-import x2go.dropbox as dropbox
+import x2go.mimebox as mimebox
import x2go.log as log
import x2go.defaults as defaults
import x2go.utils as utils
@@ -517,47 +517,47 @@ class X2goTerminalSessionSTDOUT(object):
"""
return '%s/%s' % (self.session_info.remote_container, 'spool')
- def start_dropbox(self, dropbox_extensions=[], dropbox_action=None):
+ def start_mimebox(self, mimebox_extensions=[], mimebox_action=None):
"""\
- Initialize X2go dropbox handling.
+ Initialize X2go mimebox handling.
"""
- dropbox_dir = os.path.join(self.session_info.local_container, 'dropbox')
- if not os.path.exists(dropbox_dir):
- os.mkdir(dropbox_dir)
- self.share_local_folder(folder_name=dropbox_dir, folder_type='dropbox')
- self.dropbox_queue = dropbox.X2goDropboxQueue(profile_name=self.profile_name,
+ mimebox_dir = os.path.join(self.session_info.local_container, 'mimebox')
+ if not os.path.exists(mimebox_dir):
+ os.mkdir(mimebox_dir)
+ self.share_local_folder(folder_name=mimebox_dir, folder_type='mimebox')
+ self.mimebox_queue = mimebox.X2goMIMEboxQueue(profile_name=self.profile_name,
session_name=self.session_info.name,
- dropbox_dir=dropbox_dir,
- dropbox_extensions=dropbox_extensions,
- dropbox_action=dropbox_action,
+ mimebox_dir=mimebox_dir,
+ mimebox_extensions=mimebox_extensions,
+ mimebox_action=mimebox_action,
client_instance=self.client_instance,
logger=self.logger,
)
- self.dropbox_queue.start()
- self.active_threads.append(self.dropbox_queue)
+ self.mimebox_queue.start()
+ self.active_threads.append(self.mimebox_queue)
- def set_dropbox_action(self, dropbox_action, **kwargs):
+ def set_mimebox_action(self, mimebox_action, **kwargs):
"""\
STILL UNDOCUMENTED
"""
- self.dropbox_queue.set_dropbox_action(dropbox_action, logger=self.logger, **kwargs)
+ self.mimebox_queue.set_mimebox_action(mimebox_action, logger=self.logger, **kwargs)
- def stop_dropbox(self):
+ def stop_mimebox(self):
"""\
- Shutdown (pause) the X2go Dropbox Queue thread.
+ Shutdown (pause) the X2go MIME box Queue thread.
"""
- if self.dropbox_queue is not None:
- self.dropbox_queue.pause()
+ if self.mimebox_queue is not None:
+ self.mimebox_queue.pause()
- def get_dropbox_spooldir(self):
+ def get_mimebox_spooldir(self):
"""\
- Return the server-side dropbox spooldir path.
+ Return the server-side mimebox spooldir path.
"""
- return '%s/%s' % (self.session_info.remote_container, 'dropbox')
+ return '%s/%s' % (self.session_info.remote_container, 'mimebox')
def share_local_folder(self, folder_name=None, folder_type='disk'):
"""\
@@ -646,7 +646,7 @@ class X2goTerminalSessionSTDOUT(object):
'rm -f %s %s.ident' % (_x2go_key_fname, _x2go_key_fname),
]
- elif folder_type == 'dropbox':
+ elif folder_type == 'mimebox':
cmd_line = [ '%s export HOSTNAME &&' % export_iconv_settings,
'x2gomountdirs',
@@ -654,7 +654,7 @@ class X2goTerminalSessionSTDOUT(object):
str(self.session_info.name),
_CURRENT_LOCAL_USER,
_x2go_key_fname,
- '%s__DROPBOX_SPOOL___REVERSESSH_PORT__%s; ' % (folder_name, self.session_info.sshfs_port),
+ '%s__MIMEBOX_SPOOL___REVERSESSH_PORT__%s; ' % (folder_name, self.session_info.sshfs_port),
'rm -f %s %s.ident' % (_x2go_key_fname, _x2go_key_fname),
]
diff --git a/x2go/client.py b/x2go/client.py
index d171aa8..5149014 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -291,8 +291,8 @@ class X2goClient(object):
def HOOK_no_such_command(self, cmd, profile_name='UNKNOWN', session_name='UNKNOWN'):
self.logger('HOOK_no_such_command: the command %s is not available for X2go server (profile: %s, session: %s)' % (cmd, profile_name, session_name), loglevel=log.loglevel_WARN)
- def HOOK_open_dropbox_saveas_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN'):
- self.logger('HOOK_open_dropbox_saveas_dialog: incoming dropbox job ,, %s'' detected by X2goClient hook method' % filename, loglevel=log.loglevel_WARN)
+ def HOOK_open_mimebox_saveas_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN'):
+ self.logger('HOOK_open_mimebox_saveas_dialog: incoming MIME box 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', printer=None):
if printer:
@@ -489,7 +489,7 @@ class X2goClient(object):
def register_session(self, server=None, profile_id=None, profile_name=None, session_name=None,
allow_printing=False,
allow_share_local_folders=False, share_local_folders=[],
- allow_dropbox=False, dropbox_extensions=[], dropbox_action='OPEN',
+ allow_mimebox=False, mimebox_extensions=[], mimebox_action='OPEN',
add_to_known_hosts=False, known_hosts=None,
return_object=False, **kwargs):
"""\
@@ -581,9 +581,9 @@ class X2goClient(object):
_params['printing'] = printing
_params['allow_share_local_folders'] = allow_share_local_folders
_params['share_local_folders'] = share_local_folders
- _params['allow_dropbox'] = allow_dropbox
- _params['dropbox_extensions'] = dropbox_extensions
- _params['dropbox_action'] = dropbox_action
+ _params['allow_mimebox'] = allow_mimebox
+ _params['mimebox_extensions'] = mimebox_extensions
+ _params['mimebox_action'] = mimebox_action
_params['client_instance'] = self
session_uuid = self.session_registry.register(server=server,
diff --git a/x2go/defaults.py b/x2go/defaults.py
index 7946511..93b14e1 100644
--- a/x2go/defaults.py
+++ b/x2go/defaults.py
@@ -51,7 +51,7 @@ if X2GOCLIENT_OS == "Windows":
SUPPORTED_SOUND = True
SUPPORTED_PRINTING = True
SUPPORTED_FOLDERSHARING = True
- SUPPORTED_DROPBOX = True
+ SUPPORTED_MIMEBOX = True
elif X2GOCLIENT_OS == "Linux":
ROOT_DIR = '/'
@@ -62,7 +62,7 @@ elif X2GOCLIENT_OS == "Linux":
SUPPORTED_SOUND = True
SUPPORTED_PRINTING = True
SUPPORTED_FOLDERSHARING = True
- SUPPORTED_DROPBOX = True
+ SUPPORTED_MIMEBOX = True
elif X2GOCLIENT_OS == "Mac":
ROOT_DIR = '/'
@@ -73,7 +73,7 @@ elif X2GOCLIENT_OS == "Mac":
SUPPORTED_SOUND = True
SUPPORTED_PRINTING = True
SUPPORTED_FOLDERSHARING = True
- SUPPORTED_DROPBOX = True
+ SUPPORTED_MIMEBOX = True
else:
import exceptions
@@ -263,7 +263,7 @@ X2GO_SESSIONPROFILE_DEFAULTS = {
'iconvto': 'UTF-8', 'iconvfrom': 'UTF-8', 'useiconv': False,
'usesshproxy': False, 'sshproxyhost': '', 'sshproxyuser': '', 'sshproxytunnel': '', 'sshproxykeyfile': '',
'useexports': True, 'fstunnel': True, 'export': '',
- 'usedropbox': False, 'dropboxextensions': '', 'dropboxaction': 'OPEN',
+ 'usemimebox': False, 'mimeboxextensions': '', 'mimeboxaction': 'OPEN',
'fullscreen': False,
'width': 800,'height': 600,'dpi': 96,'setdpi': False,
'usekbd':True, 'layout': 'us', 'type': 'pc105/us',
@@ -369,14 +369,14 @@ DEFAULT_PDFSAVE_LOCATION = 'PDF'
DEFAULT_PRINTCMD_CMD = 'lpr'
"""Default command for the PRINTCMD print action."""
-X2GO_DROPBOX_ACTIONS = {
- 'OPEN': 'X2goDropboxActionOPEN',
- 'OPENWITH': 'X2goDropboxActionOPENWITH',
- 'SAVEAS': 'X2goDropboxActionSAVEAS',
+X2GO_MIMEBOX_ACTIONS = {
+ 'OPEN': 'X2goMIMEboxActionOPEN',
+ 'OPENWITH': 'X2goMIMEboxActionOPENWITH',
+ 'SAVEAS': 'X2goMIMEboxActionSAVEAS',
}
-"""Relating dropbox action names and classes."""
+"""Relating MIME box action names and classes."""
-X2GO_DROPBOX_EXTENSIONS_BLACKLIST = [
+X2GO_MIMEBOX_EXTENSIONS_BLACKLIST = [
'LOCK', 'SYS', 'SWP',
'EXE', 'COM', 'CMD', 'PS1', 'PS2', 'BAT',
'JS', 'PY', 'PL', 'SH',
diff --git a/x2go/dropbox.py b/x2go/dropbox.py
deleted file mode 100644
index 1169056..0000000
--- a/x2go/dropbox.py
+++ /dev/null
@@ -1,267 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2010-2011 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-#
-# Python X2go is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Python X2go is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-L{X2goDropboxQueue} sets up a thread that listens for incoming files that
-shall be opened locally on the client.
-
-For each file that gets dropped in the drop-box an individual
-thread is started (L{X2goDropboxJob}) that handles the processing
-of the incoming file.
-
-"""
-__NAME__ = 'x2godropboxqueue-pylib'
-
-# modules
-import os
-import copy
-import types
-import threading
-import gevent
-
-# Python X2go modules
-import defaults
-import utils
-import log
-import dropboxactions
-
-if defaults.X2GOCLIENT_OS != 'Windows':
- from x2go_exceptions import WindowsError
-
-
-class X2goDropboxQueue(threading.Thread):
- """\
- If the X2go drop-box is supported in a particaluar L{X2goSession} instance
- this class provides a sub-thread for handling incoming files in the drop-box
- directory. The actual handling of a dropped file is handled by the classes
- L{X2goDropboxActionOPEN}, L{X2goDropboxActionOPENWITH} and L{X2goDropboxActionSAVEAS}.
-
- """
- dropbox_action = None
-
- dropbox = None
- active_jobs = {}
- dropbox_history = []
-
- def __init__(self, profile_name='UNKNOWN', session_name='UNKNOWN',
- dropbox_dir=None, dropbox_action=None, dropbox_extensions=[],
- client_instance=None, logger=None, loglevel=log.loglevel_DEFAULT):
- """\
- @param profile_name: name of the session profile this print queue belongs to
- @type profile_name: C{str}
- @param dropbox_dir: local directory for incoming dropbox files
- @type dropbox_dir: C{str}
- @param dropbox_action: name or instance of either of the possible X2go print action classes
- @type dropbox_action: C{str} or instance
- @param client_instance: the underlying L{X2goClient} instance
- @type client_instance: C{instance}
- @param logger: you can pass an L{X2goLogger} object to the
- L{X2goPrintQueue} constructor
- @type logger: C{instance}
- @param loglevel: if no L{X2goLogger} object has been supplied a new one will be
- constructed with the given loglevel
- @type loglevel: C{int}
-
- """
- if logger is None:
- self.logger = log.X2goLogger(loglevel=loglevel)
- else:
- self.logger = copy.deepcopy(logger)
- self.logger.tag = __NAME__
-
- self.profile_name = profile_name
- self.session_name = session_name
- self.dropbox_dir = dropbox_dir
- self.dropbox_extensions = dropbox_extensions
- self.client_instance = client_instance
- self.client_rootdir = client_instance.get_client_rootdir()
-
- if dropbox_action is None:
- dropbox_action = dropbox_actions.X2goDropboxActionOPEN(client_instance=self.client_instance, logger=self.logger, **dropbox_action_args)
- elif type(dropbox_action) in (types.StringType, types.UnicodeType):
- dropbox_action = self.set_dropbox_action(dropbox_action)
- else:
- # hope it's already an instance...
- self.dropbox_action = dropbox_action
-
- threading.Thread.__init__(self)
- self.daemon = True
- self._accept_jobs = True
-
- def __del__(self):
- self.stop_thread()
-
- def pause(self):
- """\
- Prevent acceptance of new incoming files. The processing of dropbox jobs that
- are currently still active will be completed, though.
-
- """
- if self._accept_jobs == True:
- self._accept_jobs = False
- self.logger('paused thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
-
- def resume(self):
- """\
- Resume operation of the X2go dropbox queue and continue accepting new incoming
- files.
-
- """
- if self._accept_jobs == False:
- self._accept_jobs = True
- self.logger('resumed thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
-
- def stop_thread(self):
- """\
- Stops this L{X2goDropboxQueue} thread completely.
-
- """
- self.pause()
- self._keepalive = False
- self.logger('stopping thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
-
- @property
- def _incoming_dropbox_jobs(self):
- if os.path.exists(self.dropbox_dir):
- l = os.listdir(self.dropbox_dir)
- dropbox_jobs = []
- for _ext in self.dropbox_extensions:
- dropbox_jobs.extend([ dj for dj in l if dj.upper().endswith(_ext.upper()) ])
- else:
- dropbox_jobs = l
- return [ dj for dj in dropbox_jobs if dj not in self.active_jobs.keys() ]
- else:
- return []
-
- def set_dropbox_action(self, dropbox_action, **kwargs):
- """\
- Modify the dropbox action of this L{X2goDropboxQueue} thread during runtime. The
- change of the dropbox action will be valid for the next incoming file in the dropbox
- directory.
-
- """
- if dropbox_action in defaults.X2GO_DROPBOX_ACTIONS.keys():
- dropbox_action = defaults.X2GO_DROPBOX_ACTIONS[dropbox_action]
-
- if dropbox_action in defaults.X2GO_DROPBOX_ACTIONS.values():
- self.dropbox_action = eval ('dropboxactions.%s(**kwargs)' % dropbox_action)
-
- def run(self):
- """\
- Start this L{X2goDropboxQueue} thread...
-
- """
- self.logger('starting dropbox queue thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
-
- self._keepalive = True
- while self._keepalive:
-
- while self._accept_jobs:
-
- if self._incoming_dropbox_jobs:
-
- for _job in self._incoming_dropbox_jobs:
- self.logger('processing incoming X2go dropbox job: %s' % _job, loglevel=log.loglevel_NOTICE)
- _new_dropboxjob_thread = X2goDropboxJob(target=x2go_dropboxjob_handler,
- kwargs={
- 'dropbox_file': _job,
- 'dropbox_extensions': self.dropbox_extensions,
- 'dropbox_action': self.dropbox_action,
- 'parent_thread': self,
- 'logger': self.logger,
- }
- )
- self.active_jobs['%s' % _job] = _new_dropboxjob_thread
- _new_dropboxjob_thread.start()
-
- gevent.sleep(3)
-
- gevent.sleep(1)
-
-
-def x2go_dropboxjob_handler(dropbox_file=None,
- dropbox_extensions=[],
- dropbox_action=None,
- parent_thread=None, logger=None, ):
- """\
- This function is called as a handler function for each incoming X2go dropbox file
- represented by the class L{X2goDropboxJob}.
-
- @param dropbox_file: dropbox file name as placed in to the X2go dropbox spool directory
- @type dropbox_file: C{str}
- @param dropbox_action: an instance of either of the possible C{X2goDropboxActionXXX} classes
- @type dropbox_action: C{X2goDropboxActionXXX} nstance
- @param parent_thread: the L{X2goDropboxQueue} thread that actually created this handler's L{X2goDropboxJob} instance
- @type parent_thread: C{instance}
- @param logger: the L{X2goDropboxQueue}'s logging instance
- @type logger: C{instance}
-
- """
- dropbox_action.profile_name = parent_thread.profile_name
- dropbox_action.session_name = parent_thread.session_name
-
- logger('action for printing is: %s' % dropbox_action, loglevel=log.loglevel_DEBUG)
-
- _dotfile = dropbox_file.startswith('.')
- _blacklisted = dropbox_file.upper().split('.')[-1] in defaults.X2GO_DROPBOX_EXTENSIONS_BLACKLIST
- _really_process = bool(not _blacklisted and ((not dropbox_extensions) or [ ext for ext in dropbox_extensions if dropbox_file.upper().endswith('%s' % ext.upper()) ]))
- if _really_process and not _blacklisted and not _dotfile:
- dropbox_action.do_process(dropbox_file=dropbox_file,
- dropbox_dir=parent_thread.dropbox_dir,
- )
- elif not _blacklisted and not _dotfile:
- logger('file extension of dropbox file %s is prohibited by session profile configuration' % dropbox_file, loglevel=log.loglevel_NOTICE)
- elif _dotfile:
- logger('placing files starting with a dot (.<file>) into the X2go dropbox is prohibited, ignoring the file ,,%s\'\'' % dropbox_file, loglevel=log.loglevel_WARN)
- else:
- logger('file extension of dropbox file %s has been found in Python X2go\' hardcoded dropbox extenstions blacklist' % dropbox_file, loglevel=log.loglevel_WARN)
-
- logger('removing dropbox file %s' % dropbox_file, loglevel=log.loglevel_DEBUG)
-
- utils.patiently_remove_file(parent_thread.dropbox_dir, dropbox_file)
- logger('removed print job file %s' % dropbox_file, loglevel=log.loglevel_DEBUG)
-
- del parent_thread.active_jobs['%s' % dropbox_file]
- parent_thread.dropbox_history.append(dropbox_file)
- # in case we do a lot of dropbox file exports we do not want to risk an
- # endlessly growing dropbox job history
- if len(parent_thread.dropbox_history) > 100:
- parent_thread.dropbox_history = parent_thread.dropbox_history[-100:]
-
-
-class X2goDropboxJob(threading.Thread):
- """\
- For each X2go dropbox job we create a sub-thread that let's
- the dropbox job be processed in the background.
-
- As a handler for this class the function L{x2go_dropboxjob_handler()}
- is used.
-
- """
- def __init__(self, **kwargs):
- """\
- Construct the X2go dropbox job thread...
-
- All parameters (**kwargs) are passed through to the constructor
- of C{threading.Thread()}.
-
- """
- threading.Thread.__init__(self, **kwargs)
- self.daemon = True
diff --git a/x2go/mimebox.py b/x2go/mimebox.py
new file mode 100644
index 0000000..bcc4286
--- /dev/null
+++ b/x2go/mimebox.py
@@ -0,0 +1,267 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010-2011 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+#
+# Python X2go is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Python X2go is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+"""\
+L{X2goMIMEboxQueue} sets up a thread that listens for incoming files that
+shall be opened locally on the client.
+
+For each file that gets dropped in the MIME box an individual
+thread is started (L{X2goMIMEboxJob}) that handles the processing
+of the incoming file.
+
+"""
+__NAME__ = 'x2gomimeboxqueue-pylib'
+
+# modules
+import os
+import copy
+import types
+import threading
+import gevent
+
+# Python X2go modules
+import defaults
+import utils
+import log
+import mimeboxactions
+
+if defaults.X2GOCLIENT_OS != 'Windows':
+ from x2go_exceptions import WindowsError
+
+
+class X2goMIMEboxQueue(threading.Thread):
+ """\
+ If the X2go MIME box is supported in a particaluar L{X2goSession} instance
+ this class provides a sub-thread for handling incoming files in the MIME box
+ directory. The actual handling of a dropped file is handled by the classes
+ L{X2goMIMEboxActionOPEN}, L{X2goMIMEboxActionOPENWITH} and L{X2goMIMEboxActionSAVEAS}.
+
+ """
+ mimebox_action = None
+
+ mimebox = None
+ active_jobs = {}
+ mimebox_history = []
+
+ def __init__(self, profile_name='UNKNOWN', session_name='UNKNOWN',
+ mimebox_dir=None, mimebox_action=None, mimebox_extensions=[],
+ client_instance=None, logger=None, loglevel=log.loglevel_DEFAULT):
+ """\
+ @param profile_name: name of the session profile this print queue belongs to
+ @type profile_name: C{str}
+ @param mimebox_dir: local directory for incoming MIME box files
+ @type mimebox_dir: C{str}
+ @param mimebox_action: name or instance of either of the possible X2go print action classes
+ @type mimebox_action: C{str} or instance
+ @param client_instance: the underlying L{X2goClient} instance
+ @type client_instance: C{instance}
+ @param logger: you can pass an L{X2goLogger} object to the
+ L{X2goPrintQueue} constructor
+ @type logger: C{instance}
+ @param loglevel: if no L{X2goLogger} object has been supplied a new one will be
+ constructed with the given loglevel
+ @type loglevel: C{int}
+
+ """
+ if logger is None:
+ self.logger = log.X2goLogger(loglevel=loglevel)
+ else:
+ self.logger = copy.deepcopy(logger)
+ self.logger.tag = __NAME__
+
+ self.profile_name = profile_name
+ self.session_name = session_name
+ self.mimebox_dir = mimebox_dir
+ self.mimebox_extensions = mimebox_extensions
+ self.client_instance = client_instance
+ self.client_rootdir = client_instance.get_client_rootdir()
+
+ if mimebox_action is None:
+ mimebox_action = mimebox_actions.X2goMIMEboxActionOPEN(client_instance=self.client_instance, logger=self.logger, **mimebox_action_args)
+ elif type(mimebox_action) in (types.StringType, types.UnicodeType):
+ mimebox_action = self.set_mimebox_action(mimebox_action)
+ else:
+ # hope it's already an instance...
+ self.mimebox_action = mimebox_action
+
+ threading.Thread.__init__(self)
+ self.daemon = True
+ self._accept_jobs = True
+
+ def __del__(self):
+ self.stop_thread()
+
+ def pause(self):
+ """\
+ Prevent acceptance of new incoming files. The processing of MIME box jobs that
+ are currently still active will be completed, though.
+
+ """
+ if self._accept_jobs == True:
+ self._accept_jobs = False
+ self.logger('paused thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
+
+ def resume(self):
+ """\
+ Resume operation of the X2go MIME box queue and continue accepting new incoming
+ files.
+
+ """
+ if self._accept_jobs == False:
+ self._accept_jobs = True
+ self.logger('resumed thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
+
+ def stop_thread(self):
+ """\
+ Stops this L{X2goMIMEboxQueue} thread completely.
+
+ """
+ self.pause()
+ self._keepalive = False
+ self.logger('stopping thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
+
+ @property
+ def _incoming_mimebox_jobs(self):
+ if os.path.exists(self.mimebox_dir):
+ l = os.listdir(self.mimebox_dir)
+ mimebox_jobs = []
+ for _ext in self.mimebox_extensions:
+ mimebox_jobs.extend([ dj for dj in l if dj.upper().endswith(_ext.upper()) ])
+ else:
+ mimebox_jobs = l
+ return [ dj for dj in mimebox_jobs if dj not in self.active_jobs.keys() ]
+ else:
+ return []
+
+ def set_mimebox_action(self, mimebox_action, **kwargs):
+ """\
+ Modify the MIME box action of this L{X2goMIMEboxQueue} thread during runtime. The
+ change of the MIME box action will be valid for the next incoming file in the MIME box
+ directory.
+
+ """
+ if mimebox_action in defaults.X2GO_MIMEBOX_ACTIONS.keys():
+ mimebox_action = defaults.X2GO_MIMEBOX_ACTIONS[mimebox_action]
+
+ if mimebox_action in defaults.X2GO_MIMEBOX_ACTIONS.values():
+ self.mimebox_action = eval ('mimeboxactions.%s(**kwargs)' % mimebox_action)
+
+ def run(self):
+ """\
+ Start this L{X2goMIMEboxQueue} thread...
+
+ """
+ self.logger('starting MIME box queue thread: %s' % repr(self), loglevel=log.loglevel_DEBUG)
+
+ self._keepalive = True
+ while self._keepalive:
+
+ while self._accept_jobs:
+
+ if self._incoming_mimebox_jobs:
+
+ for _job in self._incoming_mimebox_jobs:
+ self.logger('processing incoming X2go MIME box job: %s' % _job, loglevel=log.loglevel_NOTICE)
+ _new_mimeboxjob_thread = X2goMIMEboxJob(target=x2go_mimeboxjob_handler,
+ kwargs={
+ 'mimebox_file': _job,
+ 'mimebox_extensions': self.mimebox_extensions,
+ 'mimebox_action': self.mimebox_action,
+ 'parent_thread': self,
+ 'logger': self.logger,
+ }
+ )
+ self.active_jobs['%s' % _job] = _new_mimeboxjob_thread
+ _new_mimeboxjob_thread.start()
+
+ gevent.sleep(3)
+
+ gevent.sleep(1)
+
+
+def x2go_mimeboxjob_handler(mimebox_file=None,
+ mimebox_extensions=[],
+ mimebox_action=None,
+ parent_thread=None, logger=None, ):
+ """\
+ This function is called as a handler function for each incoming X2go MIME box file
+ represented by the class L{X2goMIMEboxJob}.
+
+ @param mimebox_file: MIME box file name as placed in to the X2go MIME box spool directory
+ @type mimebox_file: C{str}
+ @param mimebox_action: an instance of either of the possible C{X2goMIMEboxActionXXX} classes
+ @type mimebox_action: C{X2goMIMEboxActionXXX} nstance
+ @param parent_thread: the L{X2goMIMEboxQueue} thread that actually created this handler's L{X2goMIMEboxJob} instance
+ @type parent_thread: C{instance}
+ @param logger: the L{X2goMIMEboxQueue}'s logging instance
+ @type logger: C{instance}
+
+ """
+ mimebox_action.profile_name = parent_thread.profile_name
+ mimebox_action.session_name = parent_thread.session_name
+
+ logger('action for printing is: %s' % mimebox_action, loglevel=log.loglevel_DEBUG)
+
+ _dotfile = mimebox_file.startswith('.')
+ _blacklisted = mimebox_file.upper().split('.')[-1] in defaults.X2GO_MIMEBOX_EXTENSIONS_BLACKLIST
+ _really_process = bool(not _blacklisted and ((not mimebox_extensions) or [ ext for ext in mimebox_extensions if mimebox_file.upper().endswith('%s' % ext.upper()) ]))
+ if _really_process and not _blacklisted and not _dotfile:
+ mimebox_action.do_process(mimebox_file=mimebox_file,
+ mimebox_dir=parent_thread.mimebox_dir,
+ )
+ elif not _blacklisted and not _dotfile:
+ logger('file extension of MIME box file %s is prohibited by session profile configuration' % mimebox_file, loglevel=log.loglevel_NOTICE)
+ elif _dotfile:
+ logger('placing files starting with a dot (.<file>) into the X2go MIME box is prohibited, ignoring the file ,,%s\'\'' % mimebox_file, loglevel=log.loglevel_WARN)
+ else:
+ logger('file extension of MIME box file %s has been found in Python X2go\' hardcoded MIME box extenstions blacklist' % mimebox_file, loglevel=log.loglevel_WARN)
+
+ logger('removing MIME box file %s' % mimebox_file, loglevel=log.loglevel_DEBUG)
+
+ utils.patiently_remove_file(parent_thread.mimebox_dir, mimebox_file)
+ logger('removed print job file %s' % mimebox_file, loglevel=log.loglevel_DEBUG)
+
+ del parent_thread.active_jobs['%s' % mimebox_file]
+ parent_thread.mimebox_history.append(mimebox_file)
+ # in case we do a lot of mimebox file exports we do not want to risk an
+ # endlessly growing mimebox job history
+ if len(parent_thread.mimebox_history) > 100:
+ parent_thread.mimebox_history = parent_thread.mimebox_history[-100:]
+
+
+class X2goMIMEboxJob(threading.Thread):
+ """\
+ For each X2go MIME box job we create a sub-thread that let's
+ the MIME box job be processed in the background.
+
+ As a handler for this class the function L{x2go_mimeboxjob_handler()}
+ is used.
+
+ """
+ def __init__(self, **kwargs):
+ """\
+ Construct the X2go MIME box job thread...
+
+ All parameters (**kwargs) are passed through to the constructor
+ of C{threading.Thread()}.
+
+ """
+ threading.Thread.__init__(self, **kwargs)
+ self.daemon = True
diff --git a/x2go/dropboxactions.py b/x2go/mimeboxactions.py
similarity index 58%
rename from x2go/dropboxactions.py
rename to x2go/mimeboxactions.py
index a66817b..255fe9d 100644
--- a/x2go/dropboxactions.py
+++ b/x2go/mimeboxactions.py
@@ -19,11 +19,11 @@
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
"""\
-For dropbox jobs there are currently two handling actions available:
-L{X2goDropboxActionOPEN}, L{X2goDropboxActionOPENWITH} and L{X2goDropboxActionSAVEAS}.
+For MIME box jobs there are currently two handling actions available:
+L{X2goMIMEboxActionOPEN}, L{X2goMIMEboxActionOPENWITH} and L{X2goMIMEboxActionSAVEAS}.
"""
-__NAME__ = 'x2godropboxactions-pylib'
+__NAME__ = 'x2gomimeboxactions-pylib'
# modules
import os
@@ -48,10 +48,10 @@ import defaults
import utils
import x2go_exceptions
-_DROPBOX_ENV = os.environ.copy()
+_MIMEBOX_ENV = os.environ.copy()
-class X2goDropboxAction(object):
+class X2goMIMEboxAction(object):
__name__ = 'NAME'
__description__ = 'DESCRIPTION'
@@ -59,12 +59,12 @@ class X2goDropboxAction(object):
def __init__(self, client_instance=None, logger=None, loglevel=log.loglevel_DEFAULT):
"""\
This is a meta class and has no functionality as such. It is used as parent
- class by »real« X2go dropbox actions.
+ class by »real« X2go MIME box actions.
@param client_instance: the underlying L{X2goClient} instance
@type client_instance: C{instance}
@param logger: you can pass an L{X2goLogger} object to the
- L{X2goDropboxAction} constructor
+ L{X2goMIMEboxAction} constructor
@type logger: C{instance}
@param loglevel: if no L{X2goLogger} object has been supplied a new one will be
constructed with the given loglevel
@@ -77,7 +77,7 @@ class X2goDropboxAction(object):
self.logger = copy.deepcopy(logger)
self.logger.tag = __NAME__
- # these get set from within the X2goDropboxQueue class
+ # these get set from within the X2goMIMEboxQueue class
self.profile_name = 'UNKNOWN'
self.session_name = 'UNKNOWN'
@@ -86,7 +86,7 @@ class X2goDropboxAction(object):
@property
def name():
"""\
- Return the X2go dropbox action's name.
+ Return the X2go MIME box action's name.
"""
return self.__name__
@@ -94,27 +94,27 @@ class X2goDropboxAction(object):
@property
def description():
"""\
- Return the X2go dropbox action's description text.
+ Return the X2go MIME box action's description text.
"""
return self.__description__
- def do_process(self, dropbox_file, dropbox_dir, ):
+ def do_process(self, mimebox_file, mimebox_dir, ):
"""\
- Perform the defined dropbox action (doing nothing in L{X2goDropboxAction} parent class).
+ Perform the defined MIME box action (doing nothing in L{X2goMIMEboxAction} parent class).
- @param dropbox_file: file name as placed in to the X2go dropbox directory
- @type dropbox_file: C{str}
- @param dropbox_dir: location of the X2go sessions's dropbox directory
- @type dropbox_dir: C{str}
+ @param mimebox_file: file name as placed in to the X2go MIME box directory
+ @type mimebox_file: C{str}
+ @param mimebox_dir: location of the X2go sessions's MIME box directory
+ @type mimebox_dir: C{str}
"""
pass
-class X2goDropboxActionOPEN(X2goDropboxAction):
+class X2goMIMEboxActionOPEN(X2goMIMEboxAction):
"""\
- Dropbox action that opens incoming files in the default application.
+ MIME box action that opens incoming files in the default application.
"""
__name__= 'OPEN'
@@ -125,7 +125,7 @@ class X2goDropboxActionOPEN(X2goDropboxAction):
@param client_instance: the underlying L{X2goClient} instance
@type client_instance: C{instance}
@param logger: you can pass an L{X2goLogger} object to the
- L{X2goDropboxActionOPEN} constructor
+ L{X2goMIMEboxActionOPEN} constructor
@type logger: C{instance}
@param loglevel: if no L{X2goLogger} object has been supplied a new one will be
constructed with the given loglevel
@@ -133,25 +133,25 @@ class X2goDropboxActionOPEN(X2goDropboxAction):
"""
self.client_instance = client_instance
- X2goDropboxAction.__init__(self, logger=logger, loglevel=loglevel)
+ X2goMIMEboxAction.__init__(self, logger=logger, loglevel=loglevel)
- def do_process(self, dropbox_file, dropbox_dir, ):
+ def do_process(self, mimebox_file, mimebox_dir, ):
"""\
- Open an incoming dropbox file in the system's default application.
+ Open an incoming MIME box file in the system's default application.
- @param dropbox_file: file name as placed in to the dropbox directory
- @type dropbox_file: C{str}
- @param dropbox_dir: location of the X2go session's dropbox directory
- @type dropbox_dir: C{str}
+ @param mimebox_file: file name as placed in to the MIME box directory
+ @type mimebox_file: C{str}
+ @param mimebox_dir: location of the X2go session's MIME box directory
+ @type mimebox_dir: C{str}
"""
if _X2GOCLIENT_OS == "Windows":
- self.logger('opening incoming dropbox file with Python\'s os.startfile() command: %s' % dropbox_file, loglevel=log.loglevel_DEBUG)
+ self.logger('opening incoming MIME box file with Python\'s os.startfile() command: %s' % mimebox_file, loglevel=log.loglevel_DEBUG)
try:
- os.startfile(os.path.join(dropbox_dir, dropbox_file))
+ os.startfile(os.path.join(mimebox_dir, mimebox_file))
except WindowsError, win_err:
if self.client_instance:
- self.client_instance.HOOK_dropboxaction_error(dropbox_file,
+ self.client_instance.HOOK_mimeboxaction_error(mimebox_file,
profile_name=self.profile_name,
session_name=self.session_name,
err_msg=str(win_err)
@@ -160,27 +160,27 @@ class X2goDropboxActionOPEN(X2goDropboxAction):
self.logger('Encountered WindowsError: %s' % str(win_err), loglevel=log.loglevel_ERROR)
time.sleep(20)
else:
- cmd_line = [ 'xdg-open', os.path.join(dropbox_dir, dropbox_file), ]
- self.logger('opening dropbox file with command: %s' % ' '.join(cmd_line), loglevel=log.loglevel_DEBUG)
- p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=_DROPBOX_ENV)
+ cmd_line = [ 'xdg-open', os.path.join(mimebox_dir, mimebox_file), ]
+ self.logger('opening MIME box file with command: %s' % ' '.join(cmd_line), loglevel=log.loglevel_DEBUG)
+ p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=_MIMEBOX_ENV)
time.sleep(20)
-class X2goDropboxActionOPENWITH(X2goDropboxAction):
+class X2goMIMEboxActionOPENWITH(X2goMIMEboxAction):
"""\
- Dropbox action that calls the system's ,,Open with...'' dialog on incoming files. Currently only
+ MIME box action that calls the system's ,,Open with...'' dialog on incoming files. Currently only
properly implementable on Windows platforms.
"""
__name__= 'OPENWITH'
- __decription__= 'Evoke ,,Open with...\'\' dialog on incoming dropbox files.'
+ __decription__= 'Evoke ,,Open with...\'\' dialog on incoming MIME box files.'
def __init__(self, client_instance=None, logger=None, loglevel=log.loglevel_DEFAULT):
"""\
@param client_instance: the underlying L{X2goClient} instance
@type client_instance: C{instance}
@param logger: you can pass an L{X2goLogger} object to the
- L{X2goDropboxActionOPENWITH} constructor
+ L{X2goMIMEboxActionOPENWITH} constructor
@type logger: C{instance}
@param loglevel: if no L{X2goLogger} object has been supplied a new one will be
constructed with the given loglevel
@@ -188,41 +188,41 @@ class X2goDropboxActionOPENWITH(X2goDropboxAction):
"""
self.client_instance = client_instance
- X2goDropboxAction.__init__(self, logger=logger, loglevel=loglevel)
+ X2goMIMEboxAction.__init__(self, logger=logger, loglevel=loglevel)
- def do_process(self, dropbox_file, dropbox_dir, ):
+ def do_process(self, mimebox_file, mimebox_dir, ):
"""\
- Open an incoming dropbox file in the system's default application.
+ Open an incoming MIME box file in the system's default application.
- @param dropbox_file: file name as placed in to the dropbox directory
- @type dropbox_file: C{str}
- @param dropbox_dir: location of the X2go session's dropbox directory
- @type dropbox_dir: C{str}
+ @param mimebox_file: file name as placed in to the MIME box directory
+ @type mimebox_file: C{str}
+ @param mimebox_dir: location of the X2go session's MIME box directory
+ @type mimebox_dir: C{str}
"""
if _X2GOCLIENT_OS == "Windows":
- self.logger('evoking Open-with dialog on incoming dropbox file: %s' % dropbox_file, loglevel=log.loglevel_DEBUG)
+ self.logger('evoking Open-with dialog on incoming MIME box file: %s' % mimebox_file, loglevel=log.loglevel_DEBUG)
win32api.ShellExecute (
0,
"open",
"rundll32.exe",
- "shell32.dll,OpenAs_RunDLL %s" % os.path.join(dropbox_dir, dropbox_file),
+ "shell32.dll,OpenAs_RunDLL %s" % os.path.join(mimebox_dir, mimebox_file),
None,
0,
)
time.sleep(20)
else:
- self.logger('the evocation of the Open-with dialog box is currently not available on Linux, falling back to dropbox action OPEN', loglevel=log.loglevel_WARN)
- cmd_line = [ 'xdg-open', os.path.join(dropbox_dir, dropbox_file), ]
- self.logger('opening dropbox file with command: %s' % ' '.join(cmd_line), loglevel=log.loglevel_DEBUG)
- p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=_DROPBOX_ENV)
+ self.logger('the evocation of the Open-with dialog box is currently not available on Linux, falling back to MIME box action OPEN', loglevel=log.loglevel_WARN)
+ cmd_line = [ 'xdg-open', os.path.join(mimebox_dir, mimebox_file), ]
+ self.logger('opening MIME box file with command: %s' % ' '.join(cmd_line), loglevel=log.loglevel_DEBUG)
+ p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=_MIMEBOX_ENV)
time.sleep(20)
-class X2goDropboxActionSAVEAS(X2goDropboxAction):
+class X2goMIMEboxActionSAVEAS(X2goMIMEboxAction):
"""\
- Dropbox action that allows saving incoming dropbox files to a local folder. What this
- dropbox actually does is calling a hook method in the L{X2goClient} instance that
+ MIME box action that allows saving incoming MIME box files to a local folder. What this
+ MIME box actually does is calling a hook method in the L{X2goClient} instance that
can be hi-jacked by one of your application's methods which then can handle the ,,Save as...''
request.
@@ -233,11 +233,11 @@ class X2goDropboxActionSAVEAS(X2goDropboxAction):
def __init__(self, client_instance=None, logger=None, loglevel=log.loglevel_DEFAULT):
"""\
@param client_instance: an L{X2goClient} instance, within your customized L{X2goClient} make sure
- you have a C{HOOK_open_dropbox_saveas_dialog(filename=<str>)} method defined that will actually
- handle the incoming dropbox file.
+ you have a C{HOOK_open_mimebox_saveas_dialog(filename=<str>)} method defined that will actually
+ handle the incoming mimebox file.
@type client_instance: C{instance}
@param logger: you can pass an L{X2goLogger} object to the
- L{X2goDropboxActionSAVEAS} constructor
+ L{X2goMIMEboxActionSAVEAS} constructor
@type logger: C{instance}
@param loglevel: if no L{X2goLogger} object has been supplied a new one will be
constructed with the given loglevel
@@ -245,22 +245,22 @@ class X2goDropboxActionSAVEAS(X2goDropboxAction):
"""
if client_instance is None:
- raise x2go_exceptions.X2goDropboxActionException('the SAVEAS dropbox action needs to know the X2goClient instance (client=<instance>)')
- X2goDropboxAction.__init__(self, client_instance=client_instance, logger=logger, loglevel=loglevel)
+ raise x2go_exceptions.X2goMIMEboxActionException('the SAVEAS MIME box action needs to know the X2goClient instance (client=<instance>)')
+ X2goMIMEboxAction.__init__(self, client_instance=client_instance, logger=logger, loglevel=loglevel)
- def do_process(self, dropbox_file, dropbox_dir):
+ def do_process(self, mimebox_file, mimebox_dir):
"""\
- Call an L{X2goClient} hook method (C{HOOK_open_dropbox_saveas_dialog}) that
- can handle the dropbox's SAVEAS action.
+ Call an L{X2goClient} hook method (C{HOOK_open_mimebox_saveas_dialog}) that
+ can handle the MIME box's SAVEAS action.
- @param dropbox_file: file name as placed in to the dropbox directory
- @type dropbox_file: C{str}
- @param dropbox_dir: location of the X2go session's dropbox directory
- @type dropbox_dir: C{str}
- @param dropbox_file: PDF file name as placed in to the X2go spool directory
+ @param mimebox_file: file name as placed in to the MIME box directory
+ @type mimebox_file: C{str}
+ @param mimebox_dir: location of the X2go session's MIME box directory
+ @type mimebox_dir: C{str}
+ @param mimebox_file: PDF file name as placed in to the X2go spool directory
"""
- self.logger('Session %s (%s) is calling X2goClient class hook method <client_instance>.HOOK_open_dropbox_saveas_dialog(%s)' % (self.session_name, self.profile_name, self.dropbox_file), loglevel=log.loglevel_NOTICE)
- self.client_instance.HOOK_open_dropbox_saveas_dialog(os.path.join(dropbox_dir, dropbox_file), profile_name=self.profile_name, session_name=self.session_name)
+ self.logger('Session %s (%s) is calling X2goClient class hook method <client_instance>.HOOK_open_mimebox_saveas_dialog(%s)' % (self.session_name, self.profile_name, self.mimebox_file), loglevel=log.loglevel_NOTICE)
+ self.client_instance.HOOK_open_mimebox_saveas_dialog(os.path.join(mimebox_dir, mimebox_file), profile_name=self.profile_name, session_name=self.session_name)
time.sleep(60)
diff --git a/x2go/session.py b/x2go/session.py
index e259c2a..54f0470 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2010-2011 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
#
@@ -49,7 +48,7 @@ from defaults import X2GO_CLIENT_ROOTDIR as _X2GO_CLIENT_ROOTDIR
from defaults import X2GO_SESSIONS_ROOTDIR as _X2GO_SESSIONS_ROOTDIR
from defaults import X2GO_SSH_ROOTDIR as _X2GO_SSH_ROOTDIR
-from defaults import SUPPORTED_SOUND, SUPPORTED_PRINTING, SUPPORTED_FOLDERSHARING, SUPPORTED_DROPBOX
+from defaults import SUPPORTED_SOUND, SUPPORTED_PRINTING, SUPPORTED_FOLDERSHARING, SUPPORTED_MIMEBOX
# options of the paramiko.SSHClient().connect()
_X2GO_SESSION_PARAMS = ('geometry', 'depth', 'link', 'pack',
@@ -77,9 +76,9 @@ class X2goSession(object):
profile_id=None, profile_name='UNKNOWN',
session_name=None,
printing=False,
- allow_dropbox=False,
- dropbox_extensions=[],
- dropbox_action='OPEN',
+ allow_mimebox=False,
+ mimebox_extensions=[],
+ mimebox_action='OPEN',
allow_share_local_folders=False,
share_local_folders=[],
control_backend=_X2goControlSession,
@@ -135,9 +134,9 @@ class X2goSession(object):
self.printing = printing
self.allow_share_local_folders = allow_share_local_folders
self.share_local_folders = share_local_folders
- self.allow_dropbox = allow_dropbox
- self.dropbox_extensions = dropbox_extensions
- self.dropbox_action = dropbox_action
+ self.allow_mimebox = allow_mimebox
+ self.mimebox_extensions = mimebox_extensions
+ self.mimebox_action = mimebox_action
self.control_backend = control_backend
self.terminal_backend = terminal_backend
self.info_backend = info_backend
@@ -308,16 +307,16 @@ class X2goSession(object):
del params['share_local_folders']
except KeyError: pass
try:
- self.allow_dropbox = params['allow_dropbox']
- del params['allow_dropbox']
+ self.allow_mimebox = params['allow_mimebox']
+ del params['allow_mimebox']
except KeyError: pass
try:
- self.dropbox_extensions = params['dropbox_extensions']
- del params['dropbox_extensions']
+ self.mimebox_extensions = params['mimebox_extensions']
+ del params['mimebox_extensions']
except KeyError: pass
try:
- self.dropbox_action = params['dropbox_action']
- del params['dropbox_action']
+ self.mimebox_action = params['mimebox_action']
+ del params['mimebox_action']
except KeyError: pass
try:
self.use_sshproxy = params['use_sshproxy']
@@ -684,7 +683,7 @@ class X2goSession(object):
_terminal.start_sound()
if (SUPPORTED_PRINTING and self.printing) or \
- (SUPPORTED_DROPBOX and self.allow_dropbox) or \
+ (SUPPORTED_MIMEBOX and self.allow_mimebox) or \
(SUPPORTED_FOLDERSHARING and self.allow_share_local_folders):
_terminal.start_sshfs()
@@ -695,9 +694,9 @@ class X2goSession(object):
except X2goUserException:
pass
- if SUPPORTED_DROPBOX and self.allow_dropbox:
- _terminal.start_dropbox(dropbox_extensions=self.dropbox_extensions, dropbox_action=self.dropbox_action)
- self.session_environment.update({'X2GO_DROPBOX': _terminal.get_dropbox_spooldir(), })
+ if SUPPORTED_MIMEBOX and self.allow_mimebox:
+ _terminal.start_mimebox(mimebox_extensions=self.mimebox_extensions, mimebox_action=self.mimebox_action)
+ self.session_environment.update({'X2GO_MIMEBOX': _terminal.get_mimebox_spooldir(), })
if SUPPORTED_FOLDERSHARING and self.share_local_folders:
if _control.get_transport().reverse_tunnels[_terminal.get_session_name()]['sshfs'][1] is not None:
diff --git a/x2go/utils.py b/x2go/utils.py
index e3af44b..c439c42 100644
--- a/x2go/utils.py
+++ b/x2go/utils.py
@@ -38,7 +38,7 @@ import re
# Python X2go modules
from defaults import X2GOCLIENT_OS as _X2GOCLIENT_OS
from defaults import X2GO_SESSIONPROFILE_DEFAULTS as _X2GO_SESSIONPROFILE_DEFAULTS
-from defaults import X2GO_DROPBOX_ACTIONS as _X2GO_DROPBOX_ACTIONS
+from defaults import X2GO_MIMEBOX_ACTIONS as _X2GO_MIMEBOX_ACTIONS
from defaults import _pack_methods_nx3
def is_in_nx3packmethods(method):
@@ -135,9 +135,9 @@ def _convert_SessionProfileOptions_2_SessionParams(_options):
'sshport': 'port',
'useexports': 'allow_share_local_folders',
'export': 'share_local_folders',
- 'usedropbox': 'allow_dropbox',
- 'dropboxextensions': 'dropbox_extensions',
- 'dropboxaction': 'dropbox_action',
+ 'usemimebox': 'allow_mimebox',
+ 'mimeboxextensions': 'mimebox_extensions',
+ 'mimeboxaction': 'mimebox_action',
'print': 'printing',
'name': 'profile_name',
'key': 'key_filename',
@@ -180,7 +180,7 @@ def _convert_SessionProfileOptions_2_SessionParams(_options):
_params['link'] = val
# share_local_folders is a list
- if opt in ('share_local_folders', 'dropbox_extensions'):
+ if opt in ('share_local_folders', 'mimebox_extensions'):
if type(val) is types.StringType:
if val:
_params[opt] = val.split(',')
@@ -215,8 +215,8 @@ def _convert_SessionProfileOptions_2_SessionParams(_options):
_params['session_type'] = 'desktop'
del _params['rootless']
- if _params['dropbox_action'] not in _X2GO_DROPBOX_ACTIONS.keys():
- _params['dropbox_action'] = 'OPEN'
+ if _params['mimebox_action'] not in _X2GO_MIMEBOX_ACTIONS.keys():
+ _params['mimebox_action'] = 'OPEN'
# currently known but ignored in Python X2go
_ignored_options = [
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).
More information about the x2go-commits
mailing list