Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
b51b99f9
by Philipp Hörist at 2019-07-20T11:17:45Z
-
0dbad0ca
by Philipp Hörist at 2019-07-20T13:33:08Z
5 changed files:
- gajim/data/gui/groupchat_control.ui
- gajim/gajim.py
- gajim/groupchat_control.py
- gajim/gui_interface.py
- setup.cfg
Changes:
| ... | ... | @@ -84,6 +84,7 @@ |
| 84 | 84 |
<object class="GtkStack" id="stack">
|
| 85 | 85 |
<property name="visible">True</property>
|
| 86 | 86 |
<property name="can_focus">False</property>
|
| 87 |
+ <signal name="notify::visible-child-name" handler="_on_page_change" swapped="no"/>
|
|
| 87 | 88 |
<child>
|
| 88 | 89 |
<object class="GtkBox" id="groupchat_control_vbox">
|
| 89 | 90 |
<property name="can_focus">True</property>
|
| ... | ... | @@ -704,6 +705,112 @@ |
| 704 | 705 |
<property name="position">3</property>
|
| 705 | 706 |
</packing>
|
| 706 | 707 |
</child>
|
| 708 |
+ <child>
|
|
| 709 |
+ <object class="GtkBox">
|
|
| 710 |
+ <property name="visible">True</property>
|
|
| 711 |
+ <property name="can_focus">False</property>
|
|
| 712 |
+ <property name="orientation">vertical</property>
|
|
| 713 |
+ <child>
|
|
| 714 |
+ <object class="GtkGrid">
|
|
| 715 |
+ <property name="visible">True</property>
|
|
| 716 |
+ <property name="can_focus">False</property>
|
|
| 717 |
+ <property name="halign">center</property>
|
|
| 718 |
+ <property name="valign">center</property>
|
|
| 719 |
+ <property name="hexpand">True</property>
|
|
| 720 |
+ <property name="vexpand">True</property>
|
|
| 721 |
+ <property name="row_spacing">12</property>
|
|
| 722 |
+ <child>
|
|
| 723 |
+ <object class="GtkLabel">
|
|
| 724 |
+ <property name="visible">True</property>
|
|
| 725 |
+ <property name="can_focus">False</property>
|
|
| 726 |
+ <property name="label" translatable="yes">Enter password</property>
|
|
| 727 |
+ <property name="xalign">0</property>
|
|
| 728 |
+ <style>
|
|
| 729 |
+ <class name="bold16"/>
|
|
| 730 |
+ </style>
|
|
| 731 |
+ </object>
|
|
| 732 |
+ <packing>
|
|
| 733 |
+ <property name="left_attach">0</property>
|
|
| 734 |
+ <property name="top_attach">0</property>
|
|
| 735 |
+ </packing>
|
|
| 736 |
+ </child>
|
|
| 737 |
+ <child>
|
|
| 738 |
+ <object class="GtkBox">
|
|
| 739 |
+ <property name="visible">True</property>
|
|
| 740 |
+ <property name="can_focus">False</property>
|
|
| 741 |
+ <property name="homogeneous">True</property>
|
|
| 742 |
+ <child>
|
|
| 743 |
+ <object class="GtkButton">
|
|
| 744 |
+ <property name="label" translatable="yes">_Cancel</property>
|
|
| 745 |
+ <property name="visible">True</property>
|
|
| 746 |
+ <property name="can_focus">True</property>
|
|
| 747 |
+ <property name="receives_default">True</property>
|
|
| 748 |
+ <property name="halign">start</property>
|
|
| 749 |
+ <property name="valign">start</property>
|
|
| 750 |
+ <property name="use_underline">True</property>
|
|
| 751 |
+ <signal name="clicked" handler="_on_password_cancel_clicked" swapped="no"/>
|
|
| 752 |
+ </object>
|
|
| 753 |
+ <packing>
|
|
| 754 |
+ <property name="expand">False</property>
|
|
| 755 |
+ <property name="fill">True</property>
|
|
| 756 |
+ <property name="position">0</property>
|
|
| 757 |
+ </packing>
|
|
| 758 |
+ </child>
|
|
| 759 |
+ <child>
|
|
| 760 |
+ <object class="GtkButton" id="password_set_button">
|
|
| 761 |
+ <property name="label" translatable="yes">_Join</property>
|
|
| 762 |
+ <property name="visible">True</property>
|
|
| 763 |
+ <property name="sensitive">False</property>
|
|
| 764 |
+ <property name="can_focus">True</property>
|
|
| 765 |
+ <property name="can_default">True</property>
|
|
| 766 |
+ <property name="receives_default">True</property>
|
|
| 767 |
+ <property name="halign">end</property>
|
|
| 768 |
+ <property name="valign">start</property>
|
|
| 769 |
+ <property name="use_underline">True</property>
|
|
| 770 |
+ <signal name="clicked" handler="_on_password_set_clicked" swapped="no"/>
|
|
| 771 |
+ <style>
|
|
| 772 |
+ <class name="suggested-action"/>
|
|
| 773 |
+ </style>
|
|
| 774 |
+ </object>
|
|
| 775 |
+ <packing>
|
|
| 776 |
+ <property name="expand">False</property>
|
|
| 777 |
+ <property name="fill">True</property>
|
|
| 778 |
+ <property name="position">1</property>
|
|
| 779 |
+ </packing>
|
|
| 780 |
+ </child>
|
|
| 781 |
+ </object>
|
|
| 782 |
+ <packing>
|
|
| 783 |
+ <property name="left_attach">0</property>
|
|
| 784 |
+ <property name="top_attach">2</property>
|
|
| 785 |
+ </packing>
|
|
| 786 |
+ </child>
|
|
| 787 |
+ <child>
|
|
| 788 |
+ <object class="GtkEntry" id="password_entry">
|
|
| 789 |
+ <property name="visible">True</property>
|
|
| 790 |
+ <property name="can_focus">True</property>
|
|
| 791 |
+ <property name="visibility">False</property>
|
|
| 792 |
+ <property name="invisible_char">*</property>
|
|
| 793 |
+ <property name="input_purpose">password</property>
|
|
| 794 |
+ <signal name="notify::text" handler="_on_password_changed" swapped="no"/>
|
|
| 795 |
+ </object>
|
|
| 796 |
+ <packing>
|
|
| 797 |
+ <property name="left_attach">0</property>
|
|
| 798 |
+ <property name="top_attach">1</property>
|
|
| 799 |
+ </packing>
|
|
| 800 |
+ </child>
|
|
| 801 |
+ </object>
|
|
| 802 |
+ <packing>
|
|
| 803 |
+ <property name="expand">False</property>
|
|
| 804 |
+ <property name="fill">True</property>
|
|
| 805 |
+ <property name="position">0</property>
|
|
| 806 |
+ </packing>
|
|
| 807 |
+ </child>
|
|
| 808 |
+ </object>
|
|
| 809 |
+ <packing>
|
|
| 810 |
+ <property name="name">password</property>
|
|
| 811 |
+ <property name="position">4</property>
|
|
| 812 |
+ </packing>
|
|
| 813 |
+ </child>
|
|
| 707 | 814 |
</object>
|
| 708 | 815 |
<packing>
|
| 709 | 816 |
<property name="expand">True</property>
|
| ... | ... | @@ -28,6 +28,7 @@ from gajim.common import i18n |
| 28 | 28 |
|
| 29 | 29 |
_MIN_NBXMPP_VER = "0.9.91"
|
| 30 | 30 |
_MIN_GTK_VER = "3.22.0"
|
| 31 |
+_MIN_CAIRO_VER = "1.14.0"
|
|
| 31 | 32 |
|
| 32 | 33 |
|
| 33 | 34 |
def _check_required_deps():
|
| ... | ... | @@ -42,6 +43,22 @@ def _check_required_deps(): |
| 42 | 43 |
'Quitting...' % _MIN_NBXMPP_VER)
|
| 43 | 44 |
sys.exit(1)
|
| 44 | 45 |
|
| 46 |
+ try:
|
|
| 47 |
+ import cairo
|
|
| 48 |
+ except ImportError:
|
|
| 49 |
+ print('Gajim needs python-cairo to run. Quitting…')
|
|
| 50 |
+ sys.exit(1)
|
|
| 51 |
+ |
|
| 52 |
+ if V(cairo.cairo_version_string()) < V(_MIN_CAIRO_VER):
|
|
| 53 |
+ print('Gajim needs libcairo >= %s to run. '
|
|
| 54 |
+ 'Quitting...' % _MIN_CAIRO_VER)
|
|
| 55 |
+ sys.exit(1)
|
|
| 56 |
+ |
|
| 57 |
+ if V(cairo.version) < V(_MIN_CAIRO_VER):
|
|
| 58 |
+ print('Gajim needs python-cairo >= %s to run. '
|
|
| 59 |
+ 'Quitting...' % _MIN_CAIRO_VER)
|
|
| 60 |
+ sys.exit(1)
|
|
| 61 |
+ |
|
| 45 | 62 |
|
| 46 | 63 |
def _init_gui(gui):
|
| 47 | 64 |
if gui == 'GTK':
|
| ... | ... | @@ -1951,8 +1951,7 @@ class GroupchatControl(ChatControlBase): |
| 1951 | 1951 |
error_message = event.properties.error.message
|
| 1952 | 1952 |
|
| 1953 | 1953 |
if error_type == Error.NOT_AUTHORIZED:
|
| 1954 |
- app.interface.handle_gc_password_required(
|
|
| 1955 |
- self.account, self.room_jid, nick)
|
|
| 1954 |
+ self._show_page('password')
|
|
| 1956 | 1955 |
|
| 1957 | 1956 |
elif error_type == Error.FORBIDDEN:
|
| 1958 | 1957 |
# we are banned
|
| ... | ... | @@ -2475,7 +2474,11 @@ class GroupchatControl(ChatControlBase): |
| 2475 | 2474 |
if action == 'escape':
|
| 2476 | 2475 |
if self._get_current_page() == 'groupchat':
|
| 2477 | 2476 |
return Gdk.EVENT_PROPAGATE
|
| 2478 |
- self._show_page('groupchat')
|
|
| 2477 |
+ |
|
| 2478 |
+ if self._get_current_page() == 'password':
|
|
| 2479 |
+ self._on_password_cancel_clicked()
|
|
| 2480 |
+ else:
|
|
| 2481 |
+ self._show_page('groupchat')
|
|
| 2479 | 2482 |
return Gdk.EVENT_STOP
|
| 2480 | 2483 |
|
| 2481 | 2484 |
if action == 'change-subject':
|
| ... | ... | @@ -2926,6 +2929,13 @@ class GroupchatControl(ChatControlBase): |
| 2926 | 2929 |
else:
|
| 2927 | 2930 |
self.revoke_owner(widget, jid)
|
| 2928 | 2931 |
|
| 2932 |
+ def _on_page_change(self, stack, _param):
|
|
| 2933 |
+ page_name = stack.get_visible_child_name()
|
|
| 2934 |
+ if page_name == 'password':
|
|
| 2935 |
+ self.xml.password_entry.set_text('')
|
|
| 2936 |
+ self.xml.password_entry.grab_focus()
|
|
| 2937 |
+ self.xml.password_set_button.grab_default()
|
|
| 2938 |
+ |
|
| 2929 | 2939 |
def _on_change_nick(self, _action, _param):
|
| 2930 | 2940 |
if self._get_current_page() == 'nickname':
|
| 2931 | 2941 |
return
|
| ... | ... | @@ -2968,6 +2978,21 @@ class GroupchatControl(ChatControlBase): |
| 2968 | 2978 |
con.get_module('MUC').set_subject(self.room_jid, subject)
|
| 2969 | 2979 |
self._show_page('groupchat')
|
| 2970 | 2980 |
|
| 2981 |
+ def _on_password_set_clicked(self, _button):
|
|
| 2982 |
+ password = self.xml.password_entry.get_text()
|
|
| 2983 |
+ app.gc_passwords[self.room_jid] = password
|
|
| 2984 |
+ app.connections[self.account].get_module('MUC').join(
|
|
| 2985 |
+ self.room_jid, self.nick, password)
|
|
| 2986 |
+ self._show_page('groupchat')
|
|
| 2987 |
+ |
|
| 2988 |
+ def _on_password_changed(self, entry, _param):
|
|
| 2989 |
+ self.xml.password_set_button.set_sensitive(bool(entry.get_text()))
|
|
| 2990 |
+ |
|
| 2991 |
+ def _on_password_cancel_clicked(self, _button=None):
|
|
| 2992 |
+ self.force_non_minimizable = True
|
|
| 2993 |
+ self.parent_win.remove_tab(self, self.parent_win.CLOSE_COMMAND)
|
|
| 2994 |
+ self.force_non_minimizable = False
|
|
| 2995 |
+ |
|
| 2971 | 2996 |
def _on_page_cancel_clicked(self, _button):
|
| 2972 | 2997 |
self._show_page('groupchat')
|
| 2973 | 2998 |
|
| ... | ... | @@ -266,34 +266,6 @@ class Interface: |
| 266 | 266 |
d.set_transient_for(gc_control.parent_win.window)
|
| 267 | 267 |
d.set_modal(False)
|
| 268 | 268 |
|
| 269 |
- def handle_gc_password_required(self, account, room_jid, nick):
|
|
| 270 |
- def on_ok(text):
|
|
| 271 |
- app.connections[account].get_module('MUC').join(
|
|
| 272 |
- room_jid, nick, text)
|
|
| 273 |
- app.gc_passwords[room_jid] = text
|
|
| 274 |
- gc_control.error_dialog = None
|
|
| 275 |
- |
|
| 276 |
- def on_cancel():
|
|
| 277 |
- # get and destroy window
|
|
| 278 |
- if room_jid in app.interface.minimized_controls[account]:
|
|
| 279 |
- self.roster.on_disconnect(None, room_jid, account)
|
|
| 280 |
- else:
|
|
| 281 |
- win = self.msg_win_mgr.get_window(room_jid, account)
|
|
| 282 |
- ctrl = self.msg_win_mgr.get_gc_control(room_jid, account)
|
|
| 283 |
- win.remove_tab(ctrl, 3)
|
|
| 284 |
- gc_control.error_dialog = None
|
|
| 285 |
- |
|
| 286 |
- gc_control = self.msg_win_mgr.get_gc_control(room_jid, account)
|
|
| 287 |
- if gc_control:
|
|
| 288 |
- if gc_control.error_dialog:
|
|
| 289 |
- gc_control.error_dialog.destroy()
|
|
| 290 |
- |
|
| 291 |
- gc_control.error_dialog = InputDialog(_('Password Required'),
|
|
| 292 |
- _('A Password is required to join the group chat %s. Please type it.') % \
|
|
| 293 |
- room_jid, is_modal=False, ok_handler=on_ok,
|
|
| 294 |
- cancel_handler=on_cancel)
|
|
| 295 |
- gc_control.error_dialog.input_entry.set_visibility(False)
|
|
| 296 |
- |
|
| 297 | 269 |
def handle_event_presence(self, obj):
|
| 298 | 270 |
# 'NOTIFY' (account, (jid, status, status message, resource,
|
| 299 | 271 |
# priority, timestamp))
|
| ... | ... | @@ -25,6 +25,7 @@ install_requires = |
| 25 | 25 |
nbxmpp>=0.9.91
|
| 26 | 26 |
precis-i18n>=1.0.0
|
| 27 | 27 |
pyOpenSSL>=16.2
|
| 28 |
+ pycairo>=1.14.0
|
|
| 28 | 29 |
|
| 29 | 30 |
[options.package_data]
|
| 30 | 31 |
gajim =
|