Remove unused methods
This commit is contained in:
parent
5769ca1e29
commit
ac3bc74952
|
@ -52,7 +52,9 @@ from gajim.conversation_textview import ConversationTextview
|
||||||
from gajim.message_textview import MessageTextView
|
from gajim.message_textview import MessageTextView
|
||||||
|
|
||||||
from gajim.gtk.dialogs import NonModalConfirmationDialog
|
from gajim.gtk.dialogs import NonModalConfirmationDialog
|
||||||
|
from gajim.gtk import util
|
||||||
from gajim.gtk.util import convert_rgb_to_hex
|
from gajim.gtk.util import convert_rgb_to_hex
|
||||||
|
from gajim.gtk.util import at_the_end
|
||||||
from gajim.gtk.emoji_chooser import emoji_chooser
|
from gajim.gtk.emoji_chooser import emoji_chooser
|
||||||
|
|
||||||
from gajim.command_system.implementation.middleware import ChatCommandProcessor
|
from gajim.command_system.implementation.middleware import ChatCommandProcessor
|
||||||
|
@ -708,7 +710,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
mark = message_buffer.get_insert()
|
mark = message_buffer.get_insert()
|
||||||
iter_ = message_buffer.get_iter_at_mark(mark)
|
iter_ = message_buffer.get_iter_at_mark(mark)
|
||||||
if message_buffer.get_end_iter().equal(iter_):
|
if message_buffer.get_end_iter().equal(iter_):
|
||||||
GLib.idle_add(gtkgui_helpers.scroll_to_end, self.msg_scrolledwindow)
|
GLib.idle_add(util.scroll_to_end, self.msg_scrolledwindow)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
elif event.keyval == Gdk.KEY_z: # CTRL+z
|
elif event.keyval == Gdk.KEY_z: # CTRL+z
|
||||||
|
@ -1192,7 +1194,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
if event.get_button()[1] != 1:
|
if event.get_button()[1] != 1:
|
||||||
# We want only to catch the left mouse button
|
# We want only to catch the left mouse button
|
||||||
return
|
return
|
||||||
if not gtkgui_helpers.at_the_end(scrollbar.get_parent()):
|
if not at_the_end(scrollbar.get_parent()):
|
||||||
app.log('autoscroll').info('Autoscroll disabled')
|
app.log('autoscroll').info('Autoscroll disabled')
|
||||||
self.conv_textview.autoscroll = False
|
self.conv_textview.autoscroll = False
|
||||||
|
|
||||||
|
|
|
@ -75,16 +75,6 @@ def get_icon_pixmap(icon_name, size=16, color=None, quiet=False):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
log.error('Unable to load icon %s: %s', icon_name, str(error))
|
log.error('Unable to load icon %s: %s', icon_name, str(error))
|
||||||
|
|
||||||
def get_icon_path(icon_name, size=16):
|
|
||||||
try:
|
|
||||||
icon_info = gtk_icon_theme.lookup_icon(icon_name, size, 0)
|
|
||||||
if icon_info is None:
|
|
||||||
log.error('Icon not found: %s', icon_name)
|
|
||||||
return ''
|
|
||||||
return icon_info.get_filename()
|
|
||||||
except GLib.GError as error:
|
|
||||||
log.error('Unable to find icon %s: %s', icon_name, str(error))
|
|
||||||
|
|
||||||
|
|
||||||
HAS_PYWIN32 = True
|
HAS_PYWIN32 = True
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
|
@ -97,11 +87,6 @@ if os.name == 'nt':
|
||||||
|
|
||||||
from gajim.common import helpers
|
from gajim.common import helpers
|
||||||
|
|
||||||
def add_image_to_button(button, icon_name):
|
|
||||||
img = Gtk.Image()
|
|
||||||
path_img = get_icon_path(icon_name)
|
|
||||||
img.set_from_file(path_img)
|
|
||||||
button.set_image(img)
|
|
||||||
|
|
||||||
def get_image_button(icon_name, tooltip, toggle=False):
|
def get_image_button(icon_name, tooltip, toggle=False):
|
||||||
if toggle:
|
if toggle:
|
||||||
|
@ -146,40 +131,6 @@ def get_gtk_builder(file_name, widget=None):
|
||||||
builder.add_from_file(file_path)
|
builder.add_from_file(file_path)
|
||||||
return builder
|
return builder
|
||||||
|
|
||||||
def at_the_end(widget):
|
|
||||||
"""Determines if a Scrollbar in a GtkScrolledWindow is at the end.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
widget (GtkScrolledWindow)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
bool: The return value is True if at the end, False if not.
|
|
||||||
"""
|
|
||||||
adj_v = widget.get_vadjustment()
|
|
||||||
max_scroll_pos = adj_v.get_upper() - adj_v.get_page_size()
|
|
||||||
return adj_v.get_value() == max_scroll_pos
|
|
||||||
|
|
||||||
def scroll_to_end(widget):
|
|
||||||
"""Scrolls to the end of a GtkScrolledWindow.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
widget (GtkScrolledWindow)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
bool: The return value is False so it can be used with GLib.idle_add.
|
|
||||||
"""
|
|
||||||
adj_v = widget.get_vadjustment()
|
|
||||||
if adj_v is None:
|
|
||||||
# This can happen when the Widget is already destroyed when called
|
|
||||||
# from GLib.idle_add
|
|
||||||
return False
|
|
||||||
max_scroll_pos = adj_v.get_upper() - adj_v.get_page_size()
|
|
||||||
adj_v.set_value(max_scroll_pos)
|
|
||||||
|
|
||||||
adj_h = widget.get_hadjustment()
|
|
||||||
adj_h.set_value(0)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def set_unset_urgency_hint(window, unread_messages_no):
|
def set_unset_urgency_hint(window, unread_messages_no):
|
||||||
"""
|
"""
|
||||||
Sets/unset urgency hint in window argument depending if we have unread
|
Sets/unset urgency hint in window argument depending if we have unread
|
||||||
|
@ -221,22 +172,6 @@ def get_cursor(attr):
|
||||||
cursor = getattr(Gdk.CursorType, attr)
|
cursor = getattr(Gdk.CursorType, attr)
|
||||||
return Gdk.Cursor.new_for_display(display, cursor)
|
return Gdk.Cursor.new_for_display(display, cursor)
|
||||||
|
|
||||||
def get_current_desktop(window):
|
|
||||||
"""
|
|
||||||
Return the current virtual desktop for given window
|
|
||||||
|
|
||||||
NOTE: Window is a GDK window.
|
|
||||||
"""
|
|
||||||
prop = window.property_get('_NET_CURRENT_DESKTOP')
|
|
||||||
if prop is None: # it means it's normal window (not root window)
|
|
||||||
# so we look for it's current virtual desktop in another property
|
|
||||||
prop = window.property_get('_NET_WM_DESKTOP')
|
|
||||||
|
|
||||||
if prop is not None:
|
|
||||||
# f.e. prop is ('CARDINAL', 32, [0]) we want 0 or 1.. from [0]
|
|
||||||
current_virtual_desktop_no = prop[2][0]
|
|
||||||
return current_virtual_desktop_no
|
|
||||||
|
|
||||||
def file_is_locked(path_to_file):
|
def file_is_locked(path_to_file):
|
||||||
"""
|
"""
|
||||||
Return True if file is locked
|
Return True if file is locked
|
||||||
|
|
|
@ -24,9 +24,12 @@ from gi.repository import GLib
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
from gi.repository import Pango
|
from gi.repository import Pango
|
||||||
|
|
||||||
|
from gajim import gtkgui_helpers
|
||||||
|
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim import gtkgui_helpers
|
|
||||||
|
from gajim.gtk.util import scroll_to_end
|
||||||
|
|
||||||
if app.is_installed('GSPELL'):
|
if app.is_installed('GSPELL'):
|
||||||
from gi.repository import Gspell
|
from gi.repository import Gspell
|
||||||
|
@ -166,7 +169,7 @@ class MessageTextView(Gtk.TextView):
|
||||||
mark = buffer_.get_insert()
|
mark = buffer_.get_insert()
|
||||||
iter_ = buffer_.get_iter_at_mark(mark)
|
iter_ = buffer_.get_iter_at_mark(mark)
|
||||||
if iter_.get_offset() == buffer_.get_end_iter().get_offset():
|
if iter_.get_offset() == buffer_.get_end_iter().get_offset():
|
||||||
GLib.idle_add(gtkgui_helpers.scroll_to_end, textview.get_parent())
|
GLib.idle_add(scroll_to_end, textview.get_parent())
|
||||||
|
|
||||||
def make_clickable_urls(self, text):
|
def make_clickable_urls(self, text):
|
||||||
_buffer = self.get_buffer()
|
_buffer = self.get_buffer()
|
||||||
|
|
Loading…
Reference in New Issue