From d681f0a059b3c04423d4e06a919e6ad747c077bc Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Apr 2014 19:09:47 +0100 Subject: [PATCH 1/8] Start to improve remote --- openlp/plugins/remotes/lib/httpserver.py | 56 ++++++++++++++++------- openlp/plugins/remotes/remoteplugin.py | 11 ++++- resources/images/network_auth.png | Bin 0 -> 608 bytes resources/images/network_server.png | Bin 0 -> 1133 bytes resources/images/network_ssl.png | Bin 0 -> 577 bytes resources/images/openlp-2.qrc | 5 ++ 6 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 resources/images/network_auth.png create mode 100644 resources/images/network_server.png create mode 100644 resources/images/network_ssl.png diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 22d0349f8..cc2d02ff3 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -38,9 +38,10 @@ import os import logging import time -from PyQt4 import QtCore +from PyQt4 import QtCore, QtGui -from openlp.core.common import AppLocation, Settings +from openlp.core.common import AppLocation, Settings, RegistryProperties +from openlp.core.lib import build_icon from openlp.plugins.remotes.lib import HttpRouter @@ -95,12 +96,13 @@ class HttpThread(QtCore.QThread): self.http_server.start_server() -class OpenLPServer(): +class OpenLPServer(RegistryProperties): def __init__(self): """ Initialise the http server, and start the server of the correct type http / https """ - log.debug('Initialise httpserver') + super(OpenLPServer, self).__init__() + log.debug('Initialise OpenLP') self.settings_section = 'remotes' self.http_thread = HttpThread(self) self.http_thread.start() @@ -112,25 +114,47 @@ class OpenLPServer(): address = Settings().value(self.settings_section + '/ip address') if Settings().value(self.settings_section + '/https enabled'): port = Settings().value(self.settings_section + '/https port') - self.httpd = HTTPSServer((address, port), CustomHandler) - log.debug('Started ssl httpd...') + self.start_server_instance(address, port, HTTPSServer) else: port = Settings().value(self.settings_section + '/port') - loop = 1 - while loop < 3: - try: - self.httpd = ThreadingHTTPServer((address, port), CustomHandler) - except OSError: - loop += 1 - time.sleep(0.1) - except: - log.error('Failed to start server ') - log.debug('Started non ssl httpd...') + self.start_server_instance(address, port, ThreadingHTTPServer) if hasattr(self, 'httpd') and self.httpd: self.httpd.serve_forever() + icon = QtGui.QImage(':/remote/network_server.png') + icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + overlay = QtGui.QImage(':/remote/network_ssl.png') + overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + painter = QtGui.QPainter(icon) + painter.drawImage(0, 0, overlay) + painter.end() + print("Hi") + self.default_theme_label.setText("hello") + self.default_theme_label.setIcon(build_icon(icon)) + self.default_theme_label.show() else: log.debug('Failed to start server') + def start_server_instance(self, address, port, server_class): + """ + Start the server + + :param address: The server address + :param port: The run port + :param server_class: the class to start + """ + loop = 1 + while loop < 4: + try: + self.httpd = server_class((address, port), CustomHandler) + log.debug("Server started for class %s %s %d" % (server_class, address, port)) + except OSError: + log.debug("failed to start http server thread state %d %s" % + (loop, self.http_thread.isRunning() is True)) + loop += 1 + time.sleep(0.1) + except: + log.error('Failed to start server ') + def stop_server(self): """ Stop the server diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 393f08dd9..0e3825bdd 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -30,6 +30,8 @@ import logging import time +from PyQt4 import QtGui + from openlp.core.lib import Plugin, StringContent, translate, build_icon from openlp.plugins.remotes.lib import RemoteTab, OpenLPServer @@ -67,6 +69,13 @@ class RemotesPlugin(Plugin): log.debug('initialise') super(RemotesPlugin, self).initialise() self.server = OpenLPServer() + self.default_theme_label = QtGui.QToolButton(self.main_window.status_bar) + self.default_theme_label.setCheckable(False) + self.default_theme_label.setAutoRaise(True) + self.default_theme_label.setObjectName('default_theme_label') + self.main_window.status_bar.insertPermanentWidget(2, self.default_theme_label) + self.default_theme_label.hide() + self.server.default_theme_label = self.default_theme_label def finalise(self): """ @@ -108,5 +117,5 @@ class RemotesPlugin(Plugin): """ log.debug('remote config changed') self.finalise() - time.sleep(0.5) + time.sleep(1) self.initialise() diff --git a/resources/images/network_auth.png b/resources/images/network_auth.png new file mode 100644 index 0000000000000000000000000000000000000000..45e7a5c1788d214b1e63abdb2746cdfb938598ec GIT binary patch literal 608 zcmV-m0-ybfP)FV7f{fuWJai358$p+0R>_w(?=`@XQp(zNRTr6`JD zTAEkp{ksO;ZujtdCY#H=&xmo#D8?zHq~0av#q+hC!|52_5%i3mA6;Et$!7~`aon{F z*AN~dJVdyPjNBZNXe=V3x%;nOF2`t_Q?-rRa_Z7Xb7RP*xXG&5;V_^F)Ze>u1Ft$d+)n z_Y8$%;W1F%X&EP>0Z#l3bp8^Mc%UqV?hM_A55Oj{ z4t#=({S(CF@j2k-zi!DeJ$=2jlwK6ej77{h%yMrzC}SQ^2{7#TAP0O`e5peIjbzhV u86Urp0tWun*zuQ;F5q~}CxOPEyz4hAGR?5R1SdxT0000swx|LFf3SGE$k@yK*Te>U# z3R9R5P`Z&)XX9cjh!m!1y0BF;OpPYby!Z0nz2|oEUSeWpCMkJ01d{vCyZ3j_|D1C# zq0jN-ix+<3lf1}gGL%k#K*>Y`ni;>ndWFv(KQ_MKqGr=Em$ge%sr<=bKYNzwXI;@R zz*Vg_;xrvut6d4#bt#!lQYx9GqoX5ACK5sjNz7U(rKDy(((k%`17ydu$mMdFDHKqz z*E{o;lmGxC0+9d_VUW=`fYusXD=4iYqD_3QVUMOGfLmJ=2Y@jK0D%Y)B7DvD1Dxk) zBOnUBCj!L>02tE_Hz8?BOjQ4dX-9w%!k8EVfZGTpq(ruU8O>7oA;KUb7#tw-zCC9E zkO;%xmH@Fy5INTkAcVl{*MD^E2Frj!0N5asxu?{a84L6C;kE<_(Y6{kKp5;c!GH3? z05Ht(JP%3*!v_e001dl=R?CO)`=S1w$}mt`!*xA4jss?np%F2o)oLLK0tCUWhqrQs zK+L8mGDFP))(pPmdACI2Gad-Q>euk*#>VyaH7v`5jQW4iHilqK2*_~&q|<3kOiUn~ z%_5V@pwkw+$~2UKVK@c}{2;*f^%Yva53O}i1WW|L+JsUWjwc5o1ekSqcLInY1che+ znXp{rkRbGs!TL7I*ciC3i(2gpj^m)&Y{GF|IIcVV2(aPsP7r0e0bsPohf-pEd>s4x zzvAWoOQcdsj969-0L;*=JEf?Ug6}vOYc!yO00e?{}LeINh4eGAWZQ79DP zdLE|Vyn*Ao`25Ke%oi7MesK{`Cj>&hNf0s*AA+?8h%ol_DQ<3VVB0ntwvA@93D&Uy z071)#){K_#!w&+aMn{ofS%K%e;rXB$TIt?O8OE4<^hicO#{f(NSXf$G`k_=RnR2;o z0DJ+U7(Gh^!0gD|3yZfDHQ$*q;VX4OK5kitbBF%OxIfD@bD1UJGz`P2KjtGx4ypq zO^?n(pjxe-0C+z@tyZJ6v$IaWCn9*B2ivw$sZ`MA*uC9SN(s;NdM+hWO4RFhYmgie z_xx9-Qt1f5r|$wN7K_ifwzf9ztU&1r;P)(<+F=08q_00t&F1I%F#z!2z#$c(OoM@BmdoR*iyz z*z*Dgm?;aVIHxQOoC9YDX3HNE9{l7AL>!(vR2-fx9e4_&D+m7@K~?ZQ@I52tgDr%# zI?^7bJVX2?C;6!YJG+6uH;wH;lOVo2JV9(6~ytwJuv$Vf4-@_QLj?2 P00000NkvXXu0mjf+JX4) literal 0 HcmV?d00001 diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 6af0e77a5..79036f08f 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -149,6 +149,11 @@ messagebox_info.png messagebox_warning.png + + network_server.png + network_ssl.png + network_auth.png + song_usage_active.png song_usage_inactive.png From 25687dfd4803b7c117d2c210b52f047bbc7c601b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 18 Apr 2014 21:29:52 +0100 Subject: [PATCH 2/8] Complete icon and ssl change code --- openlp/plugins/remotes/lib/httprouter.py | 25 ++++++------ openlp/plugins/remotes/lib/httpserver.py | 50 +++++++++++++++--------- openlp/plugins/remotes/lib/remotetab.py | 30 ++++++++++++-- openlp/plugins/remotes/remoteplugin.py | 25 ++++++------ 4 files changed, 82 insertions(+), 48 deletions(-) diff --git a/openlp/plugins/remotes/lib/httprouter.py b/openlp/plugins/remotes/lib/httprouter.py index 5a10a14ae..125094a64 100644 --- a/openlp/plugins/remotes/lib/httprouter.py +++ b/openlp/plugins/remotes/lib/httprouter.py @@ -149,11 +149,11 @@ class HttpRouter(RegistryProperties): """ Initialise the router stack and any other variables. """ - authcode = "%s:%s" % (Settings().value('remotes/user id'), Settings().value('remotes/password')) + auth_code = "%s:%s" % (Settings().value('remotes/user id'), Settings().value('remotes/password')) try: - self.auth = base64.b64encode(authcode) + self.auth = base64.b64encode(auth_code) except TypeError: - self.auth = base64.b64encode(authcode.encode()).decode() + self.auth = base64.b64encode(auth_code.encode()).decode() self.routes = [ ('^/$', {'function': self.serve_file, 'secure': False}), ('^/(stage)$', {'function': self.serve_file, 'secure': False}), @@ -376,7 +376,6 @@ class HttpRouter(RegistryProperties): Examines the extension of the file and determines what the content_type should be, defaults to text/plain Returns the extension and the content_type """ - content_type = 'text/plain' ext = os.path.splitext(file_name)[1] content_type = FILE_TYPES.get(ext, 'text/plain') return ext, content_type @@ -439,7 +438,7 @@ class HttpRouter(RegistryProperties): if plugin.status == PluginStatus.Active: try: text = json.loads(self.request_data)['request']['text'] - except KeyError as ValueError: + except KeyError: return self.do_http_error() text = urllib.parse.unquote(text) self.alerts_manager.emit(QtCore.SIGNAL('alerts_text'), [text]) @@ -488,7 +487,7 @@ class HttpRouter(RegistryProperties): if self.request_data: try: data = json.loads(self.request_data)['request']['id'] - except KeyError as ValueError: + except KeyError: return self.do_http_error() log.info(data) # This slot expects an int within a list. @@ -547,7 +546,7 @@ class HttpRouter(RegistryProperties): """ try: text = json.loads(self.request_data)['request']['text'] - except KeyError as ValueError: + except KeyError: return self.do_http_error() text = urllib.parse.unquote(text) plugin = self.plugin_manager.get_plugin_by_name(plugin_name) @@ -563,12 +562,12 @@ class HttpRouter(RegistryProperties): Go live on an item of type ``plugin``. """ try: - id = json.loads(self.request_data)['request']['id'] - except KeyError as ValueError: + request_id = json.loads(self.request_data)['request']['id'] + except KeyError: return self.do_http_error() plugin = self.plugin_manager.get_plugin_by_name(plugin_name) if plugin.status == PluginStatus.Active and plugin.media_item: - plugin.media_item.emit(QtCore.SIGNAL('%s_go_live' % plugin_name), [id, True]) + plugin.media_item.emit(QtCore.SIGNAL('%s_go_live' % plugin_name), [request_id, True]) return self.do_http_success() def add_to_service(self, plugin_name): @@ -576,11 +575,11 @@ class HttpRouter(RegistryProperties): Add item of type ``plugin_name`` to the end of the service. """ try: - id = json.loads(self.request_data)['request']['id'] - except KeyError as ValueError: + request_id = json.loads(self.request_data)['request']['id'] + except KeyError: return self.do_http_error() plugin = self.plugin_manager.get_plugin_by_name(plugin_name) if plugin.status == PluginStatus.Active and plugin.media_item: - item_id = plugin.media_item.create_item_from_id(id) + item_id = plugin.media_item.create_item_from_id(request_id) plugin.media_item.emit(QtCore.SIGNAL('%s_add_to_service' % plugin_name), [item_id, True]) self.do_http_success() diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index cc2d02ff3..7b3d667cd 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -38,10 +38,9 @@ import os import logging import time -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore from openlp.core.common import AppLocation, Settings, RegistryProperties -from openlp.core.lib import build_icon from openlp.plugins.remotes.lib import HttpRouter @@ -72,7 +71,21 @@ class CustomHandler(BaseHTTPRequestHandler, HttpRouter): self.do_post_processor() -class ThreadingHTTPServer(ThreadingMixIn, HTTPServer): +class StoppableHttpServer(HTTPServer): + """ + Http server that reacts to self.stop flag + """ + + def serve_forever(self): + """ + Handle one request at a time until stopped. + """ + self.stop = False + while not self.stop: + self.handle_request() + + +class ThreadingHTTPServer(ThreadingMixIn, StoppableHttpServer): pass @@ -95,6 +108,10 @@ class HttpThread(QtCore.QThread): """ self.http_server.start_server() + def stop(self): + log.debug("stop called") + self.http_server.stop = True + class OpenLPServer(RegistryProperties): def __init__(self): @@ -112,25 +129,19 @@ class OpenLPServer(RegistryProperties): Start the correct server and save the handler """ address = Settings().value(self.settings_section + '/ip address') - if Settings().value(self.settings_section + '/https enabled'): + self.address = address + self.is_secure = Settings().value(self.settings_section + '/https enabled') + self.needs_authentication = Settings().value(self.settings_section + '/authentication enabled') + if self.is_secure: port = Settings().value(self.settings_section + '/https port') + self.port = port self.start_server_instance(address, port, HTTPSServer) else: port = Settings().value(self.settings_section + '/port') + self.port = port self.start_server_instance(address, port, ThreadingHTTPServer) if hasattr(self, 'httpd') and self.httpd: self.httpd.serve_forever() - icon = QtGui.QImage(':/remote/network_server.png') - icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - overlay = QtGui.QImage(':/remote/network_ssl.png') - overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - painter = QtGui.QPainter(icon) - painter.drawImage(0, 0, overlay) - painter.end() - print("Hi") - self.default_theme_label.setText("hello") - self.default_theme_label.setIcon(build_icon(icon)) - self.default_theme_label.show() else: log.debug('Failed to start server') @@ -149,7 +160,7 @@ class OpenLPServer(RegistryProperties): log.debug("Server started for class %s %s %d" % (server_class, address, port)) except OSError: log.debug("failed to start http server thread state %d %s" % - (loop, self.http_thread.isRunning() is True)) + (loop, self.http_thread.isRunning())) loop += 1 time.sleep(0.1) except: @@ -159,12 +170,13 @@ class OpenLPServer(RegistryProperties): """ Stop the server """ - self.http_thread.exit(0) + if self.http_thread.isRunning(): + self.http_thread.stop() self.httpd = None log.debug('Stopped the server.') -class HTTPSServer(HTTPServer): +class HTTPSServer(StoppableHttpServer): def __init__(self, address, handler): """ Initialise the secure handlers for the SSL server if required.s @@ -178,4 +190,4 @@ class HTTPSServer(HTTPServer): keyfile=os.path.join(local_data, 'remotes', 'openlp.key'), server_side=True) self.server_bind() - self.server_activate() + self.server_activate() \ No newline at end of file diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index d6b96cc1c..ba8766188 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -32,7 +32,7 @@ import os.path from PyQt4 import QtCore, QtGui, QtNetwork from openlp.core.common import AppLocation, Settings, translate -from openlp.core.lib import SettingsTab +from openlp.core.lib import SettingsTab, build_icon ZERO_URL = '0.0.0.0' @@ -234,6 +234,7 @@ class RemoteTab(SettingsTab): """ Load the configuration and update the server configuration if necessary """ + self.is_secure = Settings().value(self.settings_section + '/https enabled') self.port_spin_box.setValue(Settings().value(self.settings_section + '/port')) self.https_port_spin_box.setValue(Settings().value(self.settings_section + '/https port')) self.address_edit.setText(Settings().value(self.settings_section + '/ip address')) @@ -263,9 +264,7 @@ class RemoteTab(SettingsTab): Settings().value(self.settings_section + '/port') != self.port_spin_box.value() or \ Settings().value(self.settings_section + '/https port') != self.https_port_spin_box.value() or \ Settings().value(self.settings_section + '/https enabled') != \ - self.https_settings_group_box.isChecked() or \ - Settings().value(self.settings_section + '/authentication enabled') != \ - self.user_login_group_box.isChecked(): + self.https_settings_group_box.isChecked(): self.settings_form.register_post_process('remotes_config_updated') Settings().setValue(self.settings_section + '/port', self.port_spin_box.value()) Settings().setValue(self.settings_section + '/https port', self.https_port_spin_box.value()) @@ -275,6 +274,7 @@ class RemoteTab(SettingsTab): Settings().setValue(self.settings_section + '/authentication enabled', self.user_login_group_box.isChecked()) Settings().setValue(self.settings_section + '/user id', self.user_id.text()) Settings().setValue(self.settings_section + '/password', self.password.text()) + self.generate_icon() def on_twelve_hour_check_box_changed(self, check_state): """ @@ -290,3 +290,25 @@ class RemoteTab(SettingsTab): Invert the HTTP group box based on Https group settings """ self.http_settings_group_box.setEnabled(not self.https_settings_group_box.isChecked()) + + def generate_icon(self): + """ + Generate icon for main window + """ + self.remote_server_icon.hide() + icon = QtGui.QImage(':/remote/network_server.png') + icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + if self.is_secure: + overlay = QtGui.QImage(':/remote/network_ssl.png') + overlay = overlay.scaled(60, 60, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + painter = QtGui.QPainter(icon) + painter.drawImage(0, 0, overlay) + painter.end() + if Settings().value(self.settings_section + '/authentication enabled'): + overlay = QtGui.QImage(':/remote/network_auth.png') + overlay = overlay.scaled(60, 60, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + painter = QtGui.QPainter(icon) + painter.drawImage(20, 0, overlay) + painter.end() + self.remote_server_icon.setIcon(build_icon(icon)) + self.remote_server_icon.show() \ No newline at end of file diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 069e3e5ec..2538991da 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -28,7 +28,6 @@ ############################################################################### import logging -import time from PyQt4 import QtGui @@ -69,13 +68,13 @@ class RemotesPlugin(Plugin): log.debug('initialise') super(RemotesPlugin, self).initialise() self.server = OpenLPServer() - self.default_theme_label = QtGui.QToolButton(self.main_window.status_bar) - self.default_theme_label.setCheckable(False) - self.default_theme_label.setAutoRaise(True) - self.default_theme_label.setObjectName('default_theme_label') - self.main_window.status_bar.insertPermanentWidget(2, self.default_theme_label) - self.default_theme_label.hide() - self.server.default_theme_label = self.default_theme_label + self.remote_server_icon = QtGui.QToolButton(self.main_window.status_bar) + self.remote_server_icon.setCheckable(False) + self.remote_server_icon.setAutoRaise(True) + self.remote_server_icon.setObjectName('remote_server_icon') + self.main_window.status_bar.insertPermanentWidget(2, self.remote_server_icon) + self.settings_tab.remote_server_icon = self.remote_server_icon + self.settings_tab.generate_icon() def finalise(self): """ @@ -113,9 +112,11 @@ class RemotesPlugin(Plugin): def config_update(self): """ - Called when Config is changed to restart the server on new address or port + Called when Config is changed to requests a restart with the server on new address or port """ log.debug('remote config changed') - self.finalise() - time.sleep(1) - self.initialise() + QtGui.QMessageBox.information(self.main_window, + translate('RemotePlugin', 'Server Config Change'), + translate('RemotePlugin', 'Server configuration changes will require a restart ' + 'to take effect.'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) From e94643b5d17808f8463609baa1fa1cb049904b2c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 18 Apr 2014 21:35:39 +0100 Subject: [PATCH 3/8] Fix invalid code --- openlp/plugins/remotes/lib/httpserver.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 7b3d667cd..9ed5c205a 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -71,21 +71,7 @@ class CustomHandler(BaseHTTPRequestHandler, HttpRouter): self.do_post_processor() -class StoppableHttpServer(HTTPServer): - """ - Http server that reacts to self.stop flag - """ - - def serve_forever(self): - """ - Handle one request at a time until stopped. - """ - self.stop = False - while not self.stop: - self.handle_request() - - -class ThreadingHTTPServer(ThreadingMixIn, StoppableHttpServer): +class ThreadingHTTPServer(ThreadingMixIn, HTTPServer): pass @@ -176,7 +162,7 @@ class OpenLPServer(RegistryProperties): log.debug('Stopped the server.') -class HTTPSServer(StoppableHttpServer): +class HTTPSServer(HTTPServer): def __init__(self, address, handler): """ Initialise the secure handlers for the SSL server if required.s From 5dc35112c33e81be6bd076596dac734f42d5772a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Apr 2014 06:09:54 +0100 Subject: [PATCH 4/8] pep8 again --- openlp/core/ui/servicemanager.py | 3 ++- openlp/plugins/remotes/lib/httprouter.py | 1 + scripts/jenkins_script.py | 8 ++++---- scripts/translation_utils.py | 2 +- tests/functional/openlp_core_common/test_common.py | 4 ++-- tests/functional/openlp_core_lib/test_lib.py | 2 +- .../functional/openlp_core_ui/test_formattingtagsform.py | 4 ++-- tests/functional/openlp_plugins/bibles/test_http.py | 4 ++-- .../presentations/test_pptviewcontroller.py | 4 ++-- .../openlp_plugins/songs/test_foilpresenterimport.py | 2 +- 10 files changed, 18 insertions(+), 16 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9bc63eae6..1796ddc11 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -235,7 +235,8 @@ class Ui_ServiceManager(object): self.edit_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'), icon=':/general/general_edit.png', triggers=self.remote_edit) self.rename_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Rename...'), - icon=':/general/general_edit.png', triggers=self.on_service_item_rename) + icon=':/general/general_edit.png', + triggers=self.on_service_item_rename) self.maintain_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Reorder Item'), icon=':/general/general_edit.png', triggers=self.on_service_item_edit_form) diff --git a/openlp/plugins/remotes/lib/httprouter.py b/openlp/plugins/remotes/lib/httprouter.py index 125094a64..4241b34dc 100644 --- a/openlp/plugins/remotes/lib/httprouter.py +++ b/openlp/plugins/remotes/lib/httprouter.py @@ -452,6 +452,7 @@ class HttpRouter(RegistryProperties): """ Perform an action on the slide controller. """ + log.debug("controller_text var = %s" % var) current_item = self.live_controller.service_item data = [] if current_item: diff --git a/scripts/jenkins_script.py b/scripts/jenkins_script.py index 386ab69ef..cf438964d 100644 --- a/scripts/jenkins_script.py +++ b/scripts/jenkins_script.py @@ -115,14 +115,14 @@ class JenkinsTrigger(object): url = build.info['url'] print('[%s] %s' % (result_string, url)) # On failure open the browser. - #if result_string == "FAILURE": + # if result_string == "FAILURE": # url += 'console' # Popen(('xdg-open', url), stderr=PIPE) def get_repo_name(): """ - This returns the name of branch of the wokring directory. For example it returns *lp:~googol/openlp/render*. + This returns the name of branch of the working directory. For example it returns *lp:~googol/openlp/render*. """ # Run the bzr command. bzr = Popen(('bzr', 'info'), stdout=PIPE, stderr=PIPE) @@ -166,7 +166,7 @@ def main(): help='Disable output.') parser.add_option('-b', '--open-browser', dest='open_browser', action="store_true", default=False, help='Opens the jenkins page in your browser.') - #parser.add_option('-e', '--open-browser-on-error', dest='open_browser_on_error', action="store_true", + # parser.add_option('-e', '--open-browser-on-error', dest='open_browser_on_error', action="store_true", # default=False, help='Opens the jenkins page in your browser in case a test fails.') options, args = parser.parse_args(sys.argv) @@ -177,7 +177,7 @@ def main(): jenkins_trigger = JenkinsTrigger(token) try: jenkins_trigger.trigger_build() - except HTTPError as e: + except HTTPError: print("Wrong token.") return # Open the browser before printing the output. diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index 5aa320806..ad3edcaa3 100755 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -96,7 +96,7 @@ class CommandStack(object): return len(self.data) def __getitem__(self, index): - if not index in self.data: + if index not in self.data: return None elif self.data[index].get('arguments'): return self.data[index]['command'], self.data[index]['arguments'] diff --git a/tests/functional/openlp_core_common/test_common.py b/tests/functional/openlp_core_common/test_common.py index 90b7d0520..ab2d11b3a 100644 --- a/tests/functional/openlp_core_common/test_common.py +++ b/tests/functional/openlp_core_common/test_common.py @@ -79,5 +79,5 @@ class TestCommonFunctions(TestCase): trace_error_handler(mocked_logger) # THEN: The mocked_logger.error() method should have been called with the correct parameters - mocked_logger.error.assert_called_with('OpenLP Error trace\n File openlp.fake at line 56 \n\t called trace_error_handler_test') - + mocked_logger.error.assert_called_with( + 'OpenLP Error trace\n File openlp.fake at line 56 \n\t called trace_error_handler_test') diff --git a/tests/functional/openlp_core_lib/test_lib.py b/tests/functional/openlp_core_lib/test_lib.py index bb3a17ebb..b4334a728 100644 --- a/tests/functional/openlp_core_lib/test_lib.py +++ b/tests/functional/openlp_core_lib/test_lib.py @@ -482,7 +482,7 @@ class TestLib(TestCase): # WHEN: we run the validate_thumb() function # THEN: we should have called a few functions, and the result should be True - #mocked_os.path.exists.assert_called_with(thumb_path) + # mocked_os.path.exists.assert_called_with(thumb_path) def validate_thumb_file_exists_and_older_test(self): """ diff --git a/tests/functional/openlp_core_ui/test_formattingtagsform.py b/tests/functional/openlp_core_ui/test_formattingtagsform.py index 05b5fed74..e71a75651 100644 --- a/tests/functional/openlp_core_ui/test_formattingtagsform.py +++ b/tests/functional/openlp_core_ui/test_formattingtagsform.py @@ -70,7 +70,7 @@ class TestFormattingTagForm(TestCase): form.save_button = MagicMock() # WHEN: on_text_edited is called with an arbitrary value - #form.on_text_edited('text') + # form.on_text_edited('text') # THEN: setEnabled and setDefault should have been called on save_push_button - #form.save_button.setEnabled.assert_called_with(True) + # form.save_button.setEnabled.assert_called_with(True) diff --git a/tests/functional/openlp_plugins/bibles/test_http.py b/tests/functional/openlp_plugins/bibles/test_http.py index b9bb8f11c..92af51619 100644 --- a/tests/functional/openlp_plugins/bibles/test_http.py +++ b/tests/functional/openlp_plugins/bibles/test_http.py @@ -35,7 +35,7 @@ from bs4 import BeautifulSoup from tests.functional import patch, MagicMock from openlp.plugins.bibles.lib.http import BSExtract -#TODO: Items left to test +# TODO: Items left to test # BGExtract # __init__ # _remove_elements @@ -68,7 +68,7 @@ class TestBSExtract(TestCase): """ Test the BSExtractClass """ - #TODO: Items left to test + # TODO: Items left to test # BSExtract # __init__ # get_bible_chapter diff --git a/tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py b/tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py index 8a8897cec..c3d0912c0 100644 --- a/tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py @@ -47,7 +47,7 @@ class TestPptviewController(TestCase, TestMixin): """ Test the PptviewController Class """ -#TODO: Items left to test +# TODO: Items left to test # PptviewController # start_process(self) # kill @@ -108,7 +108,7 @@ class TestPptviewDocument(TestCase): """ Test the PptviewDocument Class """ - #TODO: Items left to test + # TODO: Items left to test # PptviewDocument # __init__ # create_thumbnails diff --git a/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py b/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py index fbd339cf3..61206b9fa 100644 --- a/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py +++ b/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py @@ -44,7 +44,7 @@ class TestFoilPresenter(TestCase): """ Test the functions in the :mod:`foilpresenterimport` module. """ - #TODO: The following modules still need tests written for + # TODO: The following modules still need tests written for # xml_to_song # _child # _process_authors From af792941af9e6c57aec3964d95fb311672a8967f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Apr 2014 06:13:46 +0100 Subject: [PATCH 5/8] pep8 again --- tests/functional/openlp_core_lib/test_file_dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_file_dialog.py b/tests/functional/openlp_core_lib/test_file_dialog.py index b2c2178a9..ab7663a83 100644 --- a/tests/functional/openlp_core_lib/test_file_dialog.py +++ b/tests/functional/openlp_core_lib/test_file_dialog.py @@ -53,8 +53,8 @@ class TestFileDialog(TestCase): self.mocked_os.rest() self.mocked_qt_gui.reset() - # GIVEN: A List of known values as a return value from QFileDialog.getOpenFileNames and a list of valid - # file names. + # GIVEN: A List of known values as a return value from QFileDialog.getOpenFileNames and a list of valid file + # names. self.mocked_qt_gui.QFileDialog.getOpenFileNames.return_value = [ '/Valid File', '/url%20encoded%20file%20%231', '/non-existing'] self.mocked_os.path.exists.side_effect = lambda file_name: file_name in [ From 905a6267051e10fe8009158cce35a736d3d58613 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Apr 2014 06:26:49 +0100 Subject: [PATCH 6/8] fixes --- openlp/plugins/remotes/lib/httpserver.py | 2 +- openlp/plugins/remotes/lib/remotetab.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 9ed5c205a..9a904090d 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -176,4 +176,4 @@ class HTTPSServer(HTTPServer): keyfile=os.path.join(local_data, 'remotes', 'openlp.key'), server_side=True) self.server_bind() - self.server_activate() \ No newline at end of file + self.server_activate() diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index ba8766188..42d46c581 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -311,4 +311,4 @@ class RemoteTab(SettingsTab): painter.drawImage(20, 0, overlay) painter.end() self.remote_server_icon.setIcon(build_icon(icon)) - self.remote_server_icon.show() \ No newline at end of file + self.remote_server_icon.show() From a2c99317c6a262e0474b527dfa351330baece378 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Apr 2014 06:42:45 +0100 Subject: [PATCH 7/8] fixes --- openlp/plugins/songs/lib/songbeamerimport.py | 2 +- tests/functional/openlp_core_lib/test_ui.py | 2 +- tests/functional/openlp_core_ui/test_maindisplay.py | 2 +- tests/functional/openlp_plugins/songs/test_ewimport.py | 10 +++++----- tests/functional/openlp_plugins/songs/test_lib.py | 1 - .../openlp_plugins/songs/test_songbeamerimport.py | 6 +++--- .../openlp_plugins/songs/test_songshowplusimport.py | 10 +++++----- tests/helpers/songfileimport.py | 10 +++++----- .../openlp_plugins/bibles/test_lib_parse_reference.py | 2 +- 9 files changed, 22 insertions(+), 23 deletions(-) diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 5b86591e8..a0b166ded 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -137,7 +137,7 @@ class SongBeamerImport(SongImport): if line.startswith('#') and not read_verses: self.parseTags(line) elif line.startswith('--'): - # --- and -- allowed for page-breaks (difference in Songbeamer only in printout) + # --- and -- allowed for page-breaks (difference in Songbeamer only in printout) if self.current_verse: self.replace_html_tags() self.add_verse(self.current_verse, self.current_verse_type) diff --git a/tests/functional/openlp_core_lib/test_ui.py b/tests/functional/openlp_core_lib/test_ui.py index 91d59ab5a..025b1a638 100644 --- a/tests/functional/openlp_core_lib/test_ui.py +++ b/tests/functional/openlp_core_lib/test_ui.py @@ -162,7 +162,7 @@ class TestUi(TestCase): # WHEN: We create an action with some properties action = create_action(dialog, 'my_action', text='my text', icon=':/wizards/wizard_firsttime.bmp', - tooltip='my tooltip', statustip='my statustip') + tooltip='my tooltip', statustip='my statustip') # THEN: These properties should be set self.assertIsInstance(action, QtGui.QAction) diff --git a/tests/functional/openlp_core_ui/test_maindisplay.py b/tests/functional/openlp_core_ui/test_maindisplay.py index b1a4dc7f7..6d67a3b67 100644 --- a/tests/functional/openlp_core_ui/test_maindisplay.py +++ b/tests/functional/openlp_core_ui/test_maindisplay.py @@ -106,4 +106,4 @@ class TestMainDisplay(TestCase): self.assertEqual('QGraphicsView {}', main_display.styleSheet(), 'MainDisplay instance should not be transparent') self.assertFalse(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground), - 'MainDisplay hasnt translucent background') + 'MainDisplay hasnt translucent background') diff --git a/tests/functional/openlp_plugins/songs/test_ewimport.py b/tests/functional/openlp_plugins/songs/test_ewimport.py index c1b9db52d..981bc677d 100644 --- a/tests/functional/openlp_plugins/songs/test_ewimport.py +++ b/tests/functional/openlp_plugins/songs/test_ewimport.py @@ -141,7 +141,7 @@ class TestEasyWorshipSongImport(TestCase): self.assertIsNotNone(field_desc_entry, 'Import should not be none') self.assertEqual(field_desc_entry.name, name, 'FieldDescEntry.name should be the same as the name argument') self.assertEqual(field_desc_entry.field_type, field_type, - 'FieldDescEntry.type should be the same as the type argument') + 'FieldDescEntry.type should be the same as the type argument') self.assertEqual(field_desc_entry.size, size, 'FieldDescEntry.size should be the same as the size argument') def create_importer_test(self): @@ -231,8 +231,8 @@ class TestEasyWorshipSongImport(TestCase): # THEN: get_field should return the known results self.assertEqual(return_value, result, - 'get_field should return "%s" when called with "%s"' % - (result, TEST_FIELDS[field_index])) + 'get_field should return "%s" when called with "%s"' % + (result, TEST_FIELDS[field_index])) def get_memo_field_test(self): """ @@ -404,10 +404,10 @@ class TestEasyWorshipSongImport(TestCase): self.assertEqual(importer.copyright, song_copyright) if ccli_number: self.assertEqual(importer.ccli_number, ccli_number, 'ccli_number for %s should be %s' - % (title, ccli_number)) + % (title, ccli_number)) for verse_text, verse_tag in add_verse_calls: mocked_add_verse.assert_any_call(verse_text, verse_tag) if verse_order_list: self.assertEqual(importer.verse_order_list, verse_order_list, - 'verse_order_list for %s should be %s' % (title, verse_order_list)) + 'verse_order_list for %s should be %s' % (title, verse_order_list)) mocked_finish.assert_called_with() diff --git a/tests/functional/openlp_plugins/songs/test_lib.py b/tests/functional/openlp_plugins/songs/test_lib.py index 2ab808bc9..b67c1a4be 100644 --- a/tests/functional/openlp_plugins/songs/test_lib.py +++ b/tests/functional/openlp_plugins/songs/test_lib.py @@ -129,7 +129,6 @@ class TestLib(TestCase): # THEN: The result should be a tuple of songs.. assert result == (self.song1, self.song2), 'The result should be the tuble of songs' - def songs_probably_equal_different_song_test(self): """ Test the songs_probably_equal function with two different songs. diff --git a/tests/functional/openlp_plugins/songs/test_songbeamerimport.py b/tests/functional/openlp_plugins/songs/test_songbeamerimport.py index f08cedec5..284f972ef 100644 --- a/tests/functional/openlp_plugins/songs/test_songbeamerimport.py +++ b/tests/functional/openlp_plugins/songs/test_songbeamerimport.py @@ -91,7 +91,7 @@ class TestSongBeamerImport(TestCase): # THEN: do_import should return none and the progress bar maximum should not be set. self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is not a list') self.assertEqual(mocked_import_wizard.progress_bar.setMaximum.called, False, - 'setMaxium on import_wizard.progress_bar should not have been called') + 'setMaxium on import_wizard.progress_bar should not have been called') def valid_import_source_test(self): """ @@ -149,10 +149,10 @@ class TestSongBeamerImport(TestCase): mocked_add_verse.assert_any_call(verse_text, verse_tag) if song_book_name: self.assertEqual(importer.song_book_name, song_book_name, 'song_book_name for %s should be "%s"' % - (song_file, song_book_name)) + (song_file, song_book_name)) if song_number: self.assertEqual(importer.song_number, song_number, 'song_number for %s should be %s' % - (song_file, song_number)) + (song_file, song_number)) mocked_finish.assert_called_with() def check_verse_marks_test(self): diff --git a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py index f2839c332..63e5beb8a 100644 --- a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py +++ b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py @@ -96,7 +96,7 @@ class TestSongShowPlusImport(TestCase): # THEN: do_import should return none and the progress bar maximum should not be set. self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is not a list') self.assertEqual(mocked_import_wizard.progress_bar.setMaximum.called, False, - 'setMaximum on import_wizard.progress_bar should not have been called') + 'setMaximum on import_wizard.progress_bar should not have been called') def valid_import_source_test(self): """ @@ -144,8 +144,8 @@ class TestSongShowPlusImport(TestCase): # THEN: The returned value should should correlate with the input arguments for original_tag, openlp_tag in test_values: self.assertEqual(importer.to_openlp_verse_tag(original_tag), openlp_tag, - 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % - (openlp_tag, original_tag)) + 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % + (openlp_tag, original_tag)) def to_openlp_verse_tag_verse_order_test(self): """ @@ -173,5 +173,5 @@ class TestSongShowPlusImport(TestCase): # THEN: The returned value should should correlate with the input arguments for original_tag, openlp_tag in test_values: self.assertEqual(importer.to_openlp_verse_tag(original_tag, ignore_unique=True), openlp_tag, - 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % - (openlp_tag, original_tag)) + 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % + (openlp_tag, original_tag)) diff --git a/tests/helpers/songfileimport.py b/tests/helpers/songfileimport.py index 49a09528c..16935ffca 100644 --- a/tests/helpers/songfileimport.py +++ b/tests/helpers/songfileimport.py @@ -117,23 +117,23 @@ class SongImportTestHelper(TestCase): self.mocked_add_copyright.assert_called_with(song_copyright) if ccli_number: self.assertEqual(importer.ccli_number, ccli_number, 'ccli_number for %s should be %s' % - (source_file_name, ccli_number)) + (source_file_name, ccli_number)) for verse_text, verse_tag in add_verse_calls: self.mocked_add_verse.assert_any_call(verse_text, verse_tag) if topics: self.assertEqual(importer.topics, topics, 'topics for %s should be %s' % (source_file_name, topics)) if comments: self.assertEqual(importer.comments, comments, 'comments for %s should be "%s"' % - (source_file_name, comments)) + (source_file_name, comments)) if song_book_name: self.assertEqual(importer.song_book_name, song_book_name, 'song_book_name for %s should be "%s"' % - (source_file_name, song_book_name)) + (source_file_name, song_book_name)) if song_number: self.assertEqual(importer.song_number, song_number, 'song_number for %s should be %s' % - (source_file_name, song_number)) + (source_file_name, song_number)) if verse_order_list: self.assertEqual(importer.verse_order_list, [], 'verse_order_list for %s should be %s' % - (source_file_name, verse_order_list)) + (source_file_name, verse_order_list)) self.mocked_finish.assert_called_with() def _get_data(self, data, key): diff --git a/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py b/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py index 84f80e7ed..6883f9eb5 100644 --- a/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py +++ b/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py @@ -104,4 +104,4 @@ class TestBibleManager(TestCase, TestMixin): results = parse_reference('1 Timothy 1:1-2:1', self.manager.db_cache['tests'], MagicMock(), 54) # THEN a verse array should be returned self.assertEqual([(54, 1, 1, -1), (54, 2, 1, 1)], results, "The bible verses should matches the expected " - "results") + "results") From ce55fd1d57b61be6e36aac7e8374a0b141ee5f12 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 20 Apr 2014 21:16:08 +0100 Subject: [PATCH 8/8] fixes --- openlp/core/ui/pluginform.py | 1 - openlp/plugins/remotes/lib/remotetab.py | 2 +- openlp/plugins/remotes/remoteplugin.py | 20 ++++++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 91b98b97a..78bdee4a5 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -30,7 +30,6 @@ The actual plugin view form """ import logging -import os from PyQt4 import QtGui diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 42d46c581..4db25cfc2 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -310,5 +310,5 @@ class RemoteTab(SettingsTab): painter = QtGui.QPainter(icon) painter.drawImage(20, 0, overlay) painter.end() - self.remote_server_icon.setIcon(build_icon(icon)) + self.remote_server_icon.setPixmap(QtGui.QPixmap.fromImage(icon)) self.remote_server_icon.show() diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 2538991da..582192df4 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -68,12 +68,20 @@ class RemotesPlugin(Plugin): log.debug('initialise') super(RemotesPlugin, self).initialise() self.server = OpenLPServer() - self.remote_server_icon = QtGui.QToolButton(self.main_window.status_bar) - self.remote_server_icon.setCheckable(False) - self.remote_server_icon.setAutoRaise(True) - self.remote_server_icon.setObjectName('remote_server_icon') - self.main_window.status_bar.insertPermanentWidget(2, self.remote_server_icon) - self.settings_tab.remote_server_icon = self.remote_server_icon + if not hasattr(self, 'remote_server_icon'): + self.remote_server_icon = QtGui.QLabel(self.main_window.status_bar) + size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + size_policy.setHorizontalStretch(0) + size_policy.setVerticalStretch(0) + size_policy.setHeightForWidth(self.remote_server_icon.sizePolicy().hasHeightForWidth()) + self.remote_server_icon.setSizePolicy(size_policy) + self.remote_server_icon.setFrameShadow(QtGui.QFrame.Plain) + self.remote_server_icon.setLineWidth(1) + self.remote_server_icon.setScaledContents(True) + self.remote_server_icon.setFixedSize(20, 20) + self.remote_server_icon.setObjectName('remote_server_icon') + self.main_window.status_bar.insertPermanentWidget(2, self.remote_server_icon) + self.settings_tab.remote_server_icon = self.remote_server_icon self.settings_tab.generate_icon() def finalise(self):