diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py index 6e5c093b7..2bb9360f9 100644 --- a/src/common/jingle_xtls.py +++ b/src/common/jingle_xtls.py @@ -83,6 +83,7 @@ def load_cert_file(cert_path, cert_store=None): OpenSSL.crypto.FILETYPE_PEM, cert) if cert_store: cert_store.add_cert(x509cert) + f.close() return x509cert except OpenSSL.crypto.Error as exception_obj: log.warning('Unable to load a certificate from file %s: %s' %\ @@ -119,14 +120,14 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None): dh_params_name = os.path.join(gajim.MY_CERT_DIR, DH_PARAMS) try: with open(dh_params_name, "r") as dh_params_file: - ctx.load_tmp_dh(str(dh_params_name).encode('utf-8')) - except IOError as err: - default_dh_params_name = os.path.join(common.gajim.DATA_DIR, + ctx.load_tmp_dh(str(dh_params_name)) + except FileNotFoundError as err: + default_dh_params_name = os.path.join(gajim.DATA_DIR, 'other', DEFAULT_DH_PARAMS) try: with open(default_dh_params_name, "r") as default_dh_params_file: - ctx.load_tmp_dh(str(default_dh_params_name).encode('utf-8')) - except IOError as err: + ctx.load_tmp_dh(str(default_dh_params_name)) + except FileNotFoundError as err: log.error('Unable to load default DH parameter file: %s , %s' % (default_dh_params_name, err)) raise diff --git a/src/dialogs.py b/src/dialogs.py index a61cf663a..2c7dc58a4 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -384,7 +384,7 @@ class ChangeActivityDialog: else: rbtns[act] = group = Gtk.RadioButton() - hbox = Gtk.HBox(False, 5) + hbox = Gtk.HBox(homogeneous=False, spacing=5) hbox.pack_start(gtkgui_helpers.load_activity_icon(category, activity), False, False, 0) lbl = Gtk.Label(label='' + pep.ACTIVITIES[category]['category'] \ @@ -412,7 +412,7 @@ class ChangeActivityDialog: else: rbtns[act] = group = Gtk.RadioButton() - hbox = Gtk.HBox(False, 5) + hbox = Gtk.HBox(homogeneous=False, spacing=5) hbox.pack_start(gtkgui_helpers.load_activity_icon(category, activity), False, False, 0) hbox.pack_start(Gtk.Label(pep.ACTIVITIES[category][activity]), diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py index f8b058ae6..9bd7958d7 100644 --- a/src/filetransfers_window.py +++ b/src/filetransfers_window.py @@ -325,8 +325,8 @@ class FileTransfersWindow: dialog.add_action_widget(btn, Gtk.ResponseType.OK) dialog.set_default_response(Gtk.ResponseType.OK) - desc_hbox = Gtk.HBox(False, 5) - desc_hbox.pack_start(Gtk.Label(_('Description: ')), False, False, 0) + desc_hbox = Gtk.HBox(homogeneous=False, spacing=5) + desc_hbox.pack_start(Gtk.Label.new(_('Description: ')), False, False, 0) desc_hbox.pack_start(win, True, True, 0) dialog.vbox.pack_start(desc_hbox, False, False, 0) @@ -474,8 +474,7 @@ class FileTransfersWindow: def get_icon(self, ident): return self.images.setdefault(ident, - self.window.render_icon_pixbuf(self.icons[ident], - Gtk.IconSize.MENU)) + gtkgui_helpers.get_icon_pixmap(self.icons[ident], 24)) def set_status(self,file_props, status): """ diff --git a/src/groupchat_control.py b/src/groupchat_control.py index a5068f458..5e58fcbf5 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -1523,8 +1523,8 @@ class GroupchatControl(ChatControlBase): # escape markup entities and make them small italic and fg color color = gtkgui_helpers.get_fade_color(self.list_treeview, selected, focus) - colorstring = "#%04x%04x%04x" % (color.red, color.green, - color.blue) + colorstring = "#%04x%04x%04x" % (int(color.red * 65535), + int(color.green * 65535), int(color.blue * 65535)) name += ('\n' '%s') % (colorstring, GLib.markup_escape_text( status)) diff --git a/src/roster_window.py b/src/roster_window.py index 4bda87722..ce9beaade 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -261,9 +261,10 @@ class RosterWindow: tls_pixbuf = None if gajim.account_is_securely_connected(account): + tls_pixbuf = gtkgui_helpers.get_icon_pixmap('gtk-dialog-authentication', 24) # the only way to create a pixbuf from stock - tls_pixbuf = self.window.render_icon_pixbuf( - Gtk.STOCK_DIALOG_AUTHENTICATION, Gtk.IconSize.MENU) +# tls_pixbuf = self.window.render_icon_pixbuf( +# Gtk.STOCK_DIALOG_AUTHENTICATION, Gtk.IconSize.MENU) it = self.model.append(None, [ gajim.interface.jabber_state_images['16'][show], @@ -1041,9 +1042,10 @@ class RosterWindow: if gajim.account_is_securely_connected(account) and not self.regroup or\ self.regroup and num_of_secured and num_of_secured == num_of_accounts: + tls_pixbuf = gtkgui_helpers.get_icon_pixmap('gtk-dialog-authentication', 24) # the only way to create a pixbuf from stock - tls_pixbuf = self.window.render_icon_pixbuf( - Gtk.STOCK_DIALOG_AUTHENTICATION, Gtk.IconSize.MENU) +# tls_pixbuf = self.window.render_icon_pixbuf( +# Gtk.STOCK_DIALOG_AUTHENTICATION, Gtk.IconSize.MENU) self.model[child_iter][C_PADLOCK_PIXBUF] = tls_pixbuf else: self.model[child_iter][C_PADLOCK_PIXBUF] = empty_pixbuf @@ -1226,8 +1228,8 @@ class RosterWindow: # always readable color = gtkgui_helpers.get_fade_color(self.tree, selected, focus) - colorstring = '#%04x%04x%04x' % (color.red, color.green, - color.blue) + colorstring = '#%04x%04x%04x' % (int(color.red * 65535), + int(color.green * 65535), int(color.blue * 65535)) name += '\n%s' % (colorstring, GLib.markup_escape_text(status)) diff --git a/src/tooltips.py b/src/tooltips.py index be8136eef..9647ac7dd 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -86,7 +86,7 @@ class BaseTooltip: """ Create a popup window each time tooltip is requested """ - self.win = Gtk.Window(Gtk.WindowType.POPUP) + self.win = Gtk.Window.new(Gtk.WindowType.POPUP) self.win.set_title('tooltip') self.win.set_border_width(3) self.win.set_resizable(False)