gajim.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2026
October
September
August
July
June
May
April
March
February
January
2025
December
November
October
September
August
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
List overview
Download
Commits
----- 2026 -----
October 2026
September 2026
August 2026
July 2026
June 2026
May 2026
April 2026
March 2026
February 2026
January 2026
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
commits@gajim.org
17632 discussions
Start a n
N
ew thread
[Git][gajim/gajim][master] AccountWizard: Improve badge preview
by Daniel Brötzmann (ï¼ wurstsalat)
22 Nov '21
22 Nov '21
Daniel Brötzmann pushed to branch master at gajim / gajim Commits: 73decf08 by wurstsalat at 2021-11-22T21:34:01+01:00 AccountWizard: Improve badge preview - - - - - 2 changed files: - gajim/data/gui/account_wizard.ui - gajim/gtk/account_wizard.py Changes: ===================================== gajim/data/gui/account_wizard.ui ===================================== @@ -1,20 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.38.2 --> <interface> <requires lib="gtk+" version="3.22"/> <object class="GtkBox" id="account_label_box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Optional: Add a name and color for your account</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Add a name and color for your account</property> <property name="wrap">True</property> - <property name="max_width_chars">50</property> + <property name="max-width-chars">50</property> <style> <class name="dim-label"/> </style> @@ -28,16 +28,13 @@ <child> <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> - <style> - <class name="linked"/> - </style> <child> <object class="GtkEntry" id="account_name_entry"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="placeholder_text" translatable="yes">Account Name...</property> + <property name="can-focus">True</property> + <property name="placeholder-text" translatable="yes">Account Name...</property> </object> <packing> <property name="expand">False</property> @@ -48,8 +45,8 @@ <child> <object class="GtkColorButton" id="account_color_button"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> </object> <packing> <property name="expand">False</property> @@ -57,6 +54,9 @@ <property name="position">1</property> </packing> </child> + <style> + <class name="linked"/> + </style> </object> <packing> <property name="expand">False</property> @@ -67,8 +67,8 @@ <child> <object class="GtkImage"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">go-down-symbolic</property> + <property name="can-focus">False</property> + <property name="icon-name">go-down-symbolic</property> </object> <packing> <property name="expand">False</property> @@ -79,8 +79,11 @@ <child> <object class="GtkLabel" id="badge_preview"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> + <property name="ellipsize">end</property> + <property name="single-line-mode">True</property> + <property name="max-width-chars">42</property> <style> <class name="badge"/> </style> @@ -92,94 +95,95 @@ </packing> </child> </object> + <!-- n-columns=3 n-rows=5 --> <object class="GtkGrid" id="advanced_grid"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes">_Port</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom_port_entry</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom_port_entry</property> <style> <class name="dim-label"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkEntry" id="custom_port_entry"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="width_chars">6</property> - <property name="placeholder_text">5222</property> - <property name="input_purpose">number</property> + <property name="can-focus">True</property> + <property name="width-chars">6</property> + <property name="placeholder-text">5222</property> + <property name="input-purpose">number</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes">_Hostname</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom_host_entry</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom_host_entry</property> <style> <class name="dim-label"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkEntry" id="custom_host_entry"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="placeholder_text" translatable="yes">
example.org
</property> + <property name="can-focus">True</property> + <property name="placeholder-text" translatable="yes">
example.org
</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> - <property name="margin_bottom">18</property> + <property name="margin-bottom">18</property> <property name="label" translatable="yes">Prox_y</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxies_combobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">proxies_combobox</property> <style> <class name="dim-label"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkComboBox" id="proxies_combobox"> - <property name="width_request">250</property> + <property name="width-request">250</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_bottom">18</property> + <property name="can-focus">False</property> + <property name="margin-bottom">18</property> <child> <object class="GtkCellRendererText"/> <attributes> @@ -188,51 +192,51 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkButton" id="manage_proxies_button"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Manage Proxies...</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes">Manage Proxies...</property> <property name="halign">start</property> <property name="valign">start</property> <child> <object class="GtkImage"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">preferences-system-symbolic</property> + <property name="can-focus">False</property> + <property name="icon-name">preferences-system-symbolic</property> </object> </child> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> + <property name="left-attach">2</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_bottom">12</property> + <property name="can-focus">False</property> + <property name="margin-bottom">12</property> <property name="label" translatable="yes">Advanced Settings</property> <style> <class name="large-header"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> <property name="width">3</property> </packing> </child> <child> <object class="GtkComboBoxText" id="con_type_combo"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="active">0</property> <items> <item>START TLS</item> @@ -241,25 +245,25 @@ </items> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> + <property name="left-attach">1</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes">_Type</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">con_type_combo</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">con_type_combo</property> <style> <class name="dim-label"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> </packing> </child> <child> @@ -273,14 +277,14 @@ </child> </object> <object class="GtkEntryCompletion" id="entrycompletion1"> - <property name="text_column">0</property> - <property name="inline_completion">True</property> - <property name="popup_completion">False</property> - <property name="popup_single_match">False</property> + <property name="text-column">0</property> + <property name="inline-completion">True</property> + <property name="popup-completion">False</property> + <property name="popup-single-match">False</property> </object> <object class="GtkBox" id="login_box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> <property name="valign">center</property> <property name="orientation">vertical</property> @@ -288,8 +292,8 @@ <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_bottom">12</property> + <property name="can-focus">False</property> + <property name="margin-bottom">12</property> <property name="label" translatable="yes">Welcome</property> <style> <class name="large-header"/> @@ -304,11 +308,11 @@ <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> <property name="label" translatable="yes">Please enter your credentials or Sign Up</property> <property name="wrap">True</property> - <property name="max_width_chars">40</property> + <property name="max-width-chars">40</property> <style> <class name="dim-label"/> </style> @@ -321,12 +325,12 @@ </child> <child> <object class="GtkEntry" id="log_in_address_entry"> - <property name="width_request">300</property> + <property name="width-request">300</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Your XMPP address (e.g. user(a)example.org)</property> - <property name="activates_default">True</property> - <property name="placeholder_text" translatable="yes">user(a)example.org</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes">Your XMPP address (e.g. user(a)example.org)</property> + <property name="activates-default">True</property> + <property name="placeholder-text" translatable="yes">user(a)example.org</property> <property name="completion">entrycompletion1</property> </object> <packing> @@ -338,12 +342,12 @@ <child> <object class="GtkEntry" id="log_in_password_entry"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Your password</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes">Your password</property> <property name="visibility">False</property> - <property name="activates_default">True</property> - <property name="placeholder_text" translatable="yes">Password</property> - <property name="input_purpose">password</property> + <property name="activates-default">True</property> + <property name="placeholder-text" translatable="yes">Password</property> + <property name="input-purpose">password</property> </object> <packing> <property name="expand">False</property> @@ -355,12 +359,12 @@ <object class="GtkCheckButton" id="login_advanced_checkbutton"> <property name="label" translatable="yes">_Advanced Settings</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Proxy, custom hostname and port</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes">Proxy, custom hostname and port</property> <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -373,10 +377,10 @@ <property name="label" translatable="yes">_Log In</property> <property name="visible">True</property> <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Log in with your credentials</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes">Log in with your credentials</property> + <property name="use-underline">True</property> <style> <class name="suggested-action"/> </style> @@ -390,7 +394,7 @@ <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">or</property> </object> <packing> @@ -403,10 +407,10 @@ <object class="GtkButton" id="sign_up_button"> <property name="label" translatable="yes">_Sign Up</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Sign up for a new account on a server of your choice</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="tooltip-text" translatable="yes">Sign up for a new account on a server of your choice</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -416,22 +420,22 @@ </child> </object> <object class="GtkEntryCompletion" id="entrycompletion2"> - <property name="text_column">0</property> - <property name="inline_completion">True</property> - <property name="popup_completion">False</property> - <property name="popup_single_match">False</property> + <property name="text-column">0</property> + <property name="inline-completion">True</property> + <property name="popup-completion">False</property> + <property name="popup-single-match">False</property> </object> <object class="GtkBox" id="redirect_box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">18</property> <child> <object class="GtkImage"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> - <property name="icon_name">applications-internet-symbolic</property> + <property name="icon-name">applications-internet-symbolic</property> <property name="icon_size">6</property> </object> <packing> @@ -443,10 +447,10 @@ <child> <object class="GtkLabel" id="instructions"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> <property name="wrap">True</property> - <property name="max_width_chars">42</property> + <property name="max-width-chars">42</property> </object> <packing> <property name="expand">False</property> @@ -458,10 +462,10 @@ <object class="GtkButton" id="link_button"> <property name="label" translatable="yes">Visit Website</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="halign">center</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <style> <class name="suggested-action"/> </style> @@ -475,15 +479,15 @@ </object> <object class="GtkBox" id="security_warning_box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">18</property> <child> <object class="GtkImage"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> - <property name="icon_name">application-certificate-symbolic</property> + <property name="icon-name">application-certificate-symbolic</property> <property name="icon_size">6</property> </object> <packing> @@ -495,7 +499,7 @@ <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> <property name="label" translatable="yes">Certificate Verification Failed</property> <property name="wrap">True</property> @@ -513,11 +517,11 @@ <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> <property name="label" translatable="yes">The following warnings came up while trying to verify the server's certificate</property> <property name="wrap">True</property> - <property name="max_width_chars">42</property> + <property name="max-width-chars">42</property> </object> <packing> <property name="expand">False</property> @@ -527,11 +531,11 @@ </child> <child> <object class="GtkListBox" id="error_list"> - <property name="width_request">300</property> + <property name="width-request">300</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> - <property name="selection_mode">none</property> + <property name="selection-mode">none</property> <style> <class name="tls-error-list"/> </style> @@ -546,10 +550,10 @@ <object class="GtkButton" id="view_cert_button"> <property name="label" translatable="yes">_Show Certificate</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="halign">center</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -560,12 +564,12 @@ <child> <object class="GtkCheckButton" id="trust_cert_checkbutton"> <property name="label" translatable="yes">_Add to Trusted Certificates</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="no-show-all">True</property> <property name="halign">center</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -575,19 +579,19 @@ </child> </object> <object class="GtkPopover" id="server_recommendations"> - <property name="width_request">350</property> - <property name="can_focus">False</property> + <property name="width-request">350</property> + <property name="can-focus">False</property> <child> <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> + <property name="can-focus">False</property> + <property name="border-width">12</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Which server should I choose?</property> <style> <class name="bold"/> @@ -602,11 +606,11 @@ <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">There are plenty of servers to choose from. Creating an account on one server allows you to communicate with contacts from other servers as well.</property> <property name="wrap">True</property> - <property name="max_width_chars">40</property> + <property name="max-width-chars">40</property> <property name="xalign">0</property> </object> <packing> @@ -618,9 +622,9 @@ Creating an account on one server allows you to communicate with contacts from o <child> <object class="GtkButton" id="visit_server_button"> <property name="label" translatable="yes">Visit Server's Website</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="no_show_all">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="no-show-all">True</property> <property name="halign">center</property> <style> <class name="suggested-action"/> @@ -635,11 +639,11 @@ Creating an account on one server allows you to communicate with contacts from o <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">3</property> + <property name="can-focus">False</property> + <property name="margin-top">3</property> <property name="label" translatable="yes">Listing of Servers</property> <property name="wrap">True</property> - <property name="max_width_chars">40</property> + <property name="max-width-chars">40</property> <property name="xalign">0</property> <style> <class name="bold"/> @@ -654,12 +658,12 @@ Creating an account on one server allows you to communicate with contacts from o <child> <object class="GtkLabel" id="recommendation_link1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes"><a href='
https://xmpp.org/getting-started/
'>xmpp.org/getting-started</a></property> - <property name="use_markup">True</property> + <property name="use-markup">True</property> <property name="wrap">True</property> - <property name="wrap_mode">word-char</property> - <property name="max_width_chars">40</property> + <property name="wrap-mode">word-char</property> + <property name="max-width-chars">40</property> <property name="xalign">0</property> </object> <packing> @@ -671,11 +675,11 @@ Creating an account on one server allows you to communicate with contacts from o <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">3</property> + <property name="can-focus">False</property> + <property name="margin-top">3</property> <property name="label" translatable="yes">A Feature Comparison of Various Servers</property> <property name="wrap">True</property> - <property name="max_width_chars">40</property> + <property name="max-width-chars">40</property> <property name="xalign">0</property> <style> <class name="bold"/> @@ -690,12 +694,12 @@ Creating an account on one server allows you to communicate with contacts from o <child> <object class="GtkLabel" id="recommendation_link2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes"><a href='
https://conversations.im/compliance/
'>conversations.im/compliance</a></property> - <property name="use_markup">True</property> + <property name="use-markup">True</property> <property name="wrap">True</property> - <property name="wrap_mode">word-char</property> - <property name="max_width_chars">40</property> + <property name="wrap-mode">word-char</property> + <property name="max-width-chars">40</property> <property name="xalign">0</property> </object> <packing> @@ -707,100 +711,101 @@ Creating an account on one server allows you to communicate with contacts from o </object> </child> </object> + <!-- n-columns=3 n-rows=5 --> <object class="GtkGrid" id="signup_grid"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">center</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_bottom">12</property> + <property name="can-focus">False</property> + <property name="margin-bottom">12</property> <property name="label" translatable="yes">Sign Up</property> <style> <class name="large-header"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> <property name="width">2</property> </packing> </child> <child> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Please choose a server</property> - <property name="use_markup">True</property> - <property name="use_underline">True</property> + <property name="use-markup">True</property> + <property name="use-underline">True</property> <style> <class name="dim-label"/> </style> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> <property name="width">2</property> </packing> </child> <child> <object class="GtkMenuButton"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Which server should I choose?</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="tooltip-text" translatable="yes">Which server should I choose?</property> <property name="popover">server_recommendations</property> <child> <object class="GtkImage"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">dialog-information-symbolic</property> + <property name="can-focus">False</property> + <property name="icon-name">dialog-information-symbolic</property> </object> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkComboBoxText" id="server_comboboxtext_sign_up"> - <property name="width_request">300</property> + <property name="width-request">300</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="has_entry">True</property> + <property name="can-focus">False</property> + <property name="has-entry">True</property> <child internal-child="entry"> <object class="GtkEntry" id="server_comboboxtext_sign_up_entry"> - <property name="can_focus">True</property> - <property name="activates_default">True</property> - <property name="placeholder_text" translatable="yes">
example.org
</property> + <property name="can-focus">True</property> + <property name="activates-default">True</property> + <property name="placeholder-text" translatable="yes">
example.org
</property> <property name="completion">entrycompletion2</property> - <property name="input_purpose">url</property> + <property name="input-purpose">url</property> </object> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkCheckButton" id="sign_up_anonymously"> <property name="label" translatable="yes">Sign up Anonymously</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Note: Anonymous accounts are not possible on all servers</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes">Note: Anonymous accounts are not possible on all servers</property> <property name="halign">start</property> <property name="valign">start</property> - <property name="draw_indicator">True</property> + <property name="draw-indicator">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> <property name="width">2</property> </packing> </child> @@ -808,18 +813,33 @@ Creating an account on one server allows you to communicate with contacts from o <object class="GtkCheckButton" id="sign_up_advanced_checkbutton"> <property name="label" translatable="yes">_Advanced Settings</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Proxy, custom hostname and port</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes">Proxy, custom hostname and port</property> <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> <property name="width">2</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </interface> ===================================== gajim/gtk/account_wizard.py ===================================== @@ -1017,7 +1017,7 @@ def _on_color_set(self, button): self._save_config() def _set_badge_color(self, color): - css = '.badge { background-color: %s }' % color + css = '.badge { background-color: %s; font-size: 100%%; }' % color self._provider.load_from_data(bytes(css.encode())) def _save_config(self): View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/73decf08d20d08e4f8de0b82ef939d34…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/73decf08d20d08e4f8de0b82ef939d34…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] StatusIcon: Make use of libappindicator configurable
by Daniel Brötzmann (ï¼ wurstsalat)
22 Nov '21
22 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: 14fa1c30 by wurstsalat at 2021-11-22T21:14:39+01:00 StatusIcon: Make use of libappindicator configurable - - - - - 2 changed files: - gajim/common/setting_values.py - gajim/gtk/status_icon.py Changes: ===================================== gajim/common/setting_values.py ===================================== @@ -124,6 +124,7 @@ class _ACCOUNT_DEFAULT: 'groupchat_roster_width': 210, 'dev_force_bookmark_2': False, 'developer_modus': False, + 'use_libappindicator': False, 'show_help_start_chat': True, 'gc_notify_on_all_messages_private_default': True, 'gc_notify_on_all_messages_public_default': False, @@ -398,6 +399,7 @@ class _ACCOUNT_DEFAULT: 'gc_notify_on_all_messages_public_default': '', 'metacontacts_enabled': '', 'developer_modus': '', + 'use_libappindicator': _('Enables libappindicator, an alternative tray icon provider'), }, } ===================================== gajim/gtk/status_icon.py ===================================== @@ -60,6 +60,7 @@ def __init__(self): self._popup_menus = [] self._hide_menuitem_added = False self._status_icon = None + self._use_libappindicator = app.settings.get('use_libappindicator') self._ui.sounds_mute_menuitem.set_active( not app.settings.get('sounds_on')) @@ -86,7 +87,7 @@ def _on_account_state(self, _event): def show_icon(self): if not self._status_icon: - if HAS_INDICATOR: + if HAS_INDICATOR and self._use_libappindicator: self._status_icon = appindicator.Indicator.new( 'Gajim', 'dcraven-online', @@ -112,7 +113,7 @@ def show_icon(self): self.update_icon() def hide_icon(self): - if HAS_INDICATOR: + if HAS_INDICATOR and self._use_libappindicator: self._status_icon.set_status(appindicator.IndicatorStatus.PASSIVE) else: self._status_icon.set_visible(False) @@ -126,14 +127,14 @@ def update_icon(self, *args, count=0): if not app.interface.systray_enabled: return if app.settings.get('trayicon') == 'always': - if HAS_INDICATOR: + if HAS_INDICATOR and self._use_libappindicator: self._status_icon.set_status( appindicator.IndicatorStatus.ACTIVE) else: self._status_icon.set_visible(True) if count > 0: icon_name = 'dcraven-message-new' - if HAS_INDICATOR: + if HAS_INDICATOR and self._use_libappindicator: self._status_icon.set_icon_full(icon_name, _('Pending Event')) else: self._status_icon.set_visible(True) @@ -141,7 +142,7 @@ def update_icon(self, *args, count=0): return if app.settings.get('trayicon') == 'on_event': - if HAS_INDICATOR: + if HAS_INDICATOR and self._use_libappindicator: self._status_icon.set_status( appindicator.IndicatorStatus.PASSIVE) else: @@ -149,7 +150,7 @@ def update_icon(self, *args, count=0): show = get_global_show() icon_name = get_icon_name(show) - if HAS_INDICATOR: + if HAS_INDICATOR and self._use_libappindicator: self._status_icon.set_icon_full(icon_name, show) self._status_icon.set_status(appindicator.IndicatorStatus.ACTIVE) else: View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/14fa1c30663200665f5b3487add1b311…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/14fa1c30663200665f5b3487add1b311…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] 2 commits: Remote: Add TODO
by Daniel Brötzmann (ï¼ wurstsalat)
22 Nov '21
22 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: d249841a by wurstsalat at 2021-11-22T20:50:35+01:00 Remote: Add TODO - - - - - 9891ff3d by wurstsalat at 2021-11-22T20:54:23+01:00 Store message corrections in database Original text is preserved in additional_data, message text is overwritten with corrected text. - - - - - 10 changed files: - gajim/common/modules/mam.py - gajim/common/modules/message.py - gajim/common/storage/archive.py - gajim/gtk/chat_list.py - gajim/gtk/controls/base.py - gajim/gtk/controls/chat.py - gajim/gtk/controls/groupchat.py - gajim/gtk/conversation/rows/message.py - gajim/gtk/conversation/view.py - gajim/remote_control.py Changes: ===================================== gajim/common/modules/mam.py ===================================== @@ -257,6 +257,33 @@ def _mam_message_received(self, _con, stanza, properties): return stanza_id = message_id + event_attr = { + 'account': self._account, + 'jid': str(properties.jid.bare), + 'msgtxt': properties.body, + 'properties': properties, + 'additional_data': additional_data, + 'unique_id': properties.id, + 'stanza_id': stanza_id, + 'archive_jid': properties.mam.archive, + 'kind': kind, + } + + correct_id = parse_correction(properties) + if correct_id is not None: + event_attr.update({ + 'correct_id': correct_id, + }) + app.nec.push_incoming_event( + NetworkEvent('message-updated', **event_attr)) + app.storage.archive.store_message_correction( + self._account, + properties.jid.bare, + correct_id, + properties.body, + properties.type.is_groupchat) + return + app.storage.archive.insert_into_logs( self._account, with_, @@ -269,18 +296,7 @@ def _mam_message_received(self, _con, stanza, properties): message_id=properties.id) app.nec.push_incoming_event( - NetworkEvent('mam-message-received', - account=self._account, - additional_data=additional_data, - correct_id=parse_correction(properties), - stanza_id=stanza_id, - archive_jid=properties.mam.archive, - msgtxt=properties.body, - properties=properties, - kind=kind, - jid=str(properties.jid.bare) - ) - ) + NetworkEvent('mam-message-received', **event_attr)) def _is_valid_request(self, properties): valid_id = self._mam_query_ids.get(properties.mam.archive, None) ===================================== gajim/common/modules/message.py ===================================== @@ -180,17 +180,30 @@ def _message_received(self, _con, stanza, properties): 'resource': resource, 'stanza_id': stanza_id, 'unique_id': stanza_id or message_id, - 'correct_id': parse_correction(properties), 'msgtxt': msgtxt, 'session': session, 'delayed': properties.user_timestamp is not None, - 'gc_control': None, - 'popup': False, 'msg_log_id': None, 'displaymarking': displaymarking, 'properties': properties, } + correct_id = parse_correction(properties) + if correct_id is not None: + event_attr.update({ + 'correct_id': correct_id, + }) + event = NetworkEvent('message-updated', **event_attr) + if should_log(self._account, jid): + app.storage.archive.store_message_correction( + self._account, + jid, + correct_id, + msgtxt, + properties.type.is_groupchat) + app.nec.push_incoming_event(event) + return + if type_.is_groupchat: if not msgtxt: return @@ -381,6 +394,15 @@ def log_message(self, message): if message.message is None: return + if message.correct_id is not None: + app.storage.archive.store_message_correction( + self._account, + message.jid, + message.correct_id, + message.message, + message.is_groupchat) + return + app.storage.archive.insert_into_logs( self._account, message.jid, ===================================== gajim/common/storage/archive.py ===================================== @@ -29,6 +29,7 @@ import sqlite3 as sqlite from collections import namedtuple +from nbxmpp import JID from nbxmpp.structs import MessageProperties from gajim.common import app @@ -431,7 +432,7 @@ def get_last_conversation_line(self, account, jid): KindConstant.ERROR]) sql = ''' - SELECT contact_name, time, kind, message, stanza_id, + SELECT contact_name, time, kind, message, stanza_id, message_id, additional_data FROM logs NATURAL JOIN jids WHERE jid IN ({jids}) AND account_id = {account_id} @@ -923,6 +924,51 @@ def find_stanza_id(self, account, archive_jid, stanza_id, origin_id=None, return True return False + @timeit + def store_message_correction(self, + account: str, + jid: JID, + correct_id: str, + corrected_text: str, + is_groupchat: bool) -> None: + type_ = JIDConstant.NORMAL_TYPE + if is_groupchat: + type_ = JIDConstant.ROOM_TYPE + + jid_id = self.get_jid_id(str(jid), type_=type_) + account_id = self.get_account_id(account) + sql = ''' + SELECT log_line_id, message, additional_data + FROM logs + WHERE +jid_id = ? + AND account_id = ? + AND message_id = ? + ''' + row = self._con.execute( + sql, (jid_id, account_id, correct_id)).fetchone() + if row is None: + return + + if row.additional_data is None: + additional_data = AdditionalDataDict() + else: + additional_data = row.additional_data + + original_text = additional_data.get_value( + 'corrected', 'original_text') + if original_text is None: + # Only set original_text for the first correction + additional_data.set_value( + 'corrected', 'original_text', row.message) + serialized_dict = json.dumps(additional_data.data) + + sql = ''' + UPDATE logs SET message = ?, additional_data = ? + WHERE log_line_id = ? + ''' + self._con.execute( + sql, (corrected_text, serialized_dict, row.log_line_id)) + @timeit def update_additional_data(self, account: str, ===================================== gajim/gtk/chat_list.py ===================================== @@ -358,6 +358,7 @@ def _on_message_received(self, event): if event.properties.stanza_id: stanza_id = event.properties.stanza_id.id row.set_stanza_id(stanza_id) + row.set_message_id(event.unique_id) row.set_message_text( event.msgtxt, additional_data=event.additional_data) @@ -369,6 +370,10 @@ def _on_message_updated(self, event): if row is None: return + if hasattr(event, 'correct_id'): + if event.correct_id == row.message_id: + row.set_message_text(event.msgtxt) + if event.properties.is_moderation: if event.properties.moderation.stanza_id == row.stanza_id: text = get_retraction_text( @@ -483,6 +488,7 @@ def __init__(self, workspace_id: str, account: str, jid: JID, type_: str, self.contact_name: str = self.contact.name self.timestamp: int = 0 self.stanza_id: Optional[str] = None + self.message_id: Optional[str] = None self._unread_count: int = 0 self._pinned: bool = pinned @@ -542,6 +548,7 @@ def __init__(self, workspace_id: str, account: str, jid: JID, type_: str, self._ui.timestamp_label.set_text(uf_timestamp) self.stanza_id = line.stanza_id + self.message_id = line.message_id if line.kind in (KindConstant.FILE_TRANSFER_INCOMING, KindConstant.FILE_TRANSFER_OUTGOING): @@ -685,6 +692,9 @@ def set_timestamp(self, timestamp: int) -> None: def set_stanza_id(self, stanza_id: str) -> None: self.stanza_id = stanza_id + def set_message_id(self, message_id: str) -> None: + self.message_id = message_id + def update_time(self) -> None: if self.timestamp == 0: return ===================================== gajim/gtk/controls/base.py ===================================== @@ -296,6 +296,11 @@ def process_event(self, event): getattr(self, method_name)(event) def _on_message_updated(self, event): + if hasattr(event, 'correct_id'): + self.conversation_view.correct_message( + event.correct_id, event.msgtxt) + return + if event.properties.is_moderation: text = get_retraction_text( self.account, @@ -1122,7 +1127,6 @@ def add_message(self, msg_log_id=None, message_id=None, stanza_id=None, - correct_id=None, additional_data=None): if additional_data is None: @@ -1139,7 +1143,6 @@ def add_message(self, display_marking=displaymarking, message_id=message_id, stanza_id=stanza_id, - correct_id=correct_id, log_line_id=msg_log_id, additional_data=additional_data) ===================================== gajim/gtk/controls/chat.py ===================================== @@ -412,7 +412,6 @@ def _on_mam_message_received(self, event): self.add_message(event.msgtxt, kind, tim=event.properties.mam.timestamp, - correct_id=event.correct_id, message_id=event.properties.id, stanza_id=event.stanza_id, additional_data=event.additional_data, @@ -433,7 +432,6 @@ def _on_message_received(self, event): msg_log_id=event.msg_log_id, message_id=event.properties.id, stanza_id=event.stanza_id, - correct_id=event.correct_id, additional_data=event.additional_data) if kind == 'outgoing': @@ -460,12 +458,16 @@ def _on_message_sent(self, event): self.msg_textview.get_style_context().remove_class( 'gajim-msg-correcting') + if event.correct_id: + self.conversation_view.correct_message( + event.correct_id, event.message) + return + self.add_message(event.message, 'outgoing', tim=event.timestamp, displaymarking=displaymarking, message_id=message_id, - correct_id=event.correct_id, additional_data=event.additional_data) def _on_receipt_received(self, event): @@ -606,7 +608,6 @@ def add_message(self, displaymarking=None, msg_log_id=None, stanza_id=None, - correct_id=None, message_id=None, additional_data=None, notify=True): @@ -629,7 +630,6 @@ def add_message(self, msg_log_id=msg_log_id, message_id=message_id, stanza_id=stanza_id, - correct_id=correct_id, additional_data=additional_data) def shutdown(self): ===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -671,7 +671,6 @@ def _on_mam_message_received(self, event): self.add_message(event.msgtxt, contact=event.properties.muc_nickname, tim=event.properties.mam.timestamp, - correct_id=event.correct_id, message_id=event.properties.id, stanza_id=event.stanza_id, additional_data=event.additional_data, @@ -694,7 +693,6 @@ def _on_gc_message_received(self, event): contact=event.properties.muc_nickname, tim=event.properties.timestamp, displaymarking=event.displaymarking, - correct_id=event.correct_id, message_id=event.properties.id, stanza_id=stanza_id, additional_data=event.additional_data) @@ -708,7 +706,6 @@ def add_message(self, contact='', tim=None, displaymarking=None, - correct_id=None, message_id=None, stanza_id=None, additional_data=None, @@ -733,7 +730,6 @@ def add_message(self, tim, notify, displaymarking=displaymarking, - correct_id=correct_id, message_id=message_id, stanza_id=stanza_id, additional_data=additional_data) ===================================== gajim/gtk/conversation/rows/message.py ===================================== @@ -70,7 +70,6 @@ def __init__(self, self.kind = kind self.name = name or '' self.text = text - self.additional_data = additional_data self._contact = contact @@ -78,13 +77,11 @@ def __init__(self, if contact is not None and contact.is_groupchat: self._is_groupchat = True - self._corrections = [] self._has_receipt = marker == 'received' self._has_displayed = marker == 'displayed' - if additional_data is not None: - if additional_data.get_value('retracted', 'by') is not None: - self.get_style_context().add_class('retracted-message') + # Keep original text for message correction + self._original_text: str = text is_previewable = app.interface.preview_manager.is_previewable( text, additional_data) @@ -144,6 +141,21 @@ def __init__(self, self._message_icons = MessageIcons() + if additional_data is not None: + if additional_data.get_value('retracted', 'by') is not None: + self.get_style_context().add_class('retracted-message') + + correction_original = additional_data.get_value( + 'corrected', 'original_text') + if correction_original is not None: + self._original_text = correction_original + self._message_icons.set_correction_icon_visible(True) + original_text = reduce_chars_newlines( + correction_original, max_chars=150, max_lines=10) + self._message_icons.set_correction_tooltip( + _('Message corrected. Original message:' + '\n%s') % original_text) + if error is not None: self.set_error(to_user_string(error)) @@ -326,7 +338,6 @@ def set_retracted(self, text: str) -> None: self.get_style_context().add_class('retracted-message') def set_correction(self, text: str) -> None: - self._corrections.append(self._message_widget.get_text()) result = process(text) self._message_widget.add_content(result) @@ -334,11 +345,10 @@ def set_correction(self, text: str) -> None: self._message_icons.set_receipt_icon_visible(False) self._message_icons.set_correction_icon_visible(True) - corrections = '\n'.join(line for line in self._corrections) - corrections = reduce_chars_newlines( - corrections, max_chars=150, max_lines=10) + original_text = reduce_chars_newlines( + self._original_text, max_chars=150, max_lines=10) self._message_icons.set_correction_tooltip( - _('Message corrected. Original message:\n%s') % corrections) + _('Message corrected. Original message:\n%s') % original_text) def set_error(self, tooltip): self._message_icons.set_error_icon_visible(True) ===================================== gajim/gtk/conversation/view.py ===================================== @@ -212,7 +212,6 @@ def add_message(self, log_line_id=None, message_id=None, stanza_id=None, - correct_id=None, display_marking=None, additional_data=None, marker=None, @@ -221,10 +220,6 @@ def add_message(self, if not timestamp: timestamp = time.time() - if correct_id is not None: - self.correct_message(correct_id, text) - return - message = MessageRow( self._account, self._contact, ===================================== gajim/remote_control.py ===================================== @@ -348,6 +348,7 @@ def on_unsubscribed_presence_received(self, obj): def on_gc_message_received(self, obj): if not hasattr(obj, 'needs_highlight'): + # TODO: # event has not been handled at GUI level return self.raise_signal('GCMessage', (obj.conn.name, [obj.fjid, obj.msgtxt, View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/4dc79ca45426e17f247a11e0aeb404d…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/4dc79ca45426e17f247a11e0aeb404d…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Generate local version identifier only during development
by Philipp Hörist (ï¼ lovetox)
22 Nov '21
22 Nov '21
Philipp Hörist pushed to branch master at gajim / gajim Commits: 0138c5c9 by André Apitzsch at 2021-11-22T19:27:35+01:00 Generate local version identifier only during development Fixes #10678. - - - - - 2 changed files: - gajim/__init__.py - launch.py Changes: ===================================== gajim/__init__.py ===================================== @@ -1,4 +1,3 @@ -import subprocess import sys from pathlib import Path @@ -8,12 +7,3 @@ portable_path = Path(sys.executable).parent / 'is_portable' IS_PORTABLE = portable_path.exists() - -try: - p = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True, - stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) - node = p.communicate()[0] - if node: - __version__ += '+' + node.decode('utf-8').strip() -except Exception: - pass ===================================== launch.py ===================================== @@ -1,4 +1,16 @@ #!/usr/bin/env python3 +import subprocess from gajim import gajim + +try: + p = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True, + stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + node = p.communicate()[0] + if node: + import gajim as g + g.__version__ += '+' + node.decode('utf-8').strip() +except Exception: + pass + gajim.main() View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/0138c5c924296ae0e3f652c4542b6b94…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/0138c5c924296ae0e3f652c4542b6b94…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] 2 commits: Settings: Bind signals for ColorSetting and EntrySetting
by Daniel Brötzmann (ï¼ wurstsalat)
22 Nov '21
22 Nov '21
Daniel Brötzmann pushed to branch master at gajim / gajim Commits: 6b5e38dd by Daniel Brötzmann at 2021-11-22T09:19:35+00:00 Settings: Bind signals for ColorSetting and EntrySetting - - - - - 616211c5 by Daniel Brötzmann at 2021-11-22T09:19:35+00:00 AccountWizard: Add account badge preview - - - - - 3 changed files: - gajim/data/gui/account_wizard.ui - gajim/gtk/account_wizard.py - gajim/gtk/settings.py Changes: ===================================== gajim/data/gui/account_wizard.ui ===================================== @@ -1,7 +1,97 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.36.0 --> <interface> - <requires lib="gtk+" version="3.20"/> + <requires lib="gtk+" version="3.22"/> + <object class="GtkBox" id="account_label_box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Optional: Add a name and color for your account</property> + <property name="wrap">True</property> + <property name="max_width_chars">50</property> + <style> + <class name="dim-label"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <style> + <class name="linked"/> + </style> + <child> + <object class="GtkEntry" id="account_name_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="placeholder_text" translatable="yes">Account Name...</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkColorButton" id="account_color_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">go-down-symbolic</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="badge_preview"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <style> + <class name="badge"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> <object class="GtkGrid" id="advanced_grid"> <property name="visible">True</property> <property name="can_focus">False</property> ===================================== gajim/gtk/account_wizard.py ===================================== @@ -49,6 +49,8 @@ from .dataform import DataFormWidget from .util import get_builder from .util import open_window +from .util import get_color_for_account +from .util import get_app_window log = logging.getLogger('gajim.gui.account_wizard') @@ -969,14 +971,66 @@ def __init__(self): self.set_heading(_('Account has been added successfully')) self._account = None + self._our_jid = None + self._label = None + self._color = None + + self._ui = get_builder('account_wizard.ui') + self.pack_start(self._ui.account_label_box, True, True, 0) + + self._provider = self._add_css_provider() + + self._ui.account_name_entry.connect('changed', self._on_name_changed) + self._ui.account_color_button.connect('color-set', self._on_color_set) + + self.show_all() def set_account(self, account): self._account = account + self._our_jid = app.get_jid_from_account(account) + self._ui.badge_preview.set_text(self._our_jid) + rgba = Gdk.RGBA() + rgba.parse(get_color_for_account(self._our_jid)) + self._ui.account_color_button.set_rgba(rgba) + self._color = rgba.to_string() + self._set_badge_color(self._color) @property def account(self): return self._account + def _add_css_provider(self): + context = self._ui.badge_preview.get_style_context() + provider = Gtk.CssProvider() + context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) + return provider + + def _on_name_changed(self, entry): + self._label = entry.get_text() + self._ui.badge_preview.set_text(self._label or self._our_jid) + self._save_config() + + def _on_color_set(self, button): + rgba = button.get_rgba() + self._color = rgba.to_string() + self._set_badge_color(self._color) + self._save_config() + + def _set_badge_color(self, color): + css = '.badge { background-color: %s }' % color + self._provider.load_from_data(bytes(css.encode())) + + def _save_config(self): + app.settings.set_account_setting( + self._account, 'account_color', self._color) + if self._label: + app.settings.set_account_setting( + self._account, 'account_label', self._label) + app.css_config.refresh() + window = get_app_window('AccountsWindow') + if window is not None: + window.update_account_label(self._account) + def get_visible_buttons(self): return ['connect'] ===================================== gajim/gtk/settings.py ===================================== @@ -417,8 +417,21 @@ def __init__(self, *args): self.setting_box.pack_end(self.entry, True, True, 0) + app.settings.connect_signal(self.value, + self._on_setting_changed, + account=self.account, + jid=self.jid) + + self.connect('destroy', self._on_destroy) + self.show_all() + def _on_setting_changed(self, value, *args): + self.entry.set_text(value) + + def _on_destroy(self, *args): + app.settings.disconnect_signals(self) + def on_text_change(self, *args): text = self.entry.get_text() self.set_value(text) @@ -441,8 +454,23 @@ def __init__(self, *args): self.setting_box.pack_end(self.color_button, True, True, 0) + app.settings.connect_signal(self.value, + self._on_setting_changed, + account=self.account, + jid=self.jid) + + self.connect('destroy', self._on_destroy) + self.show_all() + def _on_setting_changed(self, value, *args): + rgba = Gdk.RGBA() + rgba.parse(value) + self.color_button.set_rgba(rgba) + + def _on_destroy(self, *args): + app.settings.disconnect_signals(self) + def on_color_set(self, button): rgba = button.get_rgba() self.set_value(rgba.to_string()) View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/c5dec94fe05439a45c41c972f026762…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/c5dec94fe05439a45c41c972f026762…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Preview: Typing
by Daniel Brötzmann (ï¼ wurstsalat)
21 Nov '21
21 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: 4dc79ca4 by wurstsalat at 2021-11-21T12:30:12+01:00 Preview: Typing - - - - - 5 changed files: - gajim/common/preview.py - gajim/common/preview_helpers.py - gajim/common/types.py - gajim/gtk/preview.py - gajim/gtk/preview_audio.py Changes: ===================================== gajim/common/preview.py ===================================== @@ -23,7 +23,6 @@ from urllib.parse import urlparse from urllib.parse import ParseResult -from gi.repository import GdkPixbuf from gi.repository import Gio from gi.repository import GLib from gi.repository import Soup @@ -45,6 +44,7 @@ from gajim.common.preview_helpers import get_image_paths from gajim.common.preview_helpers import guess_mime_type from gajim.common.preview_helpers import pixbuf_from_data +from gajim.common.types import GdkPixbufType log = logging.getLogger('gajim.c.preview') @@ -55,7 +55,7 @@ class Preview: - def __init__(self, + def __init__(self, uri: str, urlparts: Optional[ParseResult], orig_path: Optional[Path], @@ -139,7 +139,7 @@ def create_thumbnail(self, data: bytes) -> bool: return False return True - def update_widget(self, data: Optional[GdkPixbuf.Pixbuf] = None) -> None: + def update_widget(self, data: Optional[GdkPixbufType] = None) -> None: self._widget.update(self, data) ===================================== gajim/common/preview_helpers.py ===================================== @@ -285,12 +285,9 @@ def get_image_paths(uri: str, urlparts: ParseResult, size: int, orig_dir: Path, name_hash = hashlib.sha1(str(uri).encode()).hexdigest() - orig_filename = '%s_%s%s' % (web_stem, name_hash, extension) + orig_filename = f'{web_stem}_{name_hash}{extension}' - thumb_filename = '%s_%s_thumb_%s%s' % (web_stem, - name_hash, - size, - extension) + thumb_filename = f'{web_stem}_{name_hash}_thumb_{size}{extension}' orig_path = orig_dir / orig_filename thumb_path = thumb_dir / thumb_filename ===================================== gajim/common/types.py ===================================== @@ -23,6 +23,9 @@ from typing import TYPE_CHECKING from pathlib import Path + +from gi.repository import GdkPixbuf + import nbxmpp from nbxmpp.protocol import JID from nbxmpp.structs import BookmarkData @@ -61,9 +64,12 @@ # Plugins PluginExtensionPoints = Dict[str, Tuple[Optional[Callable[..., None]], Optional[Callable[..., None]]]] -EventHandlersDict = Dict[str, Tuple[int, Callable[['NetworkEvent'], Optional[bool]]]] +EventHandlersDict = Dict[ + str, Tuple[int, Callable[['NetworkEvent'], Optional[bool]]]] PluginEvents = List['NetworkEvent'] SettingsT = Union['Settings'] BookmarksDict = Dict[JID, BookmarkData] + +GdkPixbufType = Union[GdkPixbuf.Pixbuf, GdkPixbuf.PixbufAnimation] ===================================== gajim/gtk/preview.py ===================================== @@ -12,6 +12,8 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +from typing import Optional + import logging import shutil import os @@ -26,9 +28,11 @@ from gajim.common.helpers import open_file from gajim.common.helpers import open_uri from gajim.common.i18n import _ +from gajim.common.preview import Preview from gajim.common.preview_helpers import split_geo_uri from gajim.common.preview_helpers import contains_audio_streams from gajim.common.preview_helpers import get_icon_for_mime_type +from gajim.common.types import GdkPixbufType from .dialogs import ErrorDialog from .filechoosers import FileSaveDialog @@ -42,10 +46,10 @@ class PreviewWidget(Gtk.Box): - def __init__(self, account): + def __init__(self, account: str) -> None: Gtk.Box.__init__(self) self.account = account - self._preview = None + self._preview: Optional[Preview] = None if app.settings.get('use_kib_mib'): self._units = GLib.FormatSizeFlags.IEC_UNITS @@ -57,12 +61,12 @@ def __init__(self, account): self.add(self._ui.preview_box) self.show_all() - def get_text(self): + def get_text(self) -> str: if self._preview is None: return '' return self._preview.uri - def update(self, preview, data): + def update(self, preview: Preview, data: Optional[GdkPixbufType]) -> None: self._preview = preview if preview.is_geo_uri: @@ -114,7 +118,8 @@ def update(self, preview, data): self._ui.download_button.hide() self._ui.open_folder_button.show() self._ui.save_as_button.show() - if (preview.is_audio and app.is_installed('GST') and + if (preview.orig_path is not None and preview.is_audio and + app.is_installed('GST') and contains_audio_streams(preview.orig_path)): self._ui.image_button.hide() audio_widget = AudioWidget(preview.orig_path) @@ -223,7 +228,7 @@ def _on_open_link_in_browser(self, _menu): def _on_content_button_clicked(self, _button): action = app.settings.get('preview_leftclick_action') - method = getattr(self, '_on_%s' % action) + method = getattr(self, f'_on_{action}') method(None) def _on_button_press_event(self, _button, event): ===================================== gajim/gtk/preview_audio.py ===================================== @@ -13,6 +13,7 @@ # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. import logging +from pathlib import Path from gi.repository import GLib from gi.repository import Gtk @@ -26,12 +27,18 @@ class AudioWidget(Gtk.Box): - def __init__(self, file_path): + def __init__(self, file_path: Path) -> None: Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=6) - self._playbin = None - self._query = None - self._has_timeout = False + self._playbin = Gst.ElementFactory.make('playbin', 'bin') + if self._playbin is None: + label = Gtk.Label(label=_('Audio preview is not available')) + self.add(label) + log.debug('Could not create GST playbin') + return + + self._query = Gst.Query.new_position(Gst.Format.TIME) + self._has_timeout: bool = False self._build_audio_widget() self._setup_audio_player(file_path) @@ -67,18 +74,13 @@ def _build_audio_widget(self): self.connect('destroy', self._on_destroy) self.show_all() - def _setup_audio_player(self, file_path): - self._playbin = Gst.ElementFactory.make('playbin', 'bin') - if self._playbin is None: - log.debug('Could not create GST playbin') - return + def _setup_audio_player(self, file_path: Path) -> None: self._playbin.set_property('uri', f'file://{file_path}') state_return = self._playbin.set_state(Gst.State.PAUSED) if state_return == Gst.StateChangeReturn.FAILURE: log.debug('Could not setup GST playbin') return - self._query = Gst.Query.new_position(Gst.Format.TIME) bus = self._playbin.get_bus() bus.add_signal_watch() bus.connect('message', self._on_bus_message) @@ -111,11 +113,11 @@ def _on_play_clicked(self, _button): def _on_destroy(self, _widget): self._playbin.set_state(Gst.State.NULL) - def _get_paused(self): + def _get_paused(self) -> bool: _, state, _ = self._playbin.get_state(20) return state == Gst.State.PAUSED - def _set_pause(self, paused): + def _set_pause(self, paused: bool) -> None: if paused: self._playbin.set_state(Gst.State.PAUSED) self._play_icon.set_from_icon_name( @@ -127,7 +129,7 @@ def _set_pause(self, paused): 'media-playback-pause-symbolic', Gtk.IconSize.BUTTON) - def _update_seek_bar(self): + def _update_seek_bar(self) -> bool: if self._get_paused(): self._has_timeout = False return False @@ -138,7 +140,7 @@ def _update_seek_bar(self): return True @staticmethod - def _format_audio_timestamp(_widget, ns): + def _format_audio_timestamp(_widget: Gtk.Widget, ns: int) -> str: seconds = ns / 1000000000 minutes = seconds / 60 hours = minutes / 60 View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/4dc79ca45426e17f247a11e0aeb404d1…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/4dc79ca45426e17f247a11e0aeb404d1…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Add message to Control if it's loaded
by Daniel Brötzmann (ï¼ wurstsalat)
20 Nov '21
20 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: 2804e759 by wurstsalat at 2021-11-20T12:37:25+01:00 Add message to Control if it's loaded This avoids messages not being added to a conversation when switching to another workspace, then switching back to the same chat. - - - - - 3 changed files: - gajim/gtk/chat_page.py - gajim/gtk/controls/base.py - gajim/gtk/main.py Changes: ===================================== gajim/gtk/chat_page.py ===================================== @@ -82,7 +82,7 @@ def __init__(self): self._ui.paned.set_position(app.settings.get('chat_handle_position')) self._ui.paned.connect('button-release-event', self._on_button_release) - self._active_control: Optional[BaseControl] = None + self._currently_loaded_control: Optional[BaseControl] = None self._startup_finished: bool = False self._add_actions() @@ -142,11 +142,11 @@ def _on_chat_selected(self, _chat_list_stack: ChatListStack, control = self.get_control(account, jid) if control is None: return - if self._active_control != control: - if self._active_control is not None: - self._active_control.set_control_active(False) + if self._currently_loaded_control != control: + if self._currently_loaded_control is not None: + self._currently_loaded_control.set_control_active(False) control.set_control_active(True) - self._active_control = control + self._currently_loaded_control = control def _on_chat_unselected(self, _chat_list_stack): self._chat_stack.clear() @@ -284,6 +284,9 @@ def get_active_control(self) -> Optional[BaseControl]: return None return self.get_control(chat.account, chat.jid) + def get_currently_loaded_control(self) -> Optional[BaseControl]: + return self._currently_loaded_control + def get_controls(self, account: Optional[str] ) -> Generator[BaseControl, None, None]: return self._chat_stack.get_controls(account) ===================================== gajim/gtk/controls/base.py ===================================== @@ -1101,12 +1101,14 @@ def add_file_transfer(self, transfer): self.conversation_view.add_file_transfer(transfer) def add_jingle_file_transfer(self, event): - control_selected = bool(self == app.window.get_active_control()) + control_selected = bool( + self == app.window.get_currently_loaded_control()) if self._scrolled_view.get_lower_complete() and control_selected: self.conversation_view.add_jingle_file_transfer(event) def add_call_message(self, event): - control_selected = bool(self == app.window.get_active_control()) + control_selected = bool( + self == app.window.get_currently_loaded_control()) if self._scrolled_view.get_lower_complete() and control_selected: self.conversation_view.add_call_message(event=event) @@ -1126,7 +1128,8 @@ def add_message(self, if additional_data is None: additional_data = AdditionalDataDict() - control_selected = bool(self == app.window.get_active_control()) + control_selected = bool( + self == app.window.get_currently_loaded_control()) if self._scrolled_view.get_lower_complete() and control_selected: self.conversation_view.add_message( text, ===================================== gajim/gtk/main.py ===================================== @@ -480,6 +480,9 @@ def get_controls(self, account: Optional[str] = None def get_active_control(self) -> Optional[BaseControl]: return self._chat_page.get_active_control() + def get_currently_loaded_control(self) -> Optional[BaseControl]: + return self._chat_page.get_currently_loaded_control() + def chat_exists(self, account: str, jid: JID) -> bool: return self._chat_page.chat_exists(account, jid) View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/2804e759eee439eb5d660368358b685a…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/2804e759eee439eb5d660368358b685a…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] 3 commits: Add typing for getting Controls
by Daniel Brötzmann (ï¼ wurstsalat)
19 Nov '21
19 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: 20fa4dfd by wurstsalat at 2021-11-19T22:14:02+01:00 Add typing for getting Controls - - - - - 0f2bdbd2 by wurstsalat at 2021-11-19T22:33:47+01:00 Settings: Add missing return types - - - - - f2b1299f by wurstsalat at 2021-11-19T23:00:26+01:00 AddContact: Typing - - - - - 9 changed files: - gajim/app_actions.py - gajim/common/settings.py - gajim/gtk/add_contact.py - gajim/gtk/chat_page.py - gajim/gtk/chat_stack.py - gajim/gtk/main.py - gajim/gtk/notification_manager.py - gajim/gtk/search_view.py - gajim/gui_interface.py Changes: ===================================== gajim/app_actions.py ===================================== @@ -34,7 +34,7 @@ def on_add_contact_jid(_action, param): - jid = param.get_string() + jid = JID.from_string(param.get_string()) open_window('AddContact', account=None, jid=jid) @@ -112,6 +112,8 @@ def on_create_gc(_action, param): def on_add_contact(_action, param): account, jid = param.get_strv() + if jid is not None: + jid = JID.from_string(jid) open_window('AddContact', account=account or None, jid=jid or None) ===================================== gajim/common/settings.py ===================================== @@ -967,14 +967,14 @@ def get_workspace_setting(self, except KeyError: return WORKSPACE_SETTINGS[setting] - def get_workspaces(self) -> None: + def get_workspaces(self) -> List[str]: workspace_order = app.settings.get_app_setting('workspace_order') def sort_workspaces(workspace_id): try: return workspace_order.index(workspace_id) except ValueError: - # Handle the case that a workflow id is for some reason not + # Handle the case that a workspace id is for some reason not # in the workspace order list return 10000 @@ -982,7 +982,7 @@ def sort_workspaces(workspace_id): workspaces.sort(key=sort_workspaces) return workspaces - def add_workspace(self, name: str) -> None: + def add_workspace(self, name: str) -> str: id_ = str(uuid.uuid4()) self._settings['workspaces'][id_] = { 'name': name, ===================================== gajim/gtk/add_contact.py ===================================== @@ -12,10 +12,15 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +from typing import Tuple +from typing import Optional +from typing import Any + import logging from gi.repository import Gtk +from nbxmpp import JID from nbxmpp import Namespace from nbxmpp.errors import is_error @@ -37,7 +42,10 @@ class AddContact(Assistant): - def __init__(self, account=None, jid=None, nick=None): + def __init__(self, + account: Optional[str] = None, + jid: Optional[JID] = None, + nick: str = None): Assistant.__init__(self) self.account = account self.jid = jid @@ -106,7 +114,7 @@ def _on_button_clicked(self, _assistant, button_name): open_window('GroupchatJoin', account=account, jid=jid) self.destroy() - def _start_disco(self): + def _start_disco(self) -> None: self._result = None self.show_page('progress', Gtk.StackTransitionType.SLIDE_LEFT) @@ -185,7 +193,7 @@ def _process_info(self, account, result): class Address(Page): - def __init__(self, account, jid): + def __init__(self, account: Optional[str], jid: Optional[JID]) -> None: Page.__init__(self) self.title = _('Add Contact') @@ -227,10 +235,10 @@ def get_visible_buttons(self): def get_default_button(self): return 'next' - def get_account_and_jid(self): + def get_account_and_jid(self) -> Tuple[Optional[str], Any]: return self._account, self._ui.address_entry.get_text() - def focus(self): + def focus(self) -> None: self._ui.address_entry.grab_focus() def _on_account_changed(self, combobox): @@ -274,7 +282,7 @@ def _set_complete(self, *args): self.complete = self._validate_address(address) self.update_page_complete() - def _validate_address(self, address): + def _validate_address(self, address: str) -> bool: if not address: self._show_icon(False) return False @@ -339,7 +347,7 @@ def prepare(self, account, result): self._ui.message_entry.set_text(get_subscription_request_msg(account)) self._ui.contact_grid.set_sensitive(True) - def _update_groups(self, account): + def _update_groups(self, account: str) -> None: self._ui.group_combo.get_model().clear() client = app.get_client(account) for group in client.get_module('Roster').get_groups(): ===================================== gajim/gtk/chat_page.py ===================================== @@ -12,6 +12,9 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +from typing import Optional +from typing import Generator + from gi.repository import Gtk from gi.repository import GLib from gi.repository import Gio @@ -21,6 +24,7 @@ from gajim.common import app +from .controls.base import BaseControl from .util import get_builder from .chat_filter import ChatFilter from .chat_list import ChatList @@ -62,7 +66,6 @@ def __init__(self): self._ui.filter_bar_toggle.connect( 'toggled', self._on_filter_revealer_toggled) - self._active_control = None self._chat_list_stack = ChatListStack( self._chat_filter, self._ui.search_entry) self._chat_list_stack.connect('chat-selected', self._on_chat_selected) @@ -79,6 +82,7 @@ def __init__(self): self._ui.paned.set_position(app.settings.get('chat_handle_position')) self._ui.paned.connect('button-release-event', self._on_button_release) + self._active_control: Optional[BaseControl] = None self._startup_finished: bool = False self._add_actions() @@ -136,6 +140,8 @@ def _on_chat_selected(self, _chat_list_stack: ChatListStack, self.emit('chat-selected', workspace_id, account, jid) control = self.get_control(account, jid) + if control is None: + return if self._active_control != control: if self._active_control is not None: self._active_control.set_control_active(False) @@ -269,16 +275,17 @@ def remove_chats_for_account(self, account: str) -> None: self._chat_list_stack.remove_chats_for_account(account) self._chat_stack.remove_chats_for_account(account) - def get_control(self, account, jid): + def get_control(self, account: str, jid: JID) -> Optional[BaseControl]: return self._chat_stack.get_control(account, jid) - def get_active_control(self): + def get_active_control(self) -> Optional[BaseControl]: chat = self._chat_list_stack.get_selected_chat() if chat is None: return None return self.get_control(chat.account, chat.jid) - def get_controls(self, account=None): + def get_controls(self, account: Optional[str] + ) -> Generator[BaseControl, None, None]: return self._chat_stack.get_controls(account) def hide_search(self) -> bool: ===================================== gajim/gtk/chat_stack.py ===================================== @@ -12,17 +12,25 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +from typing import Dict +from typing import Tuple +from typing import Optional +from typing import Generator + import logging from gi.repository import GLib from gi.repository import Gtk +from nbxmpp import JID + from gajim.common import ged from gajim.common.i18n import _ -from gajim.gui.controls.chat import ChatControl -from gajim.gui.controls.groupchat import GroupchatControl -from gajim.gui.controls.private import PrivateChatControl +from .controls.base import BaseControl +from .controls.chat import ChatControl +from .controls.groupchat import GroupchatControl +from .controls.private import PrivateChatControl from .util import EventHelper @@ -45,16 +53,17 @@ def __init__(self): ]) self.show_all() - self._controls = {} - self._active_control = None + self._controls: Dict[Tuple[str, JID], BaseControl] = {} + self._active_control: Optional[BaseControl] = None - def get_control(self, account, jid): + def get_control(self, account: str, jid: JID) -> Optional[BaseControl]: try: return self._controls[(account, jid)] except KeyError: return None - def get_controls(self, account=None): + def get_controls(self, account: Optional[str] + ) -> Generator[BaseControl, None, None]: if account is None: for control in self._controls.values(): yield control @@ -64,7 +73,7 @@ def get_controls(self, account=None): if key[0] == account: yield control - def add_chat(self, account, jid): + def add_chat(self, account: str, jid: JID) -> None: if self._controls.get((account, jid)) is not None: # Control is already in the Stack return @@ -74,7 +83,7 @@ def add_chat(self, account, jid): self.add_named(chat_control.widget, f'{account}:{jid}') chat_control.widget.show_all() - def add_group_chat(self, account, jid): + def add_group_chat(self, account: str, jid: JID) -> None: if self._controls.get((account, jid)) is not None: return @@ -83,36 +92,39 @@ def add_group_chat(self, account, jid): self.add_named(control.widget, f'{account}:{jid}') control.widget.show_all() - def add_private_chat(self, account, jid): + def add_private_chat(self, account: str, jid: JID) -> None: control = PrivateChatControl(account, jid) - self._controls[(account, str(jid))] = control + self._controls[(account, jid)] = control self.add_named(control.widget, f'{account}:{jid}') control.widget.show_all() - def remove_chat(self, account, jid): + def remove_chat(self, account: str, jid: JID) -> None: control = self._controls.pop((account, jid)) if control == self._active_control: self._active_control = None self.remove(control.widget) control.shutdown() - def show_chat(self, account, jid): + def show_chat(self, account: str, jid: JID) -> None: self.set_visible_child_name(f'{account}:{jid}') control = self.get_control(account, jid) + if control is None: + log.warning('No Control found for %s, %s', account, jid) + return if control != self._active_control: if self._active_control is not None: self._active_control.reset_view() self._active_control = control GLib.idle_add(control.focus) - def clear(self): + def clear(self) -> None: self.set_visible_child_name('empty') def process_event(self, event): control = self.get_control(event.account, event.jid) control.process_event(event) - def remove_chats_for_account(self, account): + def remove_chats_for_account(self, account: str) -> None: for chat_account, jid in list(self._controls.keys()): if chat_account != account: continue ===================================== gajim/gtk/main.py ===================================== @@ -1,4 +1,5 @@ from typing import Optional +from typing import Generator import logging import os @@ -18,6 +19,7 @@ from gajim.common.nec import EventHelper from gajim.common.modules.bytestream import is_transfer_active +from .controls.base import BaseControl from .adhoc import AdHocCommand from .account_side_bar import AccountSideBar from .app_side_bar import AppSideBar @@ -47,7 +49,7 @@ def __init__(self): app.window = self - self._startup_finished = False + self._startup_finished: bool = False self._ui = get_builder('main.ui') @@ -110,7 +112,7 @@ def __init__(self): app.interface.systray.connect_unread_changed( self._chat_page.get_chat_list_stack()) - def _prepare_window(self): + def _prepare_window(self) -> None: if app.settings.get('main_window_skip_taskbar'): self.set_property('skip-taskbar-hint', True) @@ -457,7 +459,7 @@ def select_chat_number(self, number: int) -> None: @staticmethod def _add_to_roster(_action, param): _workspace, account, jid = param.unpack() - open_window('AddContact', account=account, jid=jid) + open_window('AddContact', account=account, jid=JID.from_string(jid)) def show_app_page(self) -> None: self._account_side_bar.unselect_all() @@ -468,17 +470,18 @@ def add_app_message(self, category: str, message: Optional[str] = None) -> None: self._app_page.add_app_message(category, message) - def get_control(self, *args, **kwargs): - return self._chat_page.get_control(*args, **kwargs) + def get_control(self, account: str, jid: JID) -> Optional[BaseControl]: + return self._chat_page.get_control(account, jid) - def get_controls(self, *args, **kwargs): - return self._chat_page.get_controls(*args, **kwargs) + def get_controls(self, account: Optional[str] = None + ) -> Generator[BaseControl, None, None]: + return self._chat_page.get_controls(account) - def get_active_control(self, *args, **kwargs): - return self._chat_page.get_active_control(*args, **kwargs) + def get_active_control(self) -> Optional[BaseControl]: + return self._chat_page.get_active_control() - def chat_exists(self, *args, **kwargs): - return self._chat_page.chat_exists(*args, **kwargs) + def chat_exists(self, account: str, jid: JID) -> bool: + return self._chat_page.chat_exists(account, jid) def get_total_unread_count(self) -> int: chat_list_stack = self._chat_page.get_chat_list_stack() ===================================== gajim/gtk/notification_manager.py ===================================== @@ -17,6 +17,8 @@ from gi.repository import Gtk from gi.repository import Pango +from nbxmpp import JID + from gajim.common import app from gajim.common.const import AvatarSize from gajim.common.i18n import _ @@ -96,6 +98,7 @@ def _on_subscription_accept(self, _action, param): jid = param.get_string() row = self._get_notification_row(jid) self._client.get_module('Presence').subscribed(jid) + jid = JID.from_string(jid) contact = self._client.get_module('Contacts').get_contact(jid) if not contact.is_in_roster: open_window('AddContact', account=self._account, ===================================== gajim/gtk/search_view.py ===================================== @@ -260,7 +260,8 @@ def _on_row_activated(_listbox, row): jid = JID.from_string(row.jid) app.window.add_chat(row.account, jid, row.type, select=True) control = app.window.get_active_control() - control.scroll_to_message(row.log_line_id, row.timestamp) + if control is not None: + control.scroll_to_message(row.log_line_id, row.timestamp) def set_focus(self): self._ui.search_entry.grab_focus() ===================================== gajim/gui_interface.py ===================================== @@ -674,6 +674,8 @@ def start_chat_from_jid(self, account, jid, message=None): app.window.select_chat(account, JID.from_string(jid)) if message is not None: control = app.window.get_control(account, jid) + if control is None: + return control.msg_textview.insert_text(message) return View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/06b95fba3ffec47620da71e95899447…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/06b95fba3ffec47620da71e95899447…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] 6 commits: ChatList: Typing
by Daniel Brötzmann (ï¼ wurstsalat)
18 Nov '21
18 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: 0d1ad62e by wurstsalat at 2021-11-18T23:12:49+01:00 ChatList: Typing - - - - - fb0ceae5 by wurstsalat at 2021-11-18T23:14:37+01:00 ChatListStack: Typing - - - - - 67838d35 by wurstsalat at 2021-11-18T23:21:10+01:00 ChatPage: Typing - - - - - 3a18ff71 by wurstsalat at 2021-11-18T23:23:21+01:00 MainStack: Typing - - - - - ce1966b0 by wurstsalat at 2021-11-18T23:31:10+01:00 Main: Typing - - - - - 06b95fba by wurstsalat at 2021-11-18T23:32:05+01:00 Respect types for app.window methods - - - - - 11 changed files: - gajim/app_actions.py - gajim/gtk/adhoc_muc.py - gajim/gtk/chat_list.py - gajim/gtk/chat_list_stack.py - gajim/gtk/chat_page.py - gajim/gtk/main.py - gajim/gtk/main_stack.py - gajim/gtk/roster.py - gajim/gtk/search_view.py - gajim/gtk/start_chat.py - gajim/gui_interface.py Changes: ===================================== gajim/app_actions.py ===================================== @@ -227,7 +227,7 @@ def on_open_event(_action, param): def on_mark_as_read(_action, param): dict_ = param.unpack() account, jid = dict_['account'], dict_['jid'] - app.window.mark_as_read(account, jid) + app.window.mark_as_read(account, JID.from_string(jid)) # Other Actions ===================================== gajim/gtk/adhoc_muc.py ===================================== @@ -18,6 +18,8 @@ from gi.repository import Gtk from gi.repository import Gdk +from nbxmpp import JID + from gajim.common import app from gajim.common.i18n import _ @@ -154,5 +156,5 @@ def _on_invite_clicked(self, _widget): } app.interface.create_groupchat(self.account, room_jid, config) - app.window.select_chat(self.account, room_jid) + app.window.select_chat(self.account, JID.from_string(room_jid)) self.destroy() ===================================== gajim/gtk/chat_list.py ===================================== @@ -12,15 +12,21 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +from typing import Dict +from typing import Tuple +from typing import Optional +from typing import Any + import logging import time -from typing import Optional from gi.repository import Gio from gi.repository import Gdk from gi.repository import GLib from gi.repository import Gtk +from nbxmpp import JID + from gajim.common import app from gajim.common import ged from gajim.common.const import AvatarSize @@ -48,10 +54,10 @@ def __init__(self, workspace_id): Gtk.ListBox.__init__(self) EventHelper.__init__(self) - self._chats = {} - self._current_filter = 'all' - self._current_filter_text = '' - self._workspace_id = workspace_id + self._chats: Dict[Tuple[str, JID], Any] = {} + self._current_filter: str = 'all' + self._current_filter_text: str = '' + self._workspace_id: str = workspace_id self.get_style_context().add_class('chatlist') self.set_filter_func(self._filter_func) @@ -59,7 +65,7 @@ def __init__(self, workspace_id): self.set_sort_func(self._sort_func) self._set_placeholder() - self._mouseover = False + self._mouseover: bool = False self.connect('enter-notify-event', self._on_mouse_focus_changed) self.connect('leave-notify-event', self._on_mouse_focus_changed) @@ -76,37 +82,37 @@ def __init__(self, workspace_id): self.show_all() @property - def workspace_id(self): + def workspace_id(self) -> str: return self._workspace_id - def get_unread_count(self): + def get_unread_count(self) -> int: return sum([chats.unread_count for chats in self._chats.values()]) - def get_chat_unread_count(self, account, jid): + def get_chat_unread_count(self, account: str, jid: JID) -> Optional[int]: chat = self._chats.get((account, jid)) if chat is not None: return chat.unread_count return None - def mark_as_read(self, account, jid): + def mark_as_read(self, account: str, jid: JID) -> None: chat = self._chats.get((account, jid)) if chat is not None: chat.reset_unread() self.emit_unread_changed() - def emit_unread_changed(self): + def emit_unread_changed(self) -> None: count = self.get_unread_count() self.get_parent().emit('unread-count-changed', self._workspace_id, count) - def is_visible(self): + def is_visible(self) -> bool: return self.get_parent().get_property('child-widget') == self def _on_destroy(self, *args): GLib.source_remove(self._timer_id) - def _update_timer(self): + def _update_timer(self) -> bool: self.update_time() return True @@ -166,10 +172,7 @@ def _sort_func(self, row1, row2): return 1 # Sort by timestamp - if row1.timestamp > row2.timestamp: - return -1 - if row2.timestamp > row1.timestamp: - return 1 + return -1 if row1.timestamp > row2.timestamp else 1 def _on_mouse_focus_changed(self, _widget, event): if event.type == Gdk.EventType.ENTER_NOTIFY: @@ -180,7 +183,7 @@ def _on_mouse_focus_changed(self, _widget, event): # Not hovering a Gtk.ListBoxRow (row is INFERIOR) self._mouseover = False - def _set_placeholder(self): + def _set_placeholder(self) -> None: button = Gtk.Button.new_with_label(_('Start Chat')) button.get_style_context().add_class('suggested-action') button.set_halign(Gtk.Align.CENTER) @@ -193,19 +196,22 @@ def _set_placeholder(self): def _on_start_chat_clicked(_widget): app.app.activate_action('start-chat', GLib.Variant('s', '')) - def set_filter(self, name): + def set_filter(self, name: str) -> None: self._current_filter = name self.invalidate_filter() - def set_filter_text(self, text): + def set_filter_text(self, text: str) -> None: self._current_filter_text = text self.invalidate_filter() - def get_chat_type(self, account, jid): + def get_chat_type(self, account: str, jid: JID) -> Optional[str]: row = self._chats.get((account, jid)) - return row.type + if row is not None: + return row.type + return None - def add_chat(self, account, jid, type_, pinned=False): + def add_chat(self, account: str, jid: JID, type_: str, + pinned: bool = False) -> None: if self._chats.get((account, jid)) is not None: # Chat is already in the List return @@ -214,19 +220,21 @@ def add_chat(self, account, jid, type_, pinned=False): self._chats[(account, jid)] = row self.add(row) - def select_chat(self, account, jid): + def select_chat(self, account: str, jid: JID) -> None: row = self._chats[(account, jid)] self.select_row(row) - def select_next_chat(self, forwards, unread_first=False): + def select_next_chat(self, forwards: bool, + unread_first: bool = False) -> None: # Selects the next chat, but prioritizes chats with unread messages. # Direction is forwards (True) or backwards (False) row = self.get_selected_chat() if row is None: row = self.get_row_at_index(0) - if row is not None: - self.select_chat(row.account, row.jid) + if row is None: return + self.select_chat(row.account, row.jid) + return unread_found = False if unread_first: @@ -245,6 +253,8 @@ def select_next_chat(self, forwards, unread_first=False): index = len(self.get_children()) - 1 row = self.get_row_at_index(index) + if row is None: + return if row.unread_count > 0: unread_found = True break @@ -271,37 +281,38 @@ def select_next_chat(self, forwards, unread_first=False): self.select_chat(next_row.account, next_row.jid) - def select_chat_number(self, number): + def select_chat_number(self, number: int) -> None: row = self.get_row_at_index(number) if row is not None: self.select_chat(row.account, row.jid) - def toggle_chat_pinned(self, account, jid): + def toggle_chat_pinned(self, account: str, jid: JID) -> None: row = self._chats[(account, jid)] row.toggle_pinned() self.invalidate_sort() - def remove_chat(self, account, jid, emit_unread=True): + def remove_chat(self, account: str, jid: JID, + emit_unread: bool = True) -> None: row = self._chats.pop((account, jid)) self.remove(row) row.destroy() if emit_unread: self.emit_unread_changed() - def remove_chats_for_account(self, account): + def remove_chats_for_account(self, account: str) -> None: for row_account, jid in list(self._chats.keys()): if row_account != account: continue self.remove_chat(account, jid) self.emit_unread_changed() - def get_selected_chat(self): + def get_selected_chat(self) -> Optional[Any]: row = self.get_selected_row() if row is None: return None return row - def contains_chat(self, account, jid): + def contains_chat(self, account: str, jid: JID) -> bool: return self._chats.get((account, jid)) is not None def get_open_chats(self): @@ -310,7 +321,7 @@ def get_open_chats(self): open_chats.append(key + (value.type, value.is_pinned)) return open_chats - def update_time(self): + def update_time(self) -> None: for _key, row in self._chats.items(): row.update_time() @@ -448,7 +459,8 @@ def _on_bookmarks_received(self, _event): class ChatRow(Gtk.ListBoxRow): - def __init__(self, workspace_id, account, jid, type_, pinned): + def __init__(self, workspace_id: str, account: str, jid: JID, type_: str, + pinned: bool) -> None: Gtk.ListBoxRow.__init__(self) self.account = account @@ -468,11 +480,11 @@ def __init__(self, workspace_id, account, jid, type_, pinned): self.contact.connect('caps-update', self._on_avatar_update) self.contact.connect('avatar-update', self._on_avatar_update) - self.contact_name = self.contact.name - self.timestamp = 0 + self.contact_name: str = self.contact.name + self.timestamp: int = 0 self.stanza_id: Optional[str] = None - self._unread_count = 0 - self._pinned = pinned + self._unread_count: int = 0 + self._pinned: bool = pinned self.get_style_context().add_class('chatlist-row') @@ -550,14 +562,14 @@ def __init__(self, workspace_id, account, jid, type_, pinned): self.show_all() @property - def header(self): + def header(self) -> Optional[RowHeaderType]: header = self.get_header() if header is None: return None return header.type @header.setter - def header(self, type_): + def header(self, type_: RowHeaderType) -> None: if type_ == self.header: return if type_ is None: @@ -570,7 +582,7 @@ def header(self, type_): self.set_header(self.conversations_label) @property - def is_pinned(self): + def is_pinned(self) -> bool: return self._pinned def _on_button_press(self, _widget, event): @@ -592,7 +604,7 @@ def _popup_menu(self, event): popover.set_pointing_to(rectangle) popover.popup() - def toggle_pinned(self): + def toggle_pinned(self) -> None: self._pinned = not self._pinned def _on_presence_update(self, _contact, _signal_name): @@ -601,12 +613,12 @@ def _on_presence_update(self, _contact, _signal_name): def _on_avatar_update(self, _contact, _signal_name): self.update_avatar() - def update_avatar(self): + def update_avatar(self) -> None: scale = self.get_scale_factor() surface = self.contact.get_avatar(AvatarSize.ROSTER, scale) self._ui.avatar_image.set_from_surface(surface) - def update_name(self): + def update_name(self) -> None: if self.type == 'pm': client = app.get_client(self.account) muc_name = get_groupchat_name(client, self.jid.bare) @@ -618,7 +630,7 @@ def update_name(self): self.contact_name = _('Note to myself') self._ui.name_label.set_text(self.contact_name) - def update_account_identifier(self): + def update_account_identifier(self) -> None: account_class = app.css_config.get_dynamic_class(self.account) self._ui.account_identifier.get_style_context().add_class(account_class) show = len(app.settings.get_active_accounts()) > 1 @@ -634,22 +646,22 @@ def _on_nickname_update(self, _contact, _signal_name): self.update_name() @property - def unread_count(self): + def unread_count(self) -> int: return self._unread_count @unread_count.setter - def unread_count(self, value): + def unread_count(self, value: int) -> None: self._unread_count = value self._update_unread() self.get_parent().emit_unread_changed() @property - def is_active(self): + def is_active(self) -> bool: return (self.is_selected() and self.get_toplevel().get_property('is-active')) @property - def is_recent(self): + def is_recent(self) -> bool: if self._unread_count: return True return False @@ -666,20 +678,20 @@ def _on_close_button_clicked(self, _button): 'remove-chat', GLib.Variant('as', [self.account, str(self.jid)])) - def set_timestamp(self, timestamp): + def set_timestamp(self, timestamp: int) -> None: self.timestamp = timestamp self.update_time() def set_stanza_id(self, stanza_id: str) -> None: self.stanza_id = stanza_id - def update_time(self): + def update_time(self) -> None: if self.timestamp == 0: return self._ui.timestamp_label.set_text( get_uf_relative_time(self.timestamp)) - def _update_unread(self): + def _update_unread(self) -> None: unread_count = self._get_unread_string(self._unread_count) self._ui.unread_label.set_text(unread_count) self._ui.unread_label.set_visible(bool(self._unread_count)) @@ -690,7 +702,7 @@ def _get_unread_string(count: int) -> str: return str(count) return '999+' - def add_unread(self): + def add_unread(self) -> None: control = app.window.get_control(self.account, self.jid) if self.is_active and control.get_autoscroll(): return @@ -699,12 +711,12 @@ def add_unread(self): if self.unread_count == 1: self.changed() - def reset_unread(self): + def reset_unread(self) -> None: if not self.unread_count: return self.unread_count = 0 - def set_nick(self, nickname): + def set_nick(self, nickname: str) -> None: self._ui.nick_label.set_visible(bool(nickname)) self._ui.nick_label.set_text(nickname) @@ -734,7 +746,7 @@ def set_message_text(self, text: str, icon_name: Optional[str] = None, class BaseHeader(Gtk.Box): - def __init__(self, row_type, text): + def __init__(self, row_type: RowHeaderType, text: str) -> None: Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.type = row_type label = Gtk.Label(label=text) ===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -12,6 +12,9 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +from typing import Dict +from typing import Optional + from gi.repository import Gtk from gi.repository import GObject from gi.repository import Gio @@ -21,7 +24,8 @@ from gajim.common import app -from gajim.gui.chat_list import ChatList +from .chat_list import ChatList +from .chat_list import ChatRow HANDLED_EVENTS = [ @@ -45,13 +49,13 @@ class ChatListStack(Gtk.Stack): (str, int)), 'chat-selected': (GObject.SignalFlags.RUN_LAST, None, - (str, str, str)), + (str, str, object)), 'chat-unselected': (GObject.SignalFlags.RUN_LAST, None, ()), 'chat-removed': (GObject.SignalFlags.RUN_LAST, None, - (str, str, str)), + (str, object, str)), } def __init__(self, chat_filter, search_entry): @@ -60,9 +64,9 @@ def __init__(self, chat_filter, search_entry): self.set_vexpand(True) self.set_vhomogeneous(False) - self._chat_lists = {} + self._chat_lists: Dict[str, ChatList] = {} - self._last_visible_child_name = 'default' + self._last_visible_child_name: str = 'default' self.add_named(Gtk.Box(), 'default') @@ -104,23 +108,23 @@ def _on_visible_child_name(self, _stack, _param): child.set_filter_text('') self._last_visible_child_name = self.get_visible_child_name() - def get_chatlist(self, workspace_id): + def get_chatlist(self, workspace_id: str) -> ChatList: return self._chat_lists[workspace_id] - def get_selected_chat(self): + def get_selected_chat(self) -> Optional[ChatRow]: chat_list = self.get_current_chat_list() if chat_list is None: return None return chat_list.get_selected_chat() - def get_current_chat_list(self): + def get_current_chat_list(self) -> Optional[ChatList]: workspace_id = self.get_visible_child_name() if workspace_id == 'empty': return None return self._chat_lists[workspace_id] - def is_chat_active(self, account, jid): + def is_chat_active(self, account: str, jid: JID) -> bool: chat = self.get_selected_chat() if chat is None: return False @@ -136,7 +140,7 @@ def _on_search_changed(self, search_entry): chat_list = self.get_visible_child() chat_list.set_filter_text(search_entry.get_text()) - def add_chat_list(self, workspace_id): + def add_chat_list(self, workspace_id: str) -> ChatList: chat_list = ChatList(workspace_id) chat_list.connect('row-selected', self._on_row_selected) @@ -144,7 +148,7 @@ def add_chat_list(self, workspace_id): self.add_named(chat_list, workspace_id) return chat_list - def remove_chat_list(self, workspace_id): + def remove_chat_list(self, workspace_id: str) -> None: chat_list = self._chat_lists[workspace_id] self.remove(chat_list) for account, jid, _, _ in chat_list.get_open_chats(): @@ -160,7 +164,7 @@ def _on_row_selected(self, _chat_list, row): self.emit('chat-selected', row.workspace_id, row.account, row.jid) - def show_chat_list(self, workspace_id): + def show_chat_list(self, workspace_id: str) -> None: current_workspace_id = self.get_visible_child_name() if current_workspace_id == workspace_id: return @@ -170,13 +174,14 @@ def show_chat_list(self, workspace_id): self.set_visible_child_name(workspace_id) - def add_chat(self, workspace_id, account, jid, type_, pinned=False): + def add_chat(self, workspace_id: str, account: str, jid: JID, type_: str, + pinned: bool = False) -> None: chat_list = self._chat_lists.get(workspace_id) if chat_list is None: chat_list = self.add_chat_list(workspace_id) chat_list.add_chat(account, jid, type_, pinned) - def select_chat(self, account, jid): + def select_chat(self, account: str, jid: JID) -> None: chat_list = self._find_chat(account, jid) if chat_list is None: return @@ -184,7 +189,7 @@ def select_chat(self, account, jid): self.show_chat_list(chat_list.workspace_id) chat_list.select_chat(account, jid) - def store_open_chats(self, workspace_id): + def store_open_chats(self, workspace_id: str) -> None: chat_list = self._chat_lists[workspace_id] open_chats = chat_list.get_open_chats() app.settings.set_workspace_setting( @@ -192,6 +197,8 @@ def store_open_chats(self, workspace_id): def _toggle_chat_pinned(self, _action, param): workspace_id, account, jid = param.unpack() + jid = JID.from_string(jid) + chat_list = self._chat_lists[workspace_id] chat_list.toggle_chat_pinned(account, jid) self.store_open_chats(workspace_id) @@ -209,25 +216,26 @@ def _move_chat_to_workspace(self, _action, param): self.store_open_chats(current_chatlist.workspace_id) self.store_open_chats(new_workspace_id) - def remove_chat(self, workspace_id, account, jid): + def remove_chat(self, workspace_id: str, account: str, jid: JID) -> None: chat_list = self._chat_lists[workspace_id] type_ = chat_list.get_chat_type(account, jid) chat_list.remove_chat(account, jid, emit_unread=False) self.store_open_chats(workspace_id) self.emit('chat-removed', account, jid, type_) - def remove_chats_for_account(self, account): + def remove_chats_for_account(self, account: str) -> None: for workspace_id, chat_list in self._chat_lists.items(): chat_list.remove_chats_for_account(account) self.store_open_chats(workspace_id) - def _find_chat(self, account, jid): + def _find_chat(self, account: str, jid: JID) -> Optional[ChatList]: for chat_list in self._chat_lists.values(): if chat_list.contains_chat(account, jid): return chat_list return None - def contains_chat(self, account, jid, workspace_id=None): + def contains_chat(self, account: str, jid: JID, + workspace_id: Optional[str] = None) -> bool: if workspace_id is None: for chat_list in self._chat_lists.values(): if chat_list.contains_chat(account, jid): @@ -237,20 +245,20 @@ def contains_chat(self, account, jid, workspace_id=None): chat_list = self._chat_lists[workspace_id] return chat_list.contains_chat(account, jid) - def get_total_unread_count(self): + def get_total_unread_count(self) -> int: count = 0 for chat_list in self._chat_lists.values(): count += chat_list.get_unread_count() return count - def get_chat_unread_count(self, account, jid): + def get_chat_unread_count(self, account: str, jid: JID) -> Optional[int]: for chat_list in self._chat_lists.values(): count = chat_list.get_chat_unread_count(account, jid) if count is not None: return count return None - def mark_as_read(self, account, jid): + def mark_as_read(self, account: str, jid: JID) -> None: for chat_list in self._chat_lists.values(): chat_list.mark_as_read(account, jid) ===================================== gajim/gtk/chat_page.py ===================================== @@ -12,16 +12,18 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. - from gi.repository import Gtk from gi.repository import GLib from gi.repository import Gio from gi.repository import GObject +from nbxmpp import JID + from gajim.common import app from .util import get_builder from .chat_filter import ChatFilter +from .chat_list import ChatList from .chat_list_stack import ChatListStack from .chat_stack import ChatStack from .search_view import SearchView @@ -77,7 +79,7 @@ def __init__(self): self._ui.paned.set_position(app.settings.get('chat_handle_position')) self._ui.paned.connect('button-release-event', self._on_button_release) - self._startup_finished = False + self._startup_finished: bool = False self._add_actions() @@ -97,13 +99,13 @@ def _add_actions(self): act.connect('activate', func) app.window.add_action(act) - def set_startup_finished(self): + def set_startup_finished(self) -> None: self._startup_finished = True - def get_chat_list_stack(self): + def get_chat_list_stack(self) -> ChatListStack: return self._chat_list_stack - def get_chat_stack(self): + def get_chat_stack(self) -> ChatStack: return self._chat_stack @staticmethod @@ -126,7 +128,9 @@ def _on_filter_revealer_toggled(self, toggle_button): def _on_edit_workspace_clicked(_button): app.window.lookup_action('edit-workspace').activate() - def _on_chat_selected(self, _chat_list_stack, workspace_id, account, jid): + def _on_chat_selected(self, _chat_list_stack: ChatListStack, + workspace_id: str, account: str, + jid: JID) -> None: self._chat_stack.show_chat(account, jid) self._search_view.set_context(account, jid) self.emit('chat-selected', workspace_id, account, jid) @@ -164,39 +168,39 @@ def process_event(self, event): self._chat_stack.process_event(event) self._chat_list_stack.process_event(event) - def add_chat_list(self, workspace_id): + def add_chat_list(self, workspace_id: str) -> None: self._chat_list_stack.add_chat_list(workspace_id) - def show_workspace_chats(self, workspace_id): + def show_workspace_chats(self, workspace_id: str) -> None: self._chat_list_stack.show_chat_list(workspace_id) self._ui.filter_bar_toggle.set_active(False) self._chat_filter.reset() - def update_workspace(self, workspace_id): + def update_workspace(self, workspace_id: str) -> None: name = app.settings.get_workspace_setting(workspace_id, 'name') self._ui.workspace_label.set_text(name) - def remove_chat_list(self, workspace_id): + def remove_chat_list(self, workspace_id: str) -> None: self._chat_list_stack.remove_chat_list(workspace_id) - def chat_exists(self, account, jid): + def chat_exists(self, account: str, jid: JID) -> bool: return self._chat_list_stack.contains_chat(account, jid) - def select_chat(self, account, jid): + def select_chat(self, account: str, jid: JID) -> None: self._chat_list_stack.select_chat(account, jid) - def chat_exists_for_workspace(self, workspace_id, account, jid): + def chat_exists_for_workspace(self, workspace_id: str, account: str, + jid: JID) -> bool: return self._chat_list_stack.contains_chat( account, jid, workspace_id=workspace_id) def add_chat_for_workspace(self, - workspace_id, - account, - jid, - type_, - pinned=False, - select=False): - + workspace_id: str, + account: str, + jid: JID, + type_: str, + pinned: bool = False, + select: bool = False) -> None: if self.chat_exists(account, jid): if select: self._chat_list_stack.select_chat(account, jid) @@ -220,7 +224,7 @@ def add_chat_for_workspace(self, self._chat_list_stack.select_chat(account, jid) self._chat_list_stack.store_open_chats(workspace_id) - def load_workspace_chats(self, workspace_id): + def load_workspace_chats(self, workspace_id: str) -> None: open_chats = app.settings.get_workspace_setting(workspace_id, 'open_chats') @@ -235,26 +239,29 @@ def load_workspace_chats(self, workspace_id): type_, pinned=pinned) - def is_chat_active(self, account, jid): + def is_chat_active(self, account: str, jid: JID) -> bool: return self._chat_list_stack.is_chat_active(account, jid) def _remove_chat(self, _action, param): account, jid = param.unpack() + jid = JID.from_string(jid) + self.remove_chat(account, jid) - def remove_chat(self, account, jid): + def remove_chat(self, account: str, jid: JID) -> None: for workspace_id in app.settings.get_workspaces(): if self.chat_exists_for_workspace(workspace_id, account, jid): self._chat_list_stack.remove_chat(workspace_id, account, jid) return - def _on_chat_removed(self, _chat_list, account, jid, type_): + def _on_chat_removed(self, _chat_list: ChatList, account: str, jid: JID, + type_: str) -> None: self._chat_stack.remove_chat(account, jid) if type_ == 'groupchat': client = app.get_client(account) client.get_module('MUC').leave(jid) - def remove_chats_for_account(self, account): + def remove_chats_for_account(self, account: str) -> None: chat_list = self._chat_list_stack.get_current_chat_list() if chat_list is not None: chat_list.unselect_all() @@ -274,7 +281,7 @@ def get_active_control(self): def get_controls(self, account=None): return self._chat_stack.get_controls(account) - def hide_search(self): + def hide_search(self) -> bool: if self._search_revealer.get_reveal_child(): self._search_revealer.set_reveal_child(False) return True ===================================== gajim/gtk/main.py ===================================== @@ -8,12 +8,15 @@ from gi.repository import GLib from gi.repository import Gio +from nbxmpp import JID + from gajim.common import app from gajim.common import ged from gajim.common.const import Display from gajim.common.helpers import ask_for_status_message from gajim.common.i18n import _ from gajim.common.nec import EventHelper +from gajim.common.modules.bytestream import is_transfer_active from .adhoc import AdHocCommand from .account_side_bar import AccountSideBar @@ -21,6 +24,7 @@ from .workspace_side_bar import Workspace from .workspace_side_bar import WorkspaceSideBar from .main_stack import MainStack +from .chat_list import ChatList from .dialogs import DialogButton from .dialogs import ConfirmationDialog from .dialogs import ConfirmationCheckDialog @@ -214,7 +218,7 @@ def _add_actions2(self): def _on_action(self, action, _param): control = self.get_active_control() if control is None: - return + return None log.info('Activate action: %s, active control: %s', action.get_name(), control.contact.jid) @@ -227,21 +231,21 @@ def _on_action(self, action, _param): if action == 'escape': if self._chat_page.hide_search(): - return + return None if action == 'escape' and app.settings.get('escape_key_closes'): self._chat_page.remove_chat(control.account, control.contact.jid) - return + return None if action == 'close-tab': self._chat_page.remove_chat(control.account, control.contact.jid) - return + return None # if action == 'move-tab-up': # old_position = self.notebook.get_current_page() # self.notebook.reorder_child(control.widget, # old_position - 1) - # return + # return None # if action == 'move-tab-down': # old_position = self.notebook.get_current_page() @@ -251,28 +255,28 @@ def _on_action(self, action, _param): # else: # self.notebook.reorder_child(control.widget, # old_position + 1) - # return + # return None if action == 'switch-next-tab': self.select_next_chat(True) - return + return None if action == 'switch-prev-tab': self.select_next_chat(False) - return + return None if action == 'switch-next-unread-tab-right': self.select_next_chat(True, unread_first=True) - return + return None if action == 'switch-next-unread-tab-left': self.select_next_chat(False, unread_first=True) - return + return None if action.startswith('switch-tab-'): number = int(action[-1]) - 1 self.select_chat_number(number) - return + return None def _on_window_motion_notify(self, _widget, _event): control = self.get_active_control() @@ -320,7 +324,7 @@ def _set_startup_finished(self): self._startup_finished = True self._chat_page.set_startup_finished() - def show_account_page(self, account): + def show_account_page(self, account: str) -> None: self._app_side_bar.unselect_all() self._workspace_side_bar.unselect_all() self._account_side_bar.activate_account_page(account) @@ -329,16 +333,17 @@ def show_account_page(self, account): def get_active_workspace(self) -> Optional[Workspace]: return self._workspace_side_bar.get_active_workspace() - def is_chat_active(self, account, jid): + def is_chat_active(self, account: str, jid: JID) -> bool: if not self.get_property('has-toplevel-focus'): return False return self._chat_page.is_chat_active(account, jid) def _add_workspace(self, _action, param): workspace_id = param.get_string() - self.add_workspace(workspace_id) + if workspace_id is not None: + self.add_workspace(workspace_id) - def add_workspace(self, workspace_id): + def add_workspace(self, workspace_id: str) -> None: self._workspace_side_bar.add_workspace(workspace_id) self._chat_page.add_chat_list(workspace_id) @@ -356,7 +361,7 @@ def _remove_workspace(self, _action, _param): if workspace_id is not None: self.remove_workspace(workspace_id) - def remove_workspace(self, workspace_id): + def remove_workspace(self, workspace_id: str) -> None: was_active = self.get_active_workspace() == workspace_id success = self._workspace_side_bar.remove_workspace(workspace_id) @@ -372,26 +377,29 @@ def remove_workspace(self, workspace_id): def _activate_workspace(self, _action, param): workspace_id = param.get_string() - self.activate_workspace(workspace_id) + if workspace_id is not None: + self.activate_workspace(workspace_id) - def activate_workspace(self, workspace_id): + def activate_workspace(self, workspace_id: str) -> None: self._app_side_bar.unselect_all() self._account_side_bar.unselect_all() self._main_stack.show_chats(workspace_id) self._workspace_side_bar.activate_workspace(workspace_id) - def update_workspace(self, workspace_id): + def update_workspace(self, workspace_id: str) -> None: self._chat_page.update_workspace(workspace_id) self._workspace_side_bar.update_avatar(workspace_id) - def get_chat_list(self, workspace_id): + def get_chat_list(self, workspace_id: str) -> ChatList: chat_list_stack = self._chat_page.get_chat_list_stack() return chat_list_stack.get_chatlist(workspace_id) def _add_group_chat(self, _action, param): - self.add_group_chat(**param.unpack()) + account, jid, select = param.unpack() + self.add_group_chat(account, JID.from_string(jid), select) - def add_group_chat(self, account, jid, select=False): + def add_group_chat(self, account: str, jid: JID, + select: bool = False) -> None: workspace_id = self.get_active_workspace() if workspace_id is None: workspace_id = self._workspace_side_bar.get_first_workspace() @@ -402,9 +410,11 @@ def add_group_chat(self, account, jid, select=False): select=select) def _add_chat(self, _action, param): - self.add_chat(**param.unpack()) + account, jid, type_, select = param.unpack() + self.add_chat(account, JID.from_string(jid), type_, select) - def add_chat(self, account, jid, type_, select=False): + def add_chat(self, account: str, jid: JID, type_: str, + select: bool = False) -> None: workspace_id = self.get_active_workspace() if workspace_id is None: workspace_id = self._workspace_side_bar.get_first_workspace() @@ -414,7 +424,8 @@ def add_chat(self, account, jid, type_, select=False): type_, select=select) - def add_private_chat(self, account, jid, select=False): + def add_private_chat(self, account: str, jid: JID, + select: bool = False) -> None: workspace_id = self.get_active_workspace() if workspace_id is None: workspace_id = self._workspace_side_bar.get_first_workspace() @@ -424,19 +435,20 @@ def add_private_chat(self, account, jid, select=False): 'pm', select=select) - def select_chat(self, account, jid): + def select_chat(self, account: str, jid: JID) -> None: self._app_side_bar.unselect_all() self._account_side_bar.unselect_all() self._main_stack.show_chat_page() self._chat_page.select_chat(account, jid) - def select_next_chat(self, forwards, unread_first=False): + def select_next_chat(self, forwards: bool, + unread_first: bool = False) -> None: chat_list_stack = self._chat_page.get_chat_list_stack() chat_list = chat_list_stack.get_current_chat_list() if chat_list is not None: chat_list.select_next_chat(forwards, unread_first) - def select_chat_number(self, number): + def select_chat_number(self, number: int) -> None: chat_list_stack = self._chat_page.get_chat_list_stack() chat_list = chat_list_stack.get_current_chat_list() if chat_list is not None: @@ -447,12 +459,13 @@ def _add_to_roster(_action, param): _workspace, account, jid = param.unpack() open_window('AddContact', account=account, jid=jid) - def show_app_page(self): + def show_app_page(self) -> None: self._account_side_bar.unselect_all() self._workspace_side_bar.unselect_all() self._main_stack.show_app_page() - def add_app_message(self, category, message=None): + def add_app_message(self, category: str, + message: Optional[str] = None) -> None: self._app_page.add_app_message(category, message) def get_control(self, *args, **kwargs): @@ -467,16 +480,17 @@ def get_active_control(self, *args, **kwargs): def chat_exists(self, *args, **kwargs): return self._chat_page.chat_exists(*args, **kwargs) - def get_total_unread_count(self): + def get_total_unread_count(self) -> int: chat_list_stack = self._chat_page.get_chat_list_stack() return chat_list_stack.get_total_unread_count() - def get_chat_unread_count(self, account, jid): + def get_chat_unread_count(self, account: str, jid: JID) -> int: chat_list_stack = self._chat_page.get_chat_list_stack() count = chat_list_stack.get_chat_unread_count(account, jid) return count or 0 - def mark_as_read(self, account, jid, send_marker=True): + def mark_as_read(self, account: str, jid: JID, + send_marker: bool = True) -> None: # TODO set window urgency hint, etc. control = self.get_control(account, jid) if control is not None: @@ -526,7 +540,7 @@ def _block_contact(report=None): callback=_block_contact)], modal=False).show() - def remove_contact(self, account, jid): + def remove_contact(self, account: str, jid: JID) -> None: client = app.get_client(account) def _remove_contact(): @@ -548,7 +562,7 @@ def _remove_contact(): callback=_remove_contact)]).show() @staticmethod - def _check_for_account(): + def _check_for_account() -> None: accounts = app.settings.get_accounts() if (not accounts or accounts == ['Local'] and not app.settings.get_account_setting('Local', 'active')): @@ -558,7 +572,7 @@ def _open_wizard(): GLib.idle_add(_open_wizard) - def _load_chats(self): + def _load_chats(self) -> None: for workspace_id in app.settings.get_workspaces(): self.add_workspace(workspace_id) self._chat_page.load_workspace_chats(workspace_id) @@ -621,7 +635,6 @@ def on_continue2(message): app.app.start_shutdown(message=message) return # check if there is an active file transfer - from gajim.common.modules.bytestream import is_transfer_active files_props = app.interface.instances['file_transfers'].\ files_props transfer_active = False ===================================== gajim/gtk/main_stack.py ===================================== @@ -37,37 +37,37 @@ def __init__(self): for account in list(app.connections.keys()): self.add_account_page(account) - def add_account_page(self, account): + def add_account_page(self, account: str) -> None: account_page = AccountPage(account) self.add_named(account_page, account) - def remove_account_page(self, account): + def remove_account_page(self, account: str) -> None: account_page = self.get_child_by_name(account) account_page.destroy() - def remove_chats_for_account(self, account): + def remove_chats_for_account(self, account: str) -> None: self._chat_page.remove_chats_for_account(account) - def show_app_page(self): + def show_app_page(self) -> None: self.set_visible_child_name('app') - def get_app_page(self): + def get_app_page(self) -> AppPage: return self.get_child_by_name('app') - def show_chats(self, workspace_id): + def show_chats(self, workspace_id: str) -> None: self._chat_page.show_workspace_chats(workspace_id) self.set_visible_child_name('chats') - def show_chat_page(self): + def show_chat_page(self) -> None: self.set_visible_child_name('chats') - def show_account(self, account): + def show_account(self, account: str) -> None: self.set_visible_child_name(account) - def get_account_page(self, account): + def get_account_page(self, account: str) -> AccountPage: return self.get_child_by_name(account) - def get_chat_page(self): + def get_chat_page(self) -> ChatPage: return self.get_child_by_name('chats') def process_event(self, event): ===================================== gajim/gtk/roster.py ===================================== @@ -9,6 +9,7 @@ from gi.repository import GLib from gi.repository import Gtk +from nbxmpp import JID from nbxmpp import Namespace from gajim.common import app @@ -292,7 +293,7 @@ def _on_block_contact(self, _action, param): app.window.block_contact(self._account, param.get_string()) def _on_remove_contact(self, _action, param): - jid = param.get_string() + jid = JID.from_string(param.get_string()) selected_contact = self._client.get_module('Contacts').get_contact(jid) if selected_contact.is_gateway: # Check for transport users in roster and warn about removing the @@ -330,7 +331,7 @@ def _on_roster_row_activated(self, _treeview, path, _column): # This is a group row return - jid = self._store[iter_][Column.JID_OR_GROUP] + jid = JID.from_string(self._store[iter_][Column.JID_OR_GROUP]) app.window.add_chat(self._account, jid, 'contact', select=True) def _on_roster_button_press_event(self, treeview, event): @@ -353,6 +354,7 @@ def _on_roster_button_press_event(self, treeview, event): if event.button == 3: # right click self._show_contact_menu(jid, treeview, event) + jid = JID.from_string(jid) if event.button == 2: # middle click app.window.add_chat(self._account, jid, 'contact', select=True) ===================================== gajim/gtk/search_view.py ===================================== @@ -19,6 +19,8 @@ from gi.repository import GObject from gi.repository import Gtk +from nbxmpp import JID + from gajim.common import app from gajim.common import ged from gajim.common.const import AvatarSize @@ -255,7 +257,8 @@ def _on_row_activated(_listbox, row): # Wrong chat or no control opened # TODO: type 'pm' is KindConstant.CHAT_MSG_RECV, too - app.window.add_chat(row.account, row.jid, row.type, select=True) + jid = JID.from_string(row.jid) + app.window.add_chat(row.account, jid, row.type, select=True) control = app.window.get_active_control() control.scroll_to_message(row.log_line_id, row.timestamp) ===================================== gajim/gtk/start_chat.py ===================================== @@ -20,6 +20,7 @@ from gi.repository import GLib from gi.repository import Pango +from nbxmpp import JID from nbxmpp.errors import is_error from nbxmpp.errors import StanzaError from nbxmpp.errors import TimeoutStanzaError @@ -319,6 +320,7 @@ def _start_new_chat(self, row): self._disco_info(row) return + jid = JID.from_string(row.jid) if row.groupchat: if not app.account_is_available(row.account): self._show_error_page(_('You can not join a group chat ' @@ -326,17 +328,17 @@ def _start_new_chat(self, row): return self.ready_to_destroy = True - if app.window.chat_exists(row.account, row.jid): - app.window.select_chat(row.account, row.jid) + if app.window.chat_exists(row.account, jid): + app.window.select_chat(row.account, jid) self.destroy() return self.ready_to_destroy = False self._redirected = False - self._disco_muc(row.account, row.jid, request_vcard=row.new) + self._disco_muc(row.account, jid, request_vcard=row.new) else: - app.window.add_chat(row.account, row.jid, 'contact', select=True) + app.window.add_chat(row.account, jid, 'contact', select=True) self.ready_to_destroy = True self.destroy() ===================================== gajim/gui_interface.py ===================================== @@ -667,11 +667,11 @@ def show_add_join_groupchat(self, account, jid, nickname=None, client.get_module('MUC').join( jid, nick=nickname, password=password) - app.window.add_group_chat(account, str(jid), select=True) + app.window.add_group_chat(account, jid, select=True) def start_chat_from_jid(self, account, jid, message=None): if app.window.chat_exists(account, jid): - app.window.select_chat(account, jid) + app.window.select_chat(account, JID.from_string(jid)) if message is not None: control = app.window.get_control(account, jid) control.msg_textview.insert_text(message) @@ -685,7 +685,7 @@ def _on_muc_added(event): if app.window.chat_exists(event.account, event.jid): return - app.window.add_group_chat(event.account, str(event.jid)) + app.window.add_group_chat(event.account, event.jid) @staticmethod def create_account(account, View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/f0a5c670d4aea0f959aa0cd8aa19cd5…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/f0a5c670d4aea0f959aa0cd8aa19cd5…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Allow multiple corrections of last message
by Daniel Brötzmann (ï¼ wurstsalat)
17 Nov '21
17 Nov '21
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim Commits: f0a5c670 by wurstsalat at 2021-11-17T23:37:35+01:00 Allow multiple corrections of last message - - - - - 4 changed files: - gajim/gtk/controls/chat.py - gajim/gtk/controls/groupchat.py - gajim/gtk/conversation/rows/message.py - gajim/gtk/conversation/view.py Changes: ===================================== gajim/gtk/controls/chat.py ===================================== @@ -446,7 +446,9 @@ def _on_message_sent(self, event): if not event.message: return - self.last_sent_msg = event.message_id + if event.correct_id is None: + self.last_sent_msg = event.message_id + message_id = event.message_id if event.label: ===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -1112,7 +1112,8 @@ def _on_message_sent(self, event): return # we'll save sent message text when we'll receive it in # _nec_gc_message_received - self.last_sent_msg = event.message_id + if event.correct_id is None: + self.last_sent_msg = event.message_id if self.correcting: self.correcting = False self.msg_textview.get_style_context().remove_class( ===================================== gajim/gtk/conversation/rows/message.py ===================================== @@ -325,7 +325,7 @@ def set_retracted(self, text: str) -> None: self._message_widget.add_content(process(text)) self.get_style_context().add_class('retracted-message') - def set_correction(self, text, message_id): + def set_correction(self, text: str) -> None: self._corrections.append(self._message_widget.get_text()) result = process(text) self._message_widget.add_content(result) @@ -339,8 +339,6 @@ def set_correction(self, text, message_id): corrections, max_chars=150, max_lines=10) self._message_icons.set_correction_tooltip( _('Message corrected. Original message:\n%s') % corrections) - # Update message_id for this row - self.message_id = message_id def set_error(self, tooltip): self._message_icons.set_error_icon_visible(True) ===================================== gajim/gtk/conversation/view.py ===================================== @@ -221,8 +221,8 @@ def add_message(self, if not timestamp: timestamp = time.time() - if correct_id: - self.correct_message(correct_id, message_id, text) + if correct_id is not None: + self.correct_message(correct_id, text) return message = MessageRow( @@ -453,10 +453,10 @@ def scroll_to_end(self, force=False): if self.autoscroll or force: GLib.idle_add(scroll_to_end, self.get_parent().get_parent()) - def correct_message(self, correct_id, message_id, text): + def correct_message(self, correct_id: str, text: str) -> None: message_row = self._get_row_by_message_id(correct_id) if message_row is not None: - message_row.set_correction(text, message_id) + message_row.set_correction(text) message_row.set_merged(False) def show_message_retraction(self, stanza_id: str, text: str) -> None: View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f0a5c670d4aea0f959aa0cd8aa19cd5c…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f0a5c670d4aea0f959aa0cd8aa19cd5c…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
← Newer
1
...
227
228
229
230
231
232
233
...
1764
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
Results per page:
10
25
50
100
200