fix a few warnings

This commit is contained in:
Yann Leboulanger 2015-07-18 17:27:50 +02:00
parent a6c0a14e2f
commit 685c5730e1
6 changed files with 22 additions and 20 deletions

View File

@ -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

View File

@ -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='<b>' + 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]),

View File

@ -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):
"""

View File

@ -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<span size="small" style="italic" foreground="%s">'
'%s</span>') % (colorstring, GLib.markup_escape_text(
status))

View File

@ -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<span size="small" style="italic" ' \
'foreground="%s">%s</span>' % (colorstring,
GLib.markup_escape_text(status))

View File

@ -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)