Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits: 2f0432c7 by wurstsalat at 2021-11-06T12:58:12+01:00 Gajim: Fix typo in _install_signal_handlers
- - - - - 6ebafbe3 by wurstsalat at 2021-11-06T16:15:33+01:00 Theming: Fix setting Conversation color
- - - - - 5b235d5d by wurstsalat at 2021-11-06T16:17:21+01:00 Theming: Remove gajim-{incoming,outgoing}-message-text
- - - - - ab2c4fdb by wurstsalat at 2021-11-06T16:42:41+01:00 Themes: Adapt roster styling
- - - - - 70d22e52 by wurstsalat at 2021-11-06T17:02:06+01:00 Themes: Rename options
- - - - - d4397d84 by wurstsalat at 2021-11-06T17:02:09+01:00 Themes: Remove chatstate colors
- - - - - db1de367 by wurstsalat at 2021-11-06T17:02:09+01:00 Themes: Remove contact connected/disconnected color
- - - - - 2f38e1d9 by wurstsalat at 2021-11-06T17:04:07+01:00 Themes: Remove tab-*muc-msg color
- - - - - c21880dd by wurstsalat at 2021-11-06T17:06:55+01:00 Themes: Reorder style options
- - - - -
10 changed files:
- gajim/data/style/default-dark.css - gajim/data/style/default.css - gajim/gajim.py - gajim/gtk/controls/base.py - gajim/gtk/conversation/message_widget.py - gajim/gtk/conversation/plain_widget.py - gajim/gtk/conversation/rows/base.py - gajim/gtk/conversation/rows/message.py - gajim/gtk/message_input.py - gajim/gtk/themes.py
Changes:
===================================== gajim/data/style/default-dark.css ===================================== @@ -5,8 +5,8 @@ .gajim-incoming-nickname { .gajim-outgoing-nickname { color: rgb(40, 140, 210); } -.gajim-outgoing-message-text { - color: rgb(200, 200, 200); +.gajim-conversation-text text { + color: inherit; } .gajim-status-message { color: rgb(140, 175, 210); @@ -25,36 +25,12 @@ .gajim-mention-highlight { .gajim-url { color: rgb(60, 135, 220); } -.gajim-state-tab-muc-directed-msg { - color: rgb(210, 70, 30); -} -.gajim-state-tab-muc-msg { - color: rgb(80, 95, 230); -} .gajim-user-disconnected { color: rgb(230, 170, 170); } .gajim-user-connected { color: rgb(160, 200, 170); } -.gajim-roster-disconnected { - background: rgb(80, 30, 30); -} -.gajim-roster-connected { - background: rgb(30, 80, 50); -} -.gajim-state-composing { - color: rgb(90, 180, 90); -} -.gajim-state-inactive { - color: rgb(158, 158, 158); -} -.gajim-state-gone { - color: rgb(128, 128, 128); -} -.gajim-state-paused { - color: rgb(20, 210, 160); -} .gajim-msg-correcting text { background: rgb(100, 100, 50); }
===================================== gajim/data/style/default.css ===================================== @@ -5,8 +5,8 @@ .gajim-incoming-nickname { .gajim-outgoing-nickname { color: rgb(50, 90, 140); } -.gajim-outgoing-message-text { - color: rgb(85, 85, 85); +.gajim-conversation-text text { + color: inherit; } .gajim-status-message { color: rgb(100, 130, 160); @@ -33,36 +33,12 @@ .gajim-mention-highlight { .gajim-url { color: rgb(30, 75, 135); } -.gajim-state-tab-muc-directed-msg { - color: rgb(210, 70, 30); -} -.gajim-state-tab-muc-msg { - color: rgb(40, 40, 200); -} .gajim-user-disconnected { color: rgb(230, 170, 170); } .gajim-user-connected { color: rgb(160, 200, 170); } -.gajim-roster-disconnected { - background: rgb(230, 170, 170); -} -.gajim-roster-connected { - background: rgb(160, 200, 170); -} -.gajim-state-composing { - color: rgb(40, 140, 40); -} -.gajim-state-inactive { - color: rgb(158, 158, 158); -} -.gajim-state-gone { - color: rgb(128, 128, 128); -} -.gajim-state-paused { - color: rgb(20, 160, 120); -} .gajim-msg-correcting text { background: rgb(240, 230, 170); }
===================================== gajim/gajim.py ===================================== @@ -115,7 +115,7 @@ def _init_gtk(): def _run_app(): from gajim.application import GajimApplication application = GajimApplication() - _install_sginal_handlers(application) + _install_signal_handlers(application) application.run(sys.argv)
@@ -137,9 +137,9 @@ def _set_proc_title(): libc.setproctitle('gajim')
-def _install_sginal_handlers(application): +def _install_signal_handlers(application): def sigint_cb(num, stack): - print('SIGINT/SIGTERM received') + print(' SIGINT/SIGTERM received') application.quit() # ^C exits the application normally signal.signal(signal.SIGINT, sigint_cb)
===================================== gajim/gtk/controls/base.py ===================================== @@ -1250,9 +1250,9 @@ def on_clear_formatting_menuitem_activate(self, _widget): self.msg_textview.clear_tags()
def _style_changed(self, *args): - self.update_tags() + self.update_text_tags()
- def update_tags(self): + def update_text_tags(self): self.conversation_view.update_text_tags()
@staticmethod
===================================== gajim/gtk/conversation/message_widget.py ===================================== @@ -61,3 +61,8 @@ def add_content(self, content):
def clear(self): self.foreach(self.remove) + + def update_text_tags(self, *args): + for widget in self.get_children(): + if not isinstance(widget, CodeWidget): + widget.update_text_tags()
===================================== gajim/gtk/conversation/plain_widget.py ===================================== @@ -15,7 +15,6 @@ import logging from urllib.parse import quote
-from gi.repository import GObject from gi.repository import Gtk from gi.repository import Pango from gi.repository import Gdk @@ -55,6 +54,9 @@ def __init__(self, account, selectable): def add_content(self, block): self._text_widget.print_text_with_styling(block)
+ def update_text_tags(self): + self._text_widget.update_text_tags() +
class MessageLabel(Gtk.Label): def __init__(self, account, selectable): @@ -68,6 +70,8 @@ def __init__(self, account, selectable):
self._account = account
+ self.get_style_context().add_class('gajim-conversation-text') + def print_text_with_styling(self, block): text = GLib.markup_escape_text(block.text.strip()) for uri in block.uris: @@ -81,17 +85,11 @@ def print_text_with_styling(self, block): self.set_markup(text) self.set_attributes(attr_list)
+ def update_text_tags(self): + pass
-class MessageTextview(Gtk.TextView): - - __gsignals__ = { - 'quote': ( - GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, - None, - (str, ) - ), - }
+class MessageTextview(Gtk.TextView): def __init__(self, account): Gtk.TextView.__init__(self) self.set_hexpand(True) @@ -122,7 +120,7 @@ def __init__(self, account): # Keeps text selections for quoting and search actions self._selected_text = ''
- self.get_style_context().add_class('gajim-conversation-font') + self.get_style_context().add_class('gajim-conversation-text')
# Create Tags self._create_url_tags() @@ -147,12 +145,11 @@ def _create_url_tags(self): underline=Pango.Underline.SINGLE) tag.connect('event', self._on_uri_clicked, tag)
- def update_tags(self): + def update_text_tags(self): tag_table = self.get_buffer().get_tag_table() - color = app.css_config.get_value('.gajim-url', StyleAttr.COLOR) - + url_color = app.css_config.get_value('.gajim-url', StyleAttr.COLOR) for tag in URI_TAGS: - tag_table.lookup(tag).set_property('foreground', color) + tag_table.lookup(tag).set_property('foreground', url_color)
def clear(self): buffer_ = self.get_buffer() @@ -229,8 +226,7 @@ def _on_button_press(self, _widget, event): if tags: # A tagged text fragment has been clicked for tag in tags: - tag_name = tag.get_property('name') - if tag_name in URI_TAGS: + if tag.get_property('name') in URI_TAGS: # Block regular context menu return True
@@ -353,6 +349,7 @@ def _on_uri_clicked(self, texttag, _widget, event, iter_, _kind): self._show_context_menu(uri) return Gdk.EVENT_STOP
+ # TODO: # self.plugin_modified = False # app.plugin_manager.extension_point( # 'hyperlink_handler', uri, self, self.get_toplevel())
===================================== gajim/gtk/conversation/rows/base.py ===================================== @@ -14,7 +14,6 @@
from datetime import datetime
-from gi.repository import Gdk from gi.repository import GLib from gi.repository import Gtk from gi.repository import Pango @@ -23,8 +22,6 @@ from gajim.common.i18n import _ from gajim.common.helpers import from_one_line
-from ...util import convert_rgba_to_hex -from ...util import text_to_color from ...util import wrap_with_event_box
@@ -59,10 +56,7 @@ def is_merged(self): return self._merged
def update_text_tags(self): - return - # TODO - if self.textview is not None: - self.textview.update_text_tags() + pass
@staticmethod def create_timestamp_widget(timestamp: datetime) -> Gtk.Label:
===================================== gajim/gtk/conversation/rows/message.py ===================================== @@ -171,13 +171,15 @@ def __init__(self,
self.show_all()
+ def update_text_tags(self): + self._message_widget.update_text_tags() + def _check_for_highlight(self, content): needs_highlight = message_needs_highlight( content.text, self._contact.nickname, self._client.get_own_jid().bare) if needs_highlight: - # TODO: add class to textview text (if message widget is TextView) self.get_style_context().add_class( 'gajim-mention-highlight')
@@ -258,10 +260,10 @@ def _get_encryption_image(self, additional_data, encryption_enabled=None): color = 'encrypted-color' else: icon, trust_tooltip, color = TRUST_SYMBOL_DATA[trust] - tooltip = '%s\n%s' % (tooltip, trust_tooltip) + tooltip = f'{tooltip}\n{trust_tooltip}' if fingerprint is not None: fingerprint = format_fingerprint(fingerprint) - tooltip = '%s\n<tt>%s</tt>' % (tooltip, fingerprint) + tooltip = f'{tooltip}\n<tt>{fingerprint}</tt>'
image = Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.MENU) image.set_tooltip_markup(tooltip) @@ -279,9 +281,6 @@ def _get_encryption_details(additional_data): trust = additional_data.get_value('encrypted', 'trust') return name, fingerprint, trust
- def _on_quote_selection(self, _widget, text): - self.get_parent().on_quote(text) - @property def has_receipt(self): return self._has_receipt
===================================== gajim/gtk/message_input.py ===================================== @@ -53,7 +53,7 @@ def __init__(self): self.set_right_margin(2) self.set_pixels_above_lines(2) self.set_pixels_below_lines(2) - self.get_style_context().add_class('gajim-conversation-font') + self.get_style_context().add_class('gajim-conversation-text')
self.drag_dest_unset()
===================================== gajim/gtk/themes.py ===================================== @@ -34,143 +34,91 @@ StyleOption = namedtuple('StyleOption', 'label selector attr')
CSS_STYLE_OPTIONS = [ - StyleOption(_('Chatstate Composing'), - '.gajim-state-composing', - StyleAttr.COLOR), + StyleOption(_('Conversation: Text Font'), + '.gajim-conversation-text', + StyleAttr.FONT),
- StyleOption(_('Chatstate Inactive'), - '.gajim-state-inactive', + StyleOption(_('Conversation: Text Color'), + '.gajim-conversation-text', StyleAttr.COLOR),
- StyleOption(_('Chatstate Gone'), - '.gajim-state-gone', + StyleOption(_('Conversation: URL Color'), + '.gajim-url', StyleAttr.COLOR),
- StyleOption(_('Chatstate Paused'), - '.gajim-state-paused', + StyleOption(_('Conversation: Nickname Color (Incoming)'), + '.gajim-incoming-nickname', StyleAttr.COLOR),
- StyleOption(_('Group Chat Tab New Directed Message'), - '.gajim-state-tab-muc-directed-msg', + StyleOption(_('Conversation: Nickname Color (Outgoing)'), + '.gajim-outgoing-nickname', StyleAttr.COLOR),
- StyleOption(_('Group Chat Tab New Message'), - '.gajim-state-tab-muc-msg', - StyleAttr.COLOR), + StyleOption(_('Mention: Message Background Color'), + '.gajim-mention-highlight', + StyleAttr.BACKGROUND),
- StyleOption(_('Banner Foreground Color'), - '.gajim-banner', + StyleOption(_('Status Message: Text Color'), + '.gajim-status-message', StyleAttr.COLOR),
- StyleOption(_('Banner Background Color'), - '.gajim-banner', + StyleOption(_('Status Message: Text Font'), + '.gajim-status-message', + StyleAttr.FONT), + + StyleOption(_('Message Correction: Background Color'), + '.gajim-msg-correcting text', StyleAttr.BACKGROUND),
- StyleOption(_('Banner Font'), + StyleOption(_('Chat Banner: Foreground Color'), '.gajim-banner', - StyleAttr.FONT), - - StyleOption(_('Account Row Foreground Color'), - '.gajim-account-row', StyleAttr.COLOR),
- StyleOption(_('Account Row Background Color'), - '.gajim-account-row', + StyleOption(_('Chat Banner: Background Color'), + '.gajim-banner', StyleAttr.BACKGROUND),
- StyleOption(_('Account Row Font'), - '.gajim-account-row', + StyleOption(_('Chat Banner: Text Font'), + '.gajim-banner', StyleAttr.FONT),
- StyleOption(_('Group Row Foreground Color'), + StyleOption(_('Contact List: Group Foreground Color'), '.gajim-group-row', StyleAttr.COLOR),
- StyleOption(_('Group Row Background Color'), + StyleOption(_('Contact List: Group Background Color'), '.gajim-group-row', StyleAttr.BACKGROUND),
- StyleOption(_('Group Row Font'), + StyleOption(_('Contact List: Group Font'), '.gajim-group-row', StyleAttr.FONT),
- StyleOption(_('Contact Row Foreground Color'), + StyleOption(_('Contact List: Contact Foreground Color'), '.gajim-contact-row', StyleAttr.COLOR),
- StyleOption(_('Contact Row Background Color'), + StyleOption(_('Contact List: Contact Background Color'), '.gajim-contact-row', StyleAttr.BACKGROUND),
- StyleOption(_('Contact Row Font'), + StyleOption(_('Contact List: Contact Font'), '.gajim-contact-row', StyleAttr.FONT),
- StyleOption(_('Conversation Font'), - '.gajim-conversation-font', - StyleAttr.FONT), - - StyleOption(_('Incoming Nickname Color'), - '.gajim-incoming-nickname', - StyleAttr.COLOR), - - StyleOption(_('Outgoing Nickname Color'), - '.gajim-outgoing-nickname', - StyleAttr.COLOR), - - StyleOption(_('Incoming Message Text Color'), - '.gajim-incoming-message-text', - StyleAttr.COLOR), - - StyleOption(_('Incoming Message Text Font'), - '.gajim-incoming-message-text', - StyleAttr.FONT), - - StyleOption(_('Outgoing Message Text Color'), - '.gajim-outgoing-message-text', - StyleAttr.COLOR), - - StyleOption(_('Outgoing Message Text Font'), - '.gajim-outgoing-message-text', - StyleAttr.FONT), - - StyleOption(_('Status Message Color'), - '.gajim-status-message', - StyleAttr.COLOR), - - StyleOption(_('Status Message Font'), - '.gajim-status-message', - StyleAttr.FONT), - - StyleOption(_('URL Color'), - '.gajim-url', - StyleAttr.COLOR), - - StyleOption(_('Highlight Message Background'), - '.gajim-mention-highlight', - StyleAttr.BACKGROUND), - - StyleOption(_('Message Correcting'), - '.gajim-msg-correcting text', - StyleAttr.BACKGROUND), - - StyleOption(_('Contact Disconnected Background'), - '.gajim-roster-disconnected', - StyleAttr.BACKGROUND), - - StyleOption(_('Contact Connected Background '), - '.gajim-roster-connected', - StyleAttr.BACKGROUND), - StyleOption(_('Status Online Color'), + StyleOption(_('Status: Online Color'), '.gajim-status-online', StyleAttr.COLOR), - StyleOption(_('Status Away Color'), + + StyleOption(_('Status: Away Color'), '.gajim-status-away', StyleAttr.COLOR), - StyleOption(_('Status DND Color'), + + StyleOption(_('Status: DND Color'), '.gajim-status-dnd', StyleAttr.COLOR), - StyleOption(_('Status Offline Color'), + + StyleOption(_('Status: Offline Color'), '.gajim-status-offline', StyleAttr.COLOR), ] @@ -317,6 +265,14 @@ def _on_add_new_theme(self, *args): self._select_theme_row(iter_) self._apply_theme(name)
+ def reload_roster_theme(self): + tree_selection = self._ui.theme_treeview.get_selection() + store, iter_ = tree_selection.get_selected() + if iter_ is None: + return + theme = store[iter_][Column.THEME] + self._apply_theme(theme) + @staticmethod def _apply_theme(theme): app.settings.set('roster_theme', theme) @@ -423,11 +379,13 @@ def _on_color_set(self, color_button): app.css_config.set_value( self.option.selector, self.option.attr, color_string, pre=True) app.nec.push_incoming_event(NetworkEvent('style-changed')) + self.get_toplevel().reload_roster_theme()
def _on_font_set(self, font_button): desc = font_button.get_font_desc() app.css_config.set_font(self.option.selector, desc, pre=True) app.nec.push_incoming_event(NetworkEvent('style-changed')) + self.get_toplevel().reload_roster_theme()
def _on_remove(self, *args): self.get_parent().remove(self)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/d324e5f8c3b85d00adbbadc1772e1ae0...