start porting Gajim to gobject introspection and GTK3
This commit is contained in:
parent
cae8faf0ed
commit
8f71d9f219
|
@ -1,31 +1,51 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="2.16"/>
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
<!-- interface-naming-policy toplevel-contextual -->
|
<object class="GtkListStore" id="liststore1">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name item -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
<data>
|
||||||
|
<row>
|
||||||
|
<col id="0" translatable="yes">None</col>
|
||||||
|
</row>
|
||||||
|
</data>
|
||||||
|
</object>
|
||||||
|
<object class="GtkEntryCompletion" id="server_entrycompletion">
|
||||||
|
<property name="model">server_liststore</property>
|
||||||
|
<property name="text_column">0</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkEntryCompletion" id="server_entrycompletion1">
|
||||||
|
<property name="model">server_liststore</property>
|
||||||
|
<property name="text_column">0</property>
|
||||||
|
</object>
|
||||||
<object class="GtkWindow" id="account_creation_wizard_window">
|
<object class="GtkWindow" id="account_creation_wizard_window">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">12</property>
|
<property name="border_width">12</property>
|
||||||
<property name="title" translatable="yes">Gajim: Account Creation Wizard</property>
|
<property name="title" translatable="yes">Gajim: Account Creation Wizard</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
<signal name="destroy" handler="on_wizard_window_destroy"/>
|
<signal name="destroy" handler="on_wizard_window_destroy" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox77">
|
<object class="GtkVBox" id="vbox77">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkNotebook" id="notebook">
|
<object class="GtkNotebook" id="notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="show_tabs">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="show_border">False</property>
|
<property name="show_border">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox78">
|
<object class="GtkVBox" id="vbox78">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label256">
|
<object class="GtkLabel" id="label256">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">You need to have an account in order to connect
|
<property name="label" translatable="yes">You need to have an account in order to connect
|
||||||
to the Jabber network.</property>
|
to the Jabber network.</property>
|
||||||
|
@ -39,26 +59,31 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame" id="frame33">
|
<object class="GtkFrame" id="frame33">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="label_xalign">0</property>
|
<property name="label_xalign">0</property>
|
||||||
<property name="shadow_type">none</property>
|
<property name="shadow_type">none</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkAlignment" id="alignment68">
|
<object class="GtkAlignment" id="alignment68">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="top_padding">5</property>
|
<property name="top_padding">5</property>
|
||||||
<property name="left_padding">12</property>
|
<property name="left_padding">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox83">
|
<object class="GtkVBox" id="vbox83">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="use_existing_account_radiobutton">
|
<object class="GtkRadioButton" id="use_existing_account_radiobutton">
|
||||||
<property name="label" translatable="yes">I already have an account I want to _use</property>
|
<property name="label" translatable="yes">I already have an account I want to _use</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -70,10 +95,13 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="register_new_account_radiobutton">
|
<object class="GtkRadioButton" id="register_new_account_radiobutton">
|
||||||
<property name="label" translatable="yes">I want to _register for a new account</property>
|
<property name="label" translatable="yes">I want to _register for a new account</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="group">use_existing_account_radiobutton</property>
|
<property name="group">use_existing_account_radiobutton</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -90,6 +118,7 @@ to the Jabber network.</property>
|
||||||
<child type="label">
|
<child type="label">
|
||||||
<object class="GtkLabel" id="label269">
|
<object class="GtkLabel" id="label269">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes"><b>Please choose one of the options below:</b></property>
|
<property name="label" translatable="yes"><b>Please choose one of the options below:</b></property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -106,6 +135,7 @@ to the Jabber network.</property>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label259">
|
<object class="GtkLabel" id="label259">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
|
@ -114,12 +144,13 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="register_vbox">
|
<object class="GtkVBox" id="register_vbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label270">
|
<object class="GtkLabel" id="label270">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes"><b>Please fill in the data for your existing account</b></property>
|
<property name="label" translatable="yes"><b>Please fill in the data for your existing account</b></property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
|
@ -133,25 +164,30 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTable" id="table27">
|
<object class="GtkTable" id="table27">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="n_rows">3</property>
|
<property name="n_rows">3</property>
|
||||||
<property name="n_columns">4</property>
|
<property name="n_columns">4</property>
|
||||||
<property name="column_spacing">12</property>
|
<property name="column_spacing">12</property>
|
||||||
<property name="row_spacing">6</property>
|
<property name="row_spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="username_entry">
|
<object class="GtkEntry" id="username_entry">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<signal name="key_press_event" handler="on_username_entry_key_press_event"/>
|
<signal name="key-press-event" handler="on_username_entry_key_press_event" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label263">
|
<object class="GtkLabel" id="label263">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">_Password:</property>
|
<property name="label" translatable="yes">_Password:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
@ -161,21 +197,24 @@ to the Jabber network.</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="bottom_attach">3</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="x_options">GTK_FILL</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="save_password_checkbutton">
|
<object class="GtkCheckButton" id="save_password_checkbutton">
|
||||||
<property name="label" translatable="yes">Save pass_word</property>
|
<property name="label" translatable="yes">Save pass_word</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="tooltip_text" translatable="yes">If checked, Gajim will remember the password for this account</property>
|
<property name="tooltip_text" translatable="yes">If checked, Gajim will remember the password for this account</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="focus_on_click">False</property>
|
<property name="focus_on_click">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<signal name="toggled" handler="on_save_password_checkbutton_toggled"/>
|
<signal name="toggled" handler="on_save_password_checkbutton_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
|
@ -183,7 +222,7 @@ to the Jabber network.</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="bottom_attach">3</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="x_options">GTK_FILL</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -198,12 +237,13 @@ to the Jabber network.</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="bottom_attach">3</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label262">
|
<object class="GtkLabel" id="label262">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">_Jabber ID:</property>
|
<property name="label" translatable="yes">_Jabber ID:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
@ -211,41 +251,34 @@ to the Jabber network.</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x_options">GTK_FILL</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label1">
|
<object class="GtkLabel" id="label1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label">@</property>
|
<property name="label">@</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">3</property>
|
||||||
<property name="x_options"></property>
|
<property name="x_options"/>
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkComboBoxEntry" id="server_comboboxentry">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">3</property>
|
|
||||||
<property name="right_attach">4</property>
|
|
||||||
<property name="x_options">GTK_FILL</property>
|
|
||||||
<property name="y_options">GTK_FILL</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="anonymous_checkbutton1">
|
<object class="GtkCheckButton" id="anonymous_checkbutton1">
|
||||||
<property name="label" translatable="yes">Anon_ymous authentication</property>
|
<property name="label" translatable="yes">Anon_ymous authentication</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<signal name="toggled" handler="on_anonymous_checkbutton1_toggled"/>
|
<signal name="toggled" handler="on_anonymous_checkbutton1_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
@ -255,11 +288,29 @@ to the Jabber network.</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkComboBoxText" id="server_comboboxentry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="has_entry">True</property>
|
||||||
|
<property name="entry_text_column">0</property>
|
||||||
|
<property name="id_column">1</property>
|
||||||
|
<child internal-child="entry">
|
||||||
|
<object class="GtkEntry" id="comboboxtext-entry">
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="invisible_char">●</property>
|
||||||
|
<property name="completion">server_entrycompletion</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="right_attach">4</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -271,6 +322,7 @@ to the Jabber network.</property>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label261">
|
<object class="GtkLabel" id="label261">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
|
@ -280,12 +332,13 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox105">
|
<object class="GtkVBox" id="vbox105">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label368">
|
<object class="GtkLabel" id="label368">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes"><b>Please select a server</b></property>
|
<property name="label" translatable="yes"><b>Please select a server</b></property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
|
@ -299,10 +352,12 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHBox" id="hbox2997">
|
<object class="GtkHBox" id="hbox2997">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label369">
|
<object class="GtkLabel" id="label369">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">_Server:</property>
|
<property name="label" translatable="yes">_Server:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
@ -314,10 +369,22 @@ to the Jabber network.</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBoxEntry" id="server_comboboxentry1">
|
<object class="GtkComboBoxText" id="server_comboboxentry1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="has_entry">True</property>
|
||||||
|
<property name="entry_text_column">0</property>
|
||||||
|
<property name="id_column">1</property>
|
||||||
|
<child internal-child="entry">
|
||||||
|
<object class="GtkEntry" id="comboboxtext-entry1">
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="completion">server_entrycompletion1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -331,14 +398,18 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="anonymous_checkbutton2">
|
<object class="GtkCheckButton" id="anonymous_checkbutton2">
|
||||||
<property name="label" translatable="yes">Anon_ymous authentication</property>
|
<property name="label" translatable="yes">Anon_ymous authentication</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -349,6 +420,7 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTable" id="table32">
|
<object class="GtkTable" id="table32">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="n_rows">3</property>
|
<property name="n_rows">3</property>
|
||||||
<property name="n_columns">3</property>
|
<property name="n_columns">3</property>
|
||||||
|
@ -357,18 +429,20 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label381">
|
<object class="GtkLabel" id="label381">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">Prox_y:</property>
|
<property name="label" translatable="yes">Prox_y:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x_options">GTK_FILL</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="proxies_combobox">
|
<object class="GtkComboBox" id="proxies_combobox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="model">liststore1</property>
|
<property name="model">liststore1</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||||
|
@ -386,44 +460,51 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="manage_proxies_button">
|
<object class="GtkButton" id="manage_proxies_button">
|
||||||
<property name="label" translatable="yes">Manage...</property>
|
<property name="label" translatable="yes">Manage...</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="clicked" handler="on_manage_proxies_button_clicked"/>
|
<signal name="clicked" handler="on_manage_proxies_button_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">3</property>
|
||||||
<property name="x_options"></property>
|
<property name="x_options"/>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="custom_host_port_checkbutton">
|
<object class="GtkCheckButton" id="custom_host_port_checkbutton">
|
||||||
<property name="label" translatable="yes">Use custom hostname/port</property>
|
<property name="label" translatable="yes">Use custom hostname/port</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<signal name="toggled" handler="on_custom_host_port_checkbutton_toggled"/>
|
<signal name="toggled" handler="on_custom_host_port_checkbutton_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">3</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">1</property>
|
||||||
<property name="bottom_attach">2</property>
|
<property name="bottom_attach">2</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHBox" id="custom_host_hbox">
|
<object class="GtkHBox" id="custom_host_hbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label380">
|
<object class="GtkLabel" id="label380">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">_Hostname:</property>
|
<property name="label" translatable="yes">_Hostname:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
@ -441,12 +522,15 @@ to the Jabber network.</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label379">
|
<object class="GtkLabel" id="label379">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">_Port:</property>
|
<property name="label" translatable="yes">_Port:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
@ -467,6 +551,7 @@ to the Jabber network.</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -484,12 +569,15 @@ to the Jabber network.</property>
|
||||||
<child type="label">
|
<child type="label">
|
||||||
<object class="GtkLabel" id="label378">
|
<object class="GtkLabel" id="label378">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">_Advanced</property>
|
<property name="label" translatable="yes">_Advanced</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -501,6 +589,7 @@ to the Jabber network.</property>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label367">
|
<object class="GtkLabel" id="label367">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
|
@ -510,34 +599,41 @@ to the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="ssl_vbox">
|
<object class="GtkVBox" id="ssl_vbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHBox" id="hbox1">
|
<object class="GtkHBox" id="hbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="image1">
|
<object class="GtkImage" id="image1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="stock">gtk-dialog-warning</property>
|
<property name="stock">gtk-dialog-warning</property>
|
||||||
<property name="icon-size">5</property>
|
<property name="icon-size">5</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="ssl_label">
|
<object class="GtkLabel" id="ssl_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
|
@ -547,13 +643,17 @@ to the Jabber network.</property>
|
||||||
<property name="label" translatable="yes">Add this certificate to the list of trusted certificates.
|
<property name="label" translatable="yes">Add this certificate to the list of trusted certificates.
|
||||||
SHA1 fingerprint of the certificate:
|
SHA1 fingerprint of the certificate:
|
||||||
</property>
|
</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
|
@ -566,6 +666,7 @@ SHA1 fingerprint of the certificate:
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label482">
|
<object class="GtkLabel" id="label482">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
|
@ -575,7 +676,7 @@ SHA1 fingerprint of the certificate:
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="form_vbox">
|
<object class="GtkVBox" id="form_vbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
|
@ -587,6 +688,7 @@ SHA1 fingerprint of the certificate:
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label382">
|
<object class="GtkLabel" id="label382">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">4</property>
|
<property name="position">4</property>
|
||||||
|
@ -596,10 +698,11 @@ SHA1 fingerprint of the certificate:
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox104">
|
<object class="GtkVBox" id="vbox104">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="progressbar_label">
|
<object class="GtkLabel" id="progressbar_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes"><b>Connecting to server</b>
|
<property name="label" translatable="yes"><b>Connecting to server</b>
|
||||||
|
|
||||||
Please wait...</property>
|
Please wait...</property>
|
||||||
|
@ -607,6 +710,7 @@ Please wait...</property>
|
||||||
<property name="justify">center</property>
|
<property name="justify">center</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
|
@ -614,6 +718,7 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkProgressBar" id="progressbar">
|
<object class="GtkProgressBar" id="progressbar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="pulse_step">0.10000000149</property>
|
<property name="pulse_step">0.10000000149</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -630,6 +735,7 @@ Please wait...</property>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label365">
|
<object class="GtkLabel" id="label365">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">5</property>
|
<property name="position">5</property>
|
||||||
|
@ -639,14 +745,16 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox103">
|
<object class="GtkVBox" id="vbox103">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHBox" id="hbox2986">
|
<object class="GtkHBox" id="hbox2986">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="finish_image">
|
<object class="GtkImage" id="finish_image">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-missing-image</property>
|
<property name="stock">gtk-missing-image</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -658,26 +766,34 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="finish_label">
|
<object class="GtkLabel" id="finish_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0.10000000149011612</property>
|
<property name="xalign">0.10000000149011612</property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="go_online_checkbutton">
|
<object class="GtkCheckButton" id="go_online_checkbutton">
|
||||||
<property name="label" translatable="yes">Connect when I press Finish</property>
|
<property name="label" translatable="yes">Connect when I press Finish</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -690,10 +806,13 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="show_vcard_checkbutton">
|
<object class="GtkCheckButton" id="show_vcard_checkbutton">
|
||||||
<property name="label" translatable="yes">Set my profile when I connect</property>
|
<property name="label" translatable="yes">Set my profile when I connect</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -711,6 +830,7 @@ Please wait...</property>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label286">
|
<object class="GtkLabel" id="label286">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">6</property>
|
<property name="position">6</property>
|
||||||
|
@ -719,23 +839,28 @@ Please wait...</property>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHButtonBox" id="hbuttonbox19">
|
<object class="GtkHButtonBox" id="hbuttonbox19">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<property name="layout_style">end</property>
|
<property name="layout_style">end</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="cancel_button">
|
<object class="GtkButton" id="cancel_button">
|
||||||
<property name="label">gtk-cancel</property>
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<signal name="clicked" handler="on_cancel_button_clicked"/>
|
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -746,13 +871,15 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="back_button">
|
<object class="GtkButton" id="back_button">
|
||||||
<property name="label">gtk-go-back</property>
|
<property name="label">gtk-go-back</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<signal name="clicked" handler="on_back_button_clicked"/>
|
<signal name="clicked" handler="on_back_button_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -763,13 +890,15 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="forward_button">
|
<object class="GtkButton" id="forward_button">
|
||||||
<property name="label">gtk-go-forward</property>
|
<property name="label">gtk-go-forward</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="has_default">True</property>
|
<property name="has_default">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<signal name="clicked" handler="on_forward_button_clicked"/>
|
<signal name="clicked" handler="on_forward_button_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -779,23 +908,28 @@ Please wait...</property>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="advanced_button">
|
<object class="GtkButton" id="advanced_button">
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<signal name="clicked" handler="on_advanced_button_clicked"/>
|
<property name="use_action_appearance">False</property>
|
||||||
|
<signal name="clicked" handler="on_advanced_button_clicked" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkAlignment" id="alignment96">
|
<object class="GtkAlignment" id="alignment96">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xscale">0</property>
|
<property name="xscale">0</property>
|
||||||
<property name="yscale">0</property>
|
<property name="yscale">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHBox" id="hbox2996">
|
<object class="GtkHBox" id="hbox2996">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">2</property>
|
<property name="spacing">2</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="image1265">
|
<object class="GtkImage" id="image1265">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-preferences</property>
|
<property name="stock">gtk-preferences</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -807,6 +941,7 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label364">
|
<object class="GtkLabel" id="label364">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">_Advanced</property>
|
<property name="label" translatable="yes">_Advanced</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -829,23 +964,28 @@ Please wait...</property>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="finish_button">
|
<object class="GtkButton" id="finish_button">
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<signal name="clicked" handler="on_finish_button_clicked"/>
|
<property name="use_action_appearance">False</property>
|
||||||
|
<signal name="clicked" handler="on_finish_button_clicked" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkAlignment" id="alignment87">
|
<object class="GtkAlignment" id="alignment87">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="xscale">0</property>
|
<property name="xscale">0</property>
|
||||||
<property name="yscale">0</property>
|
<property name="yscale">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHBox" id="hbox2989">
|
<object class="GtkHBox" id="hbox2989">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">2</property>
|
<property name="spacing">2</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="image1112">
|
<object class="GtkImage" id="image1112">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-apply</property>
|
<property name="stock">gtk-apply</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -857,6 +997,7 @@ Please wait...</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label352">
|
<object class="GtkLabel" id="label352">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">_Finish</property>
|
<property name="label" translatable="yes">_Finish</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -880,21 +1021,17 @@ Please wait...</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="liststore1">
|
<object class="GtkListStore" id="server_liststore">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name item -->
|
<!-- column-name gchararray1 -->
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
</columns>
|
</columns>
|
||||||
<data>
|
|
||||||
<row>
|
|
||||||
<col id="0" translatable="yes">None</col>
|
|
||||||
</row>
|
|
||||||
</data>
|
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
<object class="GtkNotebook" id="notebook">
|
<object class="GtkNotebook" id="notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="scrollable">True</property>
|
<property name="scrollable">True</property>
|
||||||
<property name="tab_border">0</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -31,7 +31,7 @@ if 'gtk' in os.listdir('.'):
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
'build_exe': {
|
'build_exe': {
|
||||||
'includes': ['gtk.keysyms', 'dumbdbm', 'dbhash', 'bsddb', 'new',
|
'includes': ['Gdk.KEY_, 'dumbdbm', 'dbhash', 'bsddb', 'new',
|
||||||
'goocanvas', 'Crypto.PublicKey.DSA', 'Crypto.Hash.HMAC',
|
'goocanvas', 'Crypto.PublicKey.DSA', 'Crypto.Hash.HMAC',
|
||||||
'numbers'],
|
'numbers'],
|
||||||
'base': 'Win32GUI',
|
'base': 'Win32GUI',
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
# FIXME: think if we need caching command list. it may be wrong if there will
|
# FIXME: think if we need caching command list. it may be wrong if there will
|
||||||
# be entities that often change the list, it may be slow to fetch it every time
|
# be entities that often change the list, it may be slow to fetch it every time
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
@ -91,7 +91,7 @@ class CommandWindow:
|
||||||
self.data_form_widget.destroy()
|
self.data_form_widget.destroy()
|
||||||
self.data_form_widget = dataforms_widget.DataFormWidget()
|
self.data_form_widget = dataforms_widget.DataFormWidget()
|
||||||
self.data_form_widget.show()
|
self.data_form_widget.show()
|
||||||
self.sending_form_stage_vbox.pack_start(self.data_form_widget)
|
self.sending_form_stage_vbox.pack_start(self.data_form_widget, True, True, 0)
|
||||||
|
|
||||||
if self.commandnode:
|
if self.commandnode:
|
||||||
# Execute command
|
# Execute command
|
||||||
|
@ -236,13 +236,13 @@ class CommandWindow:
|
||||||
# build the commands list radiobuttons
|
# build the commands list radiobuttons
|
||||||
first_radio = None
|
first_radio = None
|
||||||
for (commandnode, commandname) in self.commandlist:
|
for (commandnode, commandname) in self.commandlist:
|
||||||
radio = gtk.RadioButton(first_radio, label=commandname)
|
radio = Gtk.RadioButton(first_radio, label=commandname)
|
||||||
radio.connect("toggled", self.on_command_radiobutton_toggled,
|
radio.connect("toggled", self.on_command_radiobutton_toggled,
|
||||||
commandnode)
|
commandnode)
|
||||||
if not first_radio:
|
if not first_radio:
|
||||||
first_radio = radio
|
first_radio = radio
|
||||||
self.commandnode = commandnode
|
self.commandnode = commandnode
|
||||||
self.command_list_vbox.pack_start(radio, expand=False)
|
self.command_list_vbox.pack_start(radio, False, True, 0)
|
||||||
self.command_list_vbox.show_all()
|
self.command_list_vbox.show_all()
|
||||||
|
|
||||||
self.stage_finish = self.stage2_finish
|
self.stage_finish = self.stage2_finish
|
||||||
|
@ -321,8 +321,8 @@ class CommandWindow:
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
cb()
|
cb()
|
||||||
|
|
||||||
dialog = dialogs.HigDialog(self.window, gtk.DIALOG_DESTROY_WITH_PARENT \
|
dialog = dialogs.HigDialog(self.window, Gtk.DialogFlags.DESTROY_WITH_PARENT \
|
||||||
| gtk.DIALOG_MODAL, gtk.BUTTONS_YES_NO, _('Cancel confirmation'),
|
| Gtk.DialogFlags.MODAL, Gtk.ButtonsType.YES_NO, _('Cancel confirmation'),
|
||||||
_('You are in process of executing command. Do you really want to '
|
_('You are in process of executing command. Do you really want to '
|
||||||
'cancel it?'), on_response_yes=on_yes)
|
'cancel it?'), on_response_yes=on_yes)
|
||||||
dialog.popup()
|
dialog.popup()
|
||||||
|
@ -550,21 +550,21 @@ class CommandWindow:
|
||||||
progressbar.pulse() method
|
progressbar.pulse() method
|
||||||
"""
|
"""
|
||||||
assert not self.pulse_id
|
assert not self.pulse_id
|
||||||
assert isinstance(progressbar, gtk.ProgressBar)
|
assert isinstance(progressbar, Gtk.ProgressBar)
|
||||||
|
|
||||||
def callback():
|
def callback():
|
||||||
progressbar.pulse()
|
progressbar.pulse()
|
||||||
return True # important to keep callback be called back!
|
return True # important to keep callback be called back!
|
||||||
|
|
||||||
# 12 times per second (80 miliseconds)
|
# 12 times per second (80 miliseconds)
|
||||||
self.pulse_id = gobject.timeout_add(80, callback)
|
self.pulse_id = GObject.timeout_add(80, callback)
|
||||||
|
|
||||||
def remove_pulsing(self):
|
def remove_pulsing(self):
|
||||||
"""
|
"""
|
||||||
Stop pulsing, useful when especially when removing widget
|
Stop pulsing, useful when especially when removing widget
|
||||||
"""
|
"""
|
||||||
if self.pulse_id:
|
if self.pulse_id:
|
||||||
gobject.source_remove(self.pulse_id)
|
GObject.source_remove(self.pulse_id)
|
||||||
self.pulse_id = None
|
self.pulse_id = None
|
||||||
|
|
||||||
# handling xml stanzas
|
# handling xml stanzas
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
|
||||||
|
@ -50,12 +50,12 @@ def rate_limit(rate):
|
||||||
timeout = [None]
|
timeout = [None]
|
||||||
def f(*args, **kwargs):
|
def f(*args, **kwargs):
|
||||||
if timeout[0] is not None:
|
if timeout[0] is not None:
|
||||||
gobject.source_remove(timeout[0])
|
GObject.source_remove(timeout[0])
|
||||||
timeout[0] = None
|
timeout[0] = None
|
||||||
def timeout_func():
|
def timeout_func():
|
||||||
func(*args, **kwargs)
|
func(*args, **kwargs)
|
||||||
timeout[0] = None
|
timeout[0] = None
|
||||||
timeout[0] = gobject.timeout_add(int(1000.0 / rate), timeout_func)
|
timeout[0] = GObject.timeout_add(int(1000.0 / rate), timeout_func)
|
||||||
return f
|
return f
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class AdvancedConfigurationWindow(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('advanced_configuration_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('advanced_configuration_window.ui')
|
||||||
self.window = self.xml.get_object('advanced_configuration_window')
|
self.window = self.xml.get_object('advanced_configuration_window')
|
||||||
self.window.set_transient_for(
|
self.set_transient_for(
|
||||||
gajim.interface.instances['preferences'].window)
|
gajim.interface.instances['preferences'].window)
|
||||||
self.entry = self.xml.get_object('advanced_entry')
|
self.entry = self.xml.get_object('advanced_entry')
|
||||||
self.desc_label = self.xml.get_object('advanced_desc_label')
|
self.desc_label = self.xml.get_object('advanced_desc_label')
|
||||||
|
@ -98,18 +98,18 @@ class AdvancedConfigurationWindow(object):
|
||||||
|
|
||||||
treeview = self.xml.get_object('advanced_treeview')
|
treeview = self.xml.get_object('advanced_treeview')
|
||||||
self.treeview = treeview
|
self.treeview = treeview
|
||||||
self.model = gtk.TreeStore(str, str, str)
|
self.model = Gtk.TreeStore(str, str, str)
|
||||||
self.fill_model()
|
self.fill_model()
|
||||||
self.model.set_sort_column_id(0, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||||
self.modelfilter = self.model.filter_new()
|
self.modelfilter = self.model.filter_new()
|
||||||
self.modelfilter.set_visible_func(self.visible_func)
|
self.modelfilter.set_visible_func(self.visible_func)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
col = treeview.insert_column_with_attributes(-1, _('Preference Name'),
|
col = treeview.insert_column_with_attributes(-1, _('Preference Name'),
|
||||||
renderer_text, text = 0)
|
renderer_text, text = 0)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
renderer_text.connect('edited', self.on_config_edited)
|
renderer_text.connect('edited', self.on_config_edited)
|
||||||
col = treeview.insert_column_with_attributes(-1, _('Value'),
|
col = treeview.insert_column_with_attributes(-1, _('Value'),
|
||||||
renderer_text, text = 1)
|
renderer_text, text = 1)
|
||||||
|
@ -118,7 +118,7 @@ class AdvancedConfigurationWindow(object):
|
||||||
col.props.resizable = True
|
col.props.resizable = True
|
||||||
col.set_max_width(250)
|
col.set_max_width(250)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
treeview.insert_column_with_attributes(-1, _('Type'),
|
treeview.insert_column_with_attributes(-1, _('Type'),
|
||||||
renderer_text, text = 2)
|
renderer_text, text = 2)
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
|
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
from common import helpers
|
from common import helpers
|
||||||
|
@ -70,8 +70,8 @@ class AtomWindow:
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
self.entry_title_eventbox.add_events(gtk.gdk.BUTTON_PRESS_MASK)
|
self.entry_title_eventbox.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
|
||||||
self.feed_title_eventbox.add_events(gtk.gdk.BUTTON_PRESS_MASK)
|
self.feed_title_eventbox.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
|
||||||
|
|
||||||
def displayNextEntry(self):
|
def displayNextEntry(self):
|
||||||
"""
|
"""
|
||||||
|
@ -85,23 +85,23 @@ class AtomWindow:
|
||||||
if newentry.feed_link is not None:
|
if newentry.feed_link is not None:
|
||||||
self.feed_title_label.set_markup(
|
self.feed_title_label.set_markup(
|
||||||
u'<span foreground="blue" underline="single">%s</span>' % \
|
u'<span foreground="blue" underline="single">%s</span>' % \
|
||||||
gobject.markup_escape_text(newentry.feed_title))
|
GObject.markup_escape_text(newentry.feed_title))
|
||||||
else:
|
else:
|
||||||
self.feed_title_label.set_markup(
|
self.feed_title_label.set_markup(
|
||||||
gobject.markup_escape_text(newentry.feed_title))
|
GObject.markup_escape_text(newentry.feed_title))
|
||||||
|
|
||||||
self.feed_tagline_label.set_markup(
|
self.feed_tagline_label.set_markup(
|
||||||
u'<small>%s</small>' % \
|
u'<small>%s</small>' % \
|
||||||
gobject.markup_escape_text(newentry.feed_tagline))
|
GObject.markup_escape_text(newentry.feed_tagline))
|
||||||
|
|
||||||
if newentry.title:
|
if newentry.title:
|
||||||
if newentry.uri is not None:
|
if newentry.uri is not None:
|
||||||
self.entry_title_label.set_markup(
|
self.entry_title_label.set_markup(
|
||||||
u'<span foreground="blue" underline="single">%s</span>' % \
|
u'<span foreground="blue" underline="single">%s</span>' % \
|
||||||
gobject.markup_escape_text(newentry.title))
|
GObject.markup_escape_text(newentry.title))
|
||||||
else:
|
else:
|
||||||
self.entry_title_label.set_markup(
|
self.entry_title_label.set_markup(
|
||||||
gobject.markup_escape_text(newentry.title))
|
GObject.markup_escape_text(newentry.title))
|
||||||
else:
|
else:
|
||||||
self.entry_title_label.set_markup('')
|
self.entry_title_label.set_markup('')
|
||||||
|
|
||||||
|
|
|
@ -22,18 +22,19 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import GObject
|
||||||
|
|
||||||
class CellRendererImage(gtk.GenericCellRenderer):
|
class CellRendererImage(Gtk.CellRendererPixbuf):
|
||||||
|
|
||||||
__gproperties__ = {
|
__gproperties__ = {
|
||||||
'image': (gobject.TYPE_OBJECT, 'Image',
|
'image': (GObject.TYPE_OBJECT, 'Image',
|
||||||
'Image', gobject.PARAM_READWRITE),
|
'Image', GObject.PARAM_READWRITE),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, col_index, tv_index):
|
def __init__(self, col_index, tv_index):
|
||||||
self.__gobject_init__()
|
super(CellRendererImage, self).__init__()
|
||||||
self.image = None
|
self.image = None
|
||||||
self.col_index = col_index
|
self.col_index = col_index
|
||||||
self.tv_index = tv_index
|
self.tv_index = tv_index
|
||||||
|
@ -45,6 +46,14 @@ class CellRendererImage(gtk.GenericCellRenderer):
|
||||||
def do_get_property(self, pspec):
|
def do_get_property(self, pspec):
|
||||||
return getattr(self, pspec.name)
|
return getattr(self, pspec.name)
|
||||||
|
|
||||||
|
def do_activate(event, widget, path, bg_area, cell_area, flags):
|
||||||
|
"""Renderers cannot be activated; always return True."""
|
||||||
|
return True
|
||||||
|
|
||||||
|
def do_editing_started(event, widget, path, fb_area, cell_area, flags):
|
||||||
|
"""Renderers cannot be edited; always return None."""
|
||||||
|
return None
|
||||||
|
|
||||||
def func(self, model, path, iter_, image_tree):
|
def func(self, model, path, iter_, image_tree):
|
||||||
image, tree = image_tree
|
image, tree = image_tree
|
||||||
if model.get_value(iter_, self.tv_index) != image:
|
if model.get_value(iter_, self.tv_index) != image:
|
||||||
|
@ -57,7 +66,7 @@ class CellRendererImage(gtk.GenericCellRenderer):
|
||||||
cell_area.width, cell_area.height)
|
cell_area.width, cell_area.height)
|
||||||
|
|
||||||
def animation_timeout(self, tree, image):
|
def animation_timeout(self, tree, image):
|
||||||
if image.get_storage_type() != gtk.IMAGE_ANIMATION:
|
if image.get_storage_type() != Gtk.ImageType.ANIMATION:
|
||||||
return
|
return
|
||||||
self.redraw = 0
|
self.redraw = 0
|
||||||
iter_ = self.iters[image]
|
iter_ = self.iters[image]
|
||||||
|
@ -66,58 +75,48 @@ class CellRendererImage(gtk.GenericCellRenderer):
|
||||||
if model:
|
if model:
|
||||||
model.foreach(self.func, (image, tree))
|
model.foreach(self.func, (image, tree))
|
||||||
if self.redraw:
|
if self.redraw:
|
||||||
gobject.timeout_add(iter_.get_delay_time(),
|
GObject.timeout_add(iter_.get_delay_time(),
|
||||||
self.animation_timeout, tree, image)
|
self.animation_timeout, tree, image)
|
||||||
elif image in self.iters:
|
elif image in self.iters:
|
||||||
del self.iters[image]
|
del self.iters[image]
|
||||||
|
|
||||||
def on_render(self, window, widget, background_area, cell_area,
|
def do_render(self, ctx, widget, background_area, cell_area, flags):
|
||||||
expose_area, flags):
|
|
||||||
if not self.image:
|
if not self.image:
|
||||||
return
|
return
|
||||||
pix_rect = gtk.gdk.Rectangle()
|
|
||||||
pix_rect.x, pix_rect.y, pix_rect.width, pix_rect.height = \
|
|
||||||
self.on_get_size(widget, cell_area)
|
|
||||||
|
|
||||||
pix_rect.x += cell_area.x
|
if self.image.get_storage_type() == Gtk.ImageType.ANIMATION:
|
||||||
pix_rect.y += cell_area.y
|
|
||||||
pix_rect.width -= 2 * self.get_property('xpad')
|
|
||||||
pix_rect.height -= 2 * self.get_property('ypad')
|
|
||||||
|
|
||||||
draw_rect = cell_area.intersect(pix_rect)
|
|
||||||
draw_rect = expose_area.intersect(draw_rect)
|
|
||||||
|
|
||||||
if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
|
||||||
if self.image not in self.iters:
|
if self.image not in self.iters:
|
||||||
if not isinstance(widget, gtk.TreeView):
|
if not isinstance(widget, Gtk.TreeView):
|
||||||
return
|
return
|
||||||
animation = self.image.get_animation()
|
animation = self.image.get_animation()
|
||||||
iter_ = animation.get_iter()
|
iter_ = animation.get_iter()
|
||||||
self.iters[self.image] = iter_
|
self.iters[self.image] = iter_
|
||||||
gobject.timeout_add(iter_.get_delay_time(),
|
GObject.timeout_add(iter_.get_delay_time(),
|
||||||
self.animation_timeout, widget, self.image)
|
self.animation_timeout, widget, self.image)
|
||||||
|
|
||||||
pix = self.iters[self.image].get_pixbuf()
|
pix = self.iters[self.image].get_pixbuf()
|
||||||
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
elif self.image.get_storage_type() == Gtk.ImageType.PIXBUF:
|
||||||
pix = self.image.get_pixbuf()
|
pix = self.image.get_pixbuf()
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if draw_rect.x < 1:
|
|
||||||
return
|
|
||||||
window.draw_pixbuf(widget.style.black_gc, pix,
|
|
||||||
draw_rect.x - pix_rect.x,
|
|
||||||
draw_rect.y - pix_rect.y,
|
|
||||||
draw_rect.x, draw_rect.y,
|
|
||||||
draw_rect.width, draw_rect.height,
|
|
||||||
gtk.gdk.RGB_DITHER_NONE, 0, 0)
|
|
||||||
|
|
||||||
def on_get_size(self, widget, cell_area):
|
Gdk.cairo_set_source_pixbuf(ctx, pix, cell_area.x, cell_area.y)
|
||||||
|
ctx.paint()
|
||||||
|
|
||||||
|
def do_get_size(self, widget, cell_area):
|
||||||
|
"""
|
||||||
|
Return the size we need for this cell.
|
||||||
|
|
||||||
|
Each cell is drawn individually and is only as wide as it needs
|
||||||
|
to be, we let the TreeViewColumn take care of making them all
|
||||||
|
line up.
|
||||||
|
"""
|
||||||
if not self.image:
|
if not self.image:
|
||||||
return 0, 0, 0, 0
|
return 0, 0, 0, 0
|
||||||
if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if self.image.get_storage_type() == Gtk.ImageType.ANIMATION:
|
||||||
animation = self.image.get_animation()
|
animation = self.image.get_animation()
|
||||||
pix = animation.get_iter().get_pixbuf()
|
pix = animation.get_iter().get_pixbuf()
|
||||||
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
elif self.image.get_storage_type() == Gtk.ImageType.PIXBUF:
|
||||||
pix = self.image.get_pixbuf()
|
pix = self.image.get_pixbuf()
|
||||||
else:
|
else:
|
||||||
return 0, 0, 0, 0
|
return 0, 0, 0, 0
|
||||||
|
|
|
@ -29,9 +29,11 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import Gdk
|
||||||
import gobject
|
from gi.repository import GdkPixbuf
|
||||||
|
from gi.repository import Pango
|
||||||
|
from gi.repository import GObject
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
import gui_menu_builder
|
import gui_menu_builder
|
||||||
import message_control
|
import message_control
|
||||||
|
@ -97,7 +99,7 @@ langs = {_('English'): 'en', _('Belarusian'): 'be', _('Bulgarian'): 'bg',
|
||||||
if gajim.config.get('use_speller') and HAS_GTK_SPELL:
|
if gajim.config.get('use_speller') and HAS_GTK_SPELL:
|
||||||
# loop removing non-existent dictionaries
|
# loop removing non-existent dictionaries
|
||||||
# iterating on a copy
|
# iterating on a copy
|
||||||
tv = gtk.TextView()
|
tv = Gtk.TextView()
|
||||||
spell = gtkspell.Spell(tv)
|
spell = gtkspell.Spell(tv)
|
||||||
for lang in dict(langs):
|
for lang in dict(langs):
|
||||||
try:
|
try:
|
||||||
|
@ -115,13 +117,13 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
A base class containing a banner, ConversationTextview, MessageTextView
|
A base class containing a banner, ConversationTextview, MessageTextView
|
||||||
"""
|
"""
|
||||||
|
|
||||||
keymap = gtk.gdk.keymap_get_default()
|
keymap = Gdk.Keymap.get_default()
|
||||||
try:
|
try:
|
||||||
keycode_c = keymap.get_entries_for_keyval(gtk.keysyms.c)[0][0]
|
keycode_c = keymap.get_entries_for_keyval(Gdk.KEY_c)[0][0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
keycode_c = 54
|
keycode_c = 54
|
||||||
try:
|
try:
|
||||||
keycode_ins = keymap.get_entries_for_keyval(gtk.keysyms.Insert)[0][0]
|
keycode_ins = keymap.get_entries_for_keyval(Gdk.KEY_Insert)[0][0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
keycode_ins = 118
|
keycode_ins = 118
|
||||||
|
|
||||||
|
@ -142,22 +144,22 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
bannerfontattrs = gajim.config.get_per('themes', theme, 'bannerfontattrs')
|
bannerfontattrs = gajim.config.get_per('themes', theme, 'bannerfontattrs')
|
||||||
|
|
||||||
if bannerfont:
|
if bannerfont:
|
||||||
font = pango.FontDescription(bannerfont)
|
font = Pango.FontDescription(bannerfont)
|
||||||
else:
|
else:
|
||||||
font = pango.FontDescription('Normal')
|
font = Pango.FontDescription('Normal')
|
||||||
if bannerfontattrs:
|
if bannerfontattrs:
|
||||||
# B attribute is set by default
|
# B attribute is set by default
|
||||||
if 'B' in bannerfontattrs:
|
if 'B' in bannerfontattrs:
|
||||||
font.set_weight(pango.WEIGHT_HEAVY)
|
font.set_weight(Pango.Weight.HEAVY)
|
||||||
if 'I' in bannerfontattrs:
|
if 'I' in bannerfontattrs:
|
||||||
font.set_style(pango.STYLE_ITALIC)
|
font.set_style(Pango.Style.ITALIC)
|
||||||
|
|
||||||
font_attrs = 'font_desc="%s"' % font.to_string()
|
font_attrs = 'font_desc="%s"' % font.to_string()
|
||||||
|
|
||||||
# in case there is no font specified we use x-large font size
|
# in case there is no font specified we use x-large font size
|
||||||
if font.get_size() == 0:
|
if font.get_size() == 0:
|
||||||
font_attrs = '%s size="x-large"' % font_attrs
|
font_attrs = '%s size="x-large"' % font_attrs
|
||||||
font.set_weight(pango.WEIGHT_NORMAL)
|
font.set_weight(Pango.Weight.NORMAL)
|
||||||
font_attrs_small = 'font_desc="%s" size="small"' % font.to_string()
|
font_attrs_small = 'font_desc="%s" size="small"' % font.to_string()
|
||||||
return (font_attrs, font_attrs_small)
|
return (font_attrs, font_attrs_small)
|
||||||
|
|
||||||
|
@ -253,7 +255,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
Derives types SHOULD implement this, rather than connection to the even
|
Derives types SHOULD implement this, rather than connection to the even
|
||||||
itself
|
itself
|
||||||
"""
|
"""
|
||||||
event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
|
event = Gdk.Event(Gdk.KEY_PRESS)
|
||||||
event.keyval = event_keyval
|
event.keyval = event_keyval
|
||||||
event.state = event_keymod
|
event.state = event_keymod
|
||||||
event.time = 0
|
event.time = 0
|
||||||
|
@ -261,7 +263,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
_buffer = widget.get_buffer()
|
_buffer = widget.get_buffer()
|
||||||
start, end = _buffer.get_bounds()
|
start, end = _buffer.get_bounds()
|
||||||
|
|
||||||
if event.keyval -- gtk.keysyms.Tab:
|
if event.keyval -- Gdk.KEY_Tab:
|
||||||
position = _buffer.get_insert()
|
position = _buffer.get_insert()
|
||||||
end = _buffer.get_iter_at_mark(position)
|
end = _buffer.get_iter_at_mark(position)
|
||||||
|
|
||||||
|
@ -308,9 +310,9 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.seclabel_combo = combo
|
self.seclabel_combo = combo
|
||||||
self.seclabel_combo.hide()
|
self.seclabel_combo.hide()
|
||||||
self.seclabel_combo.set_no_show_all(True)
|
self.seclabel_combo.set_no_show_all(True)
|
||||||
lb = gtk.ListStore(str)
|
lb = Gtk.ListStore(str)
|
||||||
self.seclabel_combo.set_model(lb)
|
self.seclabel_combo.set_model(lb)
|
||||||
cell = gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
cell.set_property('xpad', 5) # padding for status text
|
cell.set_property('xpad', 5) # padding for status text
|
||||||
self.seclabel_combo.pack_start(cell, True)
|
self.seclabel_combo.pack_start(cell, True)
|
||||||
# text to show is in in first column of liststore
|
# text to show is in in first column of liststore
|
||||||
|
@ -376,15 +378,15 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
|
|
||||||
# Init DND
|
# Init DND
|
||||||
self.TARGET_TYPE_URI_LIST = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
self.dnd_list = [('text/uri-list', 0, self.TARGET_TYPE_URI_LIST),
|
self.dnd_list = [Gtk.TargetEntry.new('text/uri-list', 0,
|
||||||
('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_APP, 0)]
|
self.TARGET_TYPE_URI_LIST), Gtk.TargetEntry.new('MY_TREE_MODEL_ROW',
|
||||||
|
Gtk.TargetFlags.SAME_APP, 0)]
|
||||||
id_ = self.widget.connect('drag_data_received',
|
id_ = self.widget.connect('drag_data_received',
|
||||||
self._on_drag_data_received)
|
self._on_drag_data_received)
|
||||||
self.handlers[id_] = self.widget
|
self.handlers[id_] = self.widget
|
||||||
self.widget.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
|
self.widget.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||||
gtk.DEST_DEFAULT_HIGHLIGHT |
|
Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP,
|
||||||
gtk.DEST_DEFAULT_DROP,
|
self.dnd_list, Gdk.DragAction.COPY)
|
||||||
self.dnd_list, gtk.gdk.ACTION_COPY)
|
|
||||||
|
|
||||||
# Create textviews and connect signals
|
# Create textviews and connect signals
|
||||||
self.conv_textview = ConversationTextview(self.account)
|
self.conv_textview = ConversationTextview(self.account)
|
||||||
|
@ -402,10 +404,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.handlers[id_] = self.conv_textview.tv
|
self.handlers[id_] = self.conv_textview.tv
|
||||||
id_ = self.conv_textview.tv.connect('drag_leave', self._on_drag_leave)
|
id_ = self.conv_textview.tv.connect('drag_leave', self._on_drag_leave)
|
||||||
self.handlers[id_] = self.conv_textview.tv
|
self.handlers[id_] = self.conv_textview.tv
|
||||||
self.conv_textview.tv.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
|
self.conv_textview.tv.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||||
gtk.DEST_DEFAULT_HIGHLIGHT |
|
Gtk.DestDefaults.HIGHLIGHT |
|
||||||
gtk.DEST_DEFAULT_DROP,
|
Gtk.DestDefaults.DROP,
|
||||||
self.dnd_list, gtk.gdk.ACTION_COPY)
|
self.dnd_list, Gdk.DragAction.COPY)
|
||||||
|
|
||||||
self.conv_scrolledwindow = self.xml.get_object(
|
self.conv_scrolledwindow = self.xml.get_object(
|
||||||
'conversation_scrolledwindow')
|
'conversation_scrolledwindow')
|
||||||
|
@ -424,24 +426,24 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.msg_scrolledwindow = self.xml.get_object('message_scrolledwindow')
|
self.msg_scrolledwindow = self.xml.get_object('message_scrolledwindow')
|
||||||
self.msg_textview = MessageTextView()
|
self.msg_textview = MessageTextView()
|
||||||
id_ = self.msg_textview.connect('mykeypress',
|
id_ = self.msg_textview.connect('mykeypress',
|
||||||
self._on_message_textview_mykeypress_event)
|
self._on_message_textview_mykeypress_event)
|
||||||
self.handlers[id_] = self.msg_textview
|
self.handlers[id_] = self.msg_textview
|
||||||
self.msg_scrolledwindow.add(self.msg_textview)
|
self.msg_scrolledwindow.add(self.msg_textview)
|
||||||
id_ = self.msg_textview.connect('key_press_event',
|
id_ = self.msg_textview.connect('key_press_event',
|
||||||
self._on_message_textview_key_press_event)
|
self._on_message_textview_key_press_event)
|
||||||
self.handlers[id_] = self.msg_textview
|
self.handlers[id_] = self.msg_textview
|
||||||
id_ = self.msg_textview.connect('size-request', self.size_request)
|
id_ = self.msg_textview.connect('configure-event',
|
||||||
|
self.on_configure_event)
|
||||||
self.handlers[id_] = self.msg_textview
|
self.handlers[id_] = self.msg_textview
|
||||||
id_ = self.msg_textview.connect('populate_popup',
|
id_ = self.msg_textview.connect('populate_popup',
|
||||||
self.on_msg_textview_populate_popup)
|
self.on_msg_textview_populate_popup)
|
||||||
self.handlers[id_] = self.msg_textview
|
self.handlers[id_] = self.msg_textview
|
||||||
# Setup DND
|
# Setup DND
|
||||||
id_ = self.msg_textview.connect('drag_data_received',
|
id_ = self.msg_textview.connect('drag_data_received',
|
||||||
self._on_drag_data_received)
|
self._on_drag_data_received)
|
||||||
self.handlers[id_] = self.msg_textview
|
self.handlers[id_] = self.msg_textview
|
||||||
self.msg_textview.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
|
self.msg_textview.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||||
gtk.DEST_DEFAULT_HIGHLIGHT,
|
Gtk.DestDefaults.HIGHLIGHT, self.dnd_list, Gdk.DragAction.COPY)
|
||||||
self.dnd_list, gtk.gdk.ACTION_COPY)
|
|
||||||
|
|
||||||
self.update_font()
|
self.update_font()
|
||||||
|
|
||||||
|
@ -466,7 +468,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# (so toggle works ok)
|
# (so toggle works ok)
|
||||||
img = self.xml.get_object('emoticons_button_image')
|
img = self.xml.get_object('emoticons_button_image')
|
||||||
img.set_from_file(os.path.join(gajim.DATA_DIR, 'emoticons', 'static',
|
img.set_from_file(os.path.join(gajim.DATA_DIR, 'emoticons', 'static',
|
||||||
'smile.png'))
|
'smile.png'))
|
||||||
self.toggle_emoticons()
|
self.toggle_emoticons()
|
||||||
|
|
||||||
# Attach speller
|
# Attach speller
|
||||||
|
@ -516,14 +518,14 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
try:
|
try:
|
||||||
gtkspell.Spell(self.msg_textview, lang)
|
gtkspell.Spell(self.msg_textview, lang)
|
||||||
self.msg_textview.lang = lang
|
self.msg_textview.lang = lang
|
||||||
except (gobject.GError, RuntimeError, TypeError, OSError):
|
except (GObject.GError, RuntimeError, TypeError, OSError):
|
||||||
dialogs.AspellDictError(lang)
|
dialogs.AspellDictError(lang)
|
||||||
|
|
||||||
def on_banner_label_populate_popup(self, label, menu):
|
def on_banner_label_populate_popup(self, label, menu):
|
||||||
"""
|
"""
|
||||||
Override the default context menu and add our own menutiems
|
Override the default context menu and add our own menutiems
|
||||||
"""
|
"""
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
|
|
||||||
menu2 = self.prepare_context_menu()
|
menu2 = self.prepare_context_menu()
|
||||||
|
@ -566,26 +568,26 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
spell.set_language(lang)
|
spell.set_language(lang)
|
||||||
widget.set_active(True)
|
widget.set_active(True)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(gtk.STOCK_UNDO)
|
item = Gtk.ImageMenuItem(Gtk.STOCK_UNDO)
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
id_ = item.connect('activate', self.msg_textview.undo)
|
id_ = item.connect('activate', self.msg_textview.undo)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
|
item = Gtk.ImageMenuItem(Gtk.STOCK_CLEAR)
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
id_ = item.connect('activate', self.msg_textview.clear)
|
id_ = item.connect('activate', self.msg_textview.clear)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
if gajim.config.get('use_speller') and HAS_GTK_SPELL:
|
if gajim.config.get('use_speller') and HAS_GTK_SPELL:
|
||||||
item = gtk.MenuItem(_('Spelling language'))
|
item = Gtk.MenuItem(_('Spelling language'))
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
submenu = gtk.Menu()
|
submenu = Gtk.Menu()
|
||||||
item.set_submenu(submenu)
|
item.set_submenu(submenu)
|
||||||
for lang in sorted(langs):
|
for lang in sorted(langs):
|
||||||
item = gtk.CheckMenuItem(lang)
|
item = Gtk.CheckMenuItem(lang)
|
||||||
if langs[lang] == self.msg_textview.lang:
|
if langs[lang] == self.msg_textview.lang:
|
||||||
item.set_active(True)
|
item.set_active(True)
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
@ -618,7 +620,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
message_buffer = self.msg_textview.get_buffer()
|
message_buffer = self.msg_textview.get_buffer()
|
||||||
start_iter = message_buffer.get_start_iter()
|
start_iter = message_buffer.get_start_iter()
|
||||||
end_iter = message_buffer.get_end_iter()
|
end_iter = message_buffer.get_end_iter()
|
||||||
message = message_buffer.get_text(start_iter, end_iter, 0).decode('utf-8')
|
message = message_buffer.get_text(start_iter, end_iter, False).decode('utf-8')
|
||||||
xhtml = self.msg_textview.get_xhtml()
|
xhtml = self.msg_textview.get_xhtml()
|
||||||
|
|
||||||
# send the message
|
# send the message
|
||||||
|
@ -638,23 +640,23 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.disconnect_style_event(banner_name_label)
|
self.disconnect_style_event(banner_name_label)
|
||||||
self.disconnect_style_event(self.banner_status_label)
|
self.disconnect_style_event(self.banner_status_label)
|
||||||
if bgcolor:
|
if bgcolor:
|
||||||
banner_eventbox.modify_bg(gtk.STATE_NORMAL,
|
banner_eventbox.modify_bg(Gtk.StateType.NORMAL,
|
||||||
gtk.gdk.color_parse(bgcolor))
|
Gdk.color_parse(bgcolor))
|
||||||
default_bg = False
|
default_bg = False
|
||||||
else:
|
else:
|
||||||
default_bg = True
|
default_bg = True
|
||||||
if textcolor:
|
if textcolor:
|
||||||
banner_name_label.modify_fg(gtk.STATE_NORMAL,
|
banner_name_label.modify_fg(Gtk.StateType.NORMAL,
|
||||||
gtk.gdk.color_parse(textcolor))
|
Gdk.color_parse(textcolor))
|
||||||
self.banner_status_label.modify_fg(gtk.STATE_NORMAL,
|
self.banner_status_label.modify_fg(Gtk.StateType.NORMAL,
|
||||||
gtk.gdk.color_parse(textcolor))
|
Gdk.color_parse(textcolor))
|
||||||
default_fg = False
|
default_fg = False
|
||||||
else:
|
else:
|
||||||
default_fg = True
|
default_fg = True
|
||||||
if default_bg or default_fg:
|
if default_bg or default_fg:
|
||||||
self._on_style_set_event(banner_name_label, None, default_fg,
|
self._on_style_set_event(banner_name_label, None, default_fg,
|
||||||
default_bg)
|
default_bg)
|
||||||
if self.banner_status_label.flags() & gtk.REALIZED:
|
if self.banner_status_label.get_realized():
|
||||||
# Widget is realized
|
# Widget is realized
|
||||||
self._on_style_set_event(self.banner_status_label, None, default_fg,
|
self._on_style_set_event(self.banner_status_label, None, default_fg,
|
||||||
default_bg)
|
default_bg)
|
||||||
|
@ -682,20 +684,20 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
banner_eventbox = self.xml.get_object('banner_eventbox')
|
banner_eventbox = self.xml.get_object('banner_eventbox')
|
||||||
self.disconnect_style_event(widget)
|
self.disconnect_style_event(widget)
|
||||||
if opts[1]:
|
if opts[1]:
|
||||||
bg_color = widget.style.bg[gtk.STATE_SELECTED]
|
bg_color = widget.get_style().bg[Gtk.StateType.SELECTED]
|
||||||
banner_eventbox.modify_bg(gtk.STATE_NORMAL, bg_color)
|
banner_eventbox.modify_bg(Gtk.StateType.NORMAL, bg_color)
|
||||||
if opts[0]:
|
if opts[0]:
|
||||||
fg_color = widget.style.fg[gtk.STATE_SELECTED]
|
fg_color = widget.get_style().fg[Gtk.StateType.SELECTED]
|
||||||
widget.modify_fg(gtk.STATE_NORMAL, fg_color)
|
widget.modify_fg(Gtk.StateType.NORMAL, fg_color)
|
||||||
self.connect_style_event(widget, opts[0], opts[1])
|
self.connect_style_event(widget, opts[0], opts[1])
|
||||||
|
|
||||||
def _conv_textview_key_press_event(self, widget, event):
|
def _conv_textview_key_press_event(self, widget, event):
|
||||||
# translate any layout to latin_layout
|
# translate any layout to latin_layout
|
||||||
keymap = gtk.gdk.keymap_get_default()
|
keymap = Gdk.keymap_get_default()
|
||||||
keycode = keymap.get_entries_for_keyval(event.keyval)[0][0]
|
keycode = keymap.get_entries_for_keyval(event.keyval)[0][0]
|
||||||
if (event.state & gtk.gdk.CONTROL_MASK and keycode in (self.keycode_c,
|
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and keycode in (self.keycode_c,
|
||||||
self.keycode_ins)) or (event.state & gtk.gdk.SHIFT_MASK and \
|
self.keycode_ins)) or (event.get_state() & Gdk.ModifierType.SHIFT_MASK and \
|
||||||
event.keyval in (gtk.keysyms.Page_Down, gtk.keysyms.Page_Up)):
|
event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up)):
|
||||||
return False
|
return False
|
||||||
self.parent_win.notebook.emit('key_press_event', event)
|
self.parent_win.notebook.emit('key_press_event', event)
|
||||||
return True
|
return True
|
||||||
|
@ -705,7 +707,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
return
|
return
|
||||||
|
|
||||||
def set_emoticons_menu_position(w, msg_tv=self.msg_textview):
|
def set_emoticons_menu_position(w, msg_tv=self.msg_textview):
|
||||||
window = msg_tv.get_window(gtk.TEXT_WINDOW_WIDGET)
|
window = msg_tv.get_window(Gtk.TextWindowType.WIDGET)
|
||||||
# get the window position
|
# get the window position
|
||||||
origin = window.get_origin()
|
origin = window.get_origin()
|
||||||
size = window.get_size()
|
size = window.get_size()
|
||||||
|
@ -713,7 +715,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# get the cursor position
|
# get the cursor position
|
||||||
cursor = msg_tv.get_iter_location(buf.get_iter_at_mark(
|
cursor = msg_tv.get_iter_location(buf.get_iter_at_mark(
|
||||||
buf.get_insert()))
|
buf.get_insert()))
|
||||||
cursor = msg_tv.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT,
|
cursor = msg_tv.buffer_to_window_coords(Gtk.TextWindowType.TEXT,
|
||||||
cursor.x, cursor.y)
|
cursor.x, cursor.y)
|
||||||
x = origin[0] + cursor[0]
|
x = origin[0] + cursor[0]
|
||||||
y = origin[1] + size[1]
|
y = origin[1] + size[1]
|
||||||
|
@ -724,7 +726,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# then go show just above the current cursor line for up
|
# then go show just above the current cursor line for up
|
||||||
# or just below the current cursor line for down
|
# or just below the current cursor line for down
|
||||||
#TEST with having 3 lines and writing in the 2nd
|
#TEST with having 3 lines and writing in the 2nd
|
||||||
if y + menu_height > gtk.gdk.screen_height():
|
if y + menu_height > Gdk.Screen.height():
|
||||||
# move menu just above cursor
|
# move menu just above cursor
|
||||||
y -= menu_height + (msg_tv.allocation.height / buf.get_line_count())
|
y -= menu_height + (msg_tv.allocation.height / buf.get_line_count())
|
||||||
#else: # move menu just below cursor
|
#else: # move menu just below cursor
|
||||||
|
@ -735,37 +737,37 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
set_emoticons_menu_position, 1, 0)
|
set_emoticons_menu_position, 1, 0)
|
||||||
|
|
||||||
def _on_message_textview_key_press_event(self, widget, event):
|
def _on_message_textview_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.space:
|
if event.keyval == Gdk.KEY_space:
|
||||||
self.space_pressed = True
|
self.space_pressed = True
|
||||||
|
|
||||||
elif (self.space_pressed or self.msg_textview.undo_pressed) and \
|
elif (self.space_pressed or self.msg_textview.undo_pressed) and \
|
||||||
event.keyval not in (gtk.keysyms.Control_L, gtk.keysyms.Control_R) and \
|
event.keyval not in (Gdk.KEY_Control_L, Gdk.KEY_Control_R) and \
|
||||||
not (event.keyval == gtk.keysyms.z and event.state & gtk.gdk.CONTROL_MASK):
|
not (event.keyval == Gdk.KEY_z and event.get_state() & Gdk.ModifierType.CONTROL_MASK):
|
||||||
# If the space key has been pressed and now it hasnt,
|
# If the space key has been pressed and now it hasnt,
|
||||||
# we save the buffer into the undo list. But be carefull we're not
|
# we save the buffer into the undo list. But be carefull we're not
|
||||||
# pressiong Control again (as in ctrl+z)
|
# pressiong Control again (as in ctrl+z)
|
||||||
_buffer = widget.get_buffer()
|
_buffer = widget.get_buffer()
|
||||||
start_iter, end_iter = _buffer.get_bounds()
|
start_iter, end_iter = _buffer.get_bounds()
|
||||||
self.msg_textview.save_undo(_buffer.get_text(start_iter, end_iter))
|
self.msg_textview.save_undo(_buffer.get_text(start_iter, end_iter, True))
|
||||||
self.space_pressed = False
|
self.space_pressed = False
|
||||||
|
|
||||||
# Ctrl [+ Shift] + Tab are not forwarded to notebook. We handle it here
|
# Ctrl [+ Shift] + Tab are not forwarded to notebook. We handle it here
|
||||||
if self.widget_name == 'groupchat_control':
|
if self.widget_name == 'groupchat_control':
|
||||||
if event.keyval not in (gtk.keysyms.ISO_Left_Tab, gtk.keysyms.Tab):
|
if event.keyval not in (Gdk.KEY_ISO_Left_Tab, Gdk.KEY_Tab):
|
||||||
self.last_key_tabs = False
|
self.last_key_tabs = False
|
||||||
if event.state & gtk.gdk.SHIFT_MASK:
|
if event.get_state() & Gdk.ModifierType.SHIFT_MASK:
|
||||||
# CTRL + SHIFT + TAB
|
# CTRL + SHIFT + TAB
|
||||||
if event.state & gtk.gdk.CONTROL_MASK and \
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK and \
|
||||||
event.keyval == gtk.keysyms.ISO_Left_Tab:
|
event.keyval == Gdk.KEY_ISO_Left_Tab:
|
||||||
self.parent_win.move_to_next_unread_tab(False)
|
self.parent_win.move_to_next_unread_tab(False)
|
||||||
return True
|
return True
|
||||||
# SHIFT + PAGE_[UP|DOWN]: send to conv_textview
|
# SHIFT + PAGE_[UP|DOWN]: send to conv_textview
|
||||||
elif event.keyval == gtk.keysyms.Page_Down or \
|
elif event.keyval == Gdk.KEY_Page_Down or \
|
||||||
event.keyval == gtk.keysyms.Page_Up:
|
event.keyval == Gdk.KEY_Page_Up:
|
||||||
self.conv_textview.tv.emit('key_press_event', event)
|
self.conv_textview.tv.emit('key_press_event', event)
|
||||||
return True
|
return True
|
||||||
elif event.state & gtk.gdk.CONTROL_MASK:
|
elif event.get_state() & Gdk.ModifierType.CONTROL_MASK:
|
||||||
if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
|
if event.keyval == Gdk.KEY_Tab: # CTRL + TAB
|
||||||
self.parent_win.move_to_next_unread_tab(True)
|
self.parent_win.move_to_next_unread_tab(True)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -786,25 +788,25 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
xhtml = self.msg_textview.get_xhtml()
|
xhtml = self.msg_textview.get_xhtml()
|
||||||
|
|
||||||
# construct event instance from binding
|
# construct event instance from binding
|
||||||
event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) # it's always a key-press here
|
event = Gdk.Event(Gdk.KEY_PRESS) # it's always a key-press here
|
||||||
event.keyval = event_keyval
|
event.keyval = event_keyval
|
||||||
event.state = event_keymod
|
event.state = event_keymod
|
||||||
event.time = 0 # assign current time
|
event.time = 0 # assign current time
|
||||||
|
|
||||||
if event.keyval == gtk.keysyms.Up:
|
if event.keyval == Gdk.KEY_Up:
|
||||||
if event.state == gtk.gdk.CONTROL_MASK: # Ctrl+UP
|
if event.get_state() == Gdk.ModifierType.CONTROL_MASK: # Ctrl+UP
|
||||||
self.scroll_messages('up', message_buffer, 'sent')
|
self.scroll_messages('up', message_buffer, 'sent')
|
||||||
# Ctrl+Shift+UP
|
# Ctrl+Shift+UP
|
||||||
elif event.state == (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK):
|
elif event.get_state() == (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK):
|
||||||
self.scroll_messages('up', message_buffer, 'received')
|
self.scroll_messages('up', message_buffer, 'received')
|
||||||
elif event.keyval == gtk.keysyms.Down:
|
elif event.keyval == Gdk.KEY_Down:
|
||||||
if event.state == gtk.gdk.CONTROL_MASK: # Ctrl+Down
|
if event.get_state() == Gdk.ModifierType.CONTROL_MASK: # Ctrl+Down
|
||||||
self.scroll_messages('down', message_buffer, 'sent')
|
self.scroll_messages('down', message_buffer, 'sent')
|
||||||
# Ctrl+Shift+Down
|
# Ctrl+Shift+Down
|
||||||
elif event.state == (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK):
|
elif event.get_state() == (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK):
|
||||||
self.scroll_messages('down', message_buffer, 'received')
|
self.scroll_messages('down', message_buffer, 'received')
|
||||||
elif event.keyval == gtk.keysyms.Return or \
|
elif event.keyval == Gdk.KEY_Return or \
|
||||||
event.keyval == gtk.keysyms.KP_Enter: # ENTER
|
event.keyval == Gdk.KEY_KP_Enter: # ENTER
|
||||||
# NOTE: SHIFT + ENTER is not needed to be emulated as it is not
|
# NOTE: SHIFT + ENTER is not needed to be emulated as it is not
|
||||||
# binding at all (textview's default action is newline)
|
# binding at all (textview's default action is newline)
|
||||||
|
|
||||||
|
@ -812,14 +814,14 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# here, we emulate GTK default action on ENTER (add new line)
|
# here, we emulate GTK default action on ENTER (add new line)
|
||||||
# normally I would add in keypress but it gets way to complex
|
# normally I would add in keypress but it gets way to complex
|
||||||
# to get instant result on changing this advanced setting
|
# to get instant result on changing this advanced setting
|
||||||
if event.state == 0: # no ctrl, no shift just ENTER add newline
|
if event.get_state() == 0: # no ctrl, no shift just ENTER add newline
|
||||||
end_iter = message_buffer.get_end_iter()
|
end_iter = message_buffer.get_end_iter()
|
||||||
message_buffer.insert_at_cursor('\n')
|
message_buffer.insert_at_cursor('\n')
|
||||||
send_message = False
|
send_message = False
|
||||||
elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + ENTER
|
elif event.get_state() & Gdk.ModifierType.CONTROL_MASK: # CTRL + ENTER
|
||||||
send_message = True
|
send_message = True
|
||||||
else: # send on Enter, do newline on Ctrl Enter
|
else: # send on Enter, do newline on Ctrl Enter
|
||||||
if event.state & gtk.gdk.CONTROL_MASK: # Ctrl + ENTER
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK: # Ctrl + ENTER
|
||||||
end_iter = message_buffer.get_end_iter()
|
end_iter = message_buffer.get_end_iter()
|
||||||
message_buffer.insert_at_cursor('\n')
|
message_buffer.insert_at_cursor('\n')
|
||||||
send_message = False
|
send_message = False
|
||||||
|
@ -834,8 +836,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
|
|
||||||
if send_message:
|
if send_message:
|
||||||
self.send_message(message, xhtml=xhtml) # send the message
|
self.send_message(message, xhtml=xhtml) # send the message
|
||||||
elif event.keyval == gtk.keysyms.z: # CTRL+z
|
elif event.keyval == Gdk.KEY_z: # CTRL+z
|
||||||
if event.state & gtk.gdk.CONTROL_MASK:
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
|
||||||
self.msg_textview.undo()
|
self.msg_textview.undo()
|
||||||
else:
|
else:
|
||||||
# Give the control itself a chance to process
|
# Give the control itself a chance to process
|
||||||
|
@ -1045,7 +1047,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
"""
|
"""
|
||||||
Popup formattings menu
|
Popup formattings menu
|
||||||
"""
|
"""
|
||||||
menu = gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
|
|
||||||
menuitems = ((_('Bold'), 'bold'),
|
menuitems = ((_('Bold'), 'bold'),
|
||||||
(_('Italic'), 'italic'),
|
(_('Italic'), 'italic'),
|
||||||
|
@ -1055,7 +1057,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
active_tags = self.msg_textview.get_active_tags()
|
active_tags = self.msg_textview.get_active_tags()
|
||||||
|
|
||||||
for menuitem in menuitems:
|
for menuitem in menuitems:
|
||||||
item = gtk.CheckMenuItem(menuitem[0])
|
item = Gtk.CheckMenuItem(menuitem[0])
|
||||||
if menuitem[1] in active_tags:
|
if menuitem[1] in active_tags:
|
||||||
item.set_active(True)
|
item.set_active(True)
|
||||||
else:
|
else:
|
||||||
|
@ -1064,26 +1066,26 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
menuitem[1])
|
menuitem[1])
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem() # separator
|
item = Gtk.SeparatorMenuItem() # separator
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(_('Color'))
|
item = Gtk.ImageMenuItem(_('Color'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_SELECT_COLOR, gtk.ICON_SIZE_MENU)
|
icon = Gtk.Image.new_from_stock(Gtk.STOCK_SELECT_COLOR, Gtk.IconSize.MENU)
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
item.connect('activate', self.on_color_menuitem_activale)
|
item.connect('activate', self.on_color_menuitem_activale)
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(_('Font'))
|
item = Gtk.ImageMenuItem(_('Font'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_SELECT_FONT, gtk.ICON_SIZE_MENU)
|
icon = Gtk.Image.new_from_stock(Gtk.STOCK_SELECT_FONT, Gtk.IconSize.MENU)
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
item.connect('activate', self.on_font_menuitem_activale)
|
item.connect('activate', self.on_font_menuitem_activale)
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem() # separator
|
item = Gtk.SeparatorMenuItem() # separator
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(_('Clear formating'))
|
item = Gtk.ImageMenuItem(_('Clear formating'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU)
|
icon = Gtk.Image.new_from_stock(Gtk.STOCK_CLEAR, Gtk.IconSize.MENU)
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
item.connect('activate', self.msg_textview.clear_tags)
|
item.connect('activate', self.msg_textview.clear_tags)
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
@ -1093,13 +1095,13 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.parent_win)
|
self.parent_win)
|
||||||
|
|
||||||
def on_color_menuitem_activale(self, widget):
|
def on_color_menuitem_activale(self, widget):
|
||||||
color_dialog = gtk.ColorSelectionDialog('Select a color')
|
color_dialog = Gtk.ColorSelectionDialog('Select a color')
|
||||||
color_dialog.connect('response', self.msg_textview.color_set,
|
color_dialog.connect('response', self.msg_textview.color_set,
|
||||||
color_dialog.colorsel)
|
color_dialog.colorsel)
|
||||||
color_dialog.show_all()
|
color_dialog.show_all()
|
||||||
|
|
||||||
def on_font_menuitem_activale(self, widget):
|
def on_font_menuitem_activale(self, widget):
|
||||||
font_dialog = gtk.FontSelectionDialog('Select a font')
|
font_dialog = Gtk.FontSelectionDialog('Select a font')
|
||||||
font_dialog.connect('response', self.msg_textview.font_set,
|
font_dialog.connect('response', self.msg_textview.font_set,
|
||||||
font_dialog.fontsel)
|
font_dialog.fontsel)
|
||||||
font_dialog.show_all()
|
font_dialog.show_all()
|
||||||
|
@ -1114,7 +1116,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.parent_win)
|
self.parent_win)
|
||||||
|
|
||||||
def update_font(self):
|
def update_font(self):
|
||||||
font = pango.FontDescription(gajim.config.get('conversation_font'))
|
font = Pango.FontDescription(gajim.config.get('conversation_font'))
|
||||||
self.conv_textview.tv.modify_font(font)
|
self.conv_textview.tv.modify_font(font)
|
||||||
self.msg_textview.modify_font(font)
|
self.msg_textview.modify_font(font)
|
||||||
|
|
||||||
|
@ -1214,7 +1216,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
visible_rect = textview.get_visible_rect()
|
visible_rect = textview.get_visible_rect()
|
||||||
# scroll only if expected end is not visible
|
# scroll only if expected end is not visible
|
||||||
if end_rect.y >= (visible_rect.y + visible_rect.height + diff_y):
|
if end_rect.y >= (visible_rect.y + visible_rect.height + diff_y):
|
||||||
self.scroll_to_end_id = gobject.idle_add(self.scroll_to_end_iter,
|
self.scroll_to_end_id = GObject.idle_add(self.scroll_to_end_iter,
|
||||||
textview)
|
textview)
|
||||||
|
|
||||||
def scroll_to_end_iter(self, textview):
|
def scroll_to_end_iter(self, textview):
|
||||||
|
@ -1224,20 +1226,20 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self.scroll_to_end_id = None
|
self.scroll_to_end_id = None
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def size_request(self, msg_textview, requisition):
|
def on_configure_event(self, msg_textview, event):
|
||||||
"""
|
"""
|
||||||
When message_textview changes its size: if the new height will enlarge
|
When message_textview changes its size: if the new height will enlarge
|
||||||
the window, enable the scrollbar automatic policy. Also enable scrollbar
|
the window, enable the scrollbar automatic policy. Also enable scrollbar
|
||||||
automatic policy for horizontal scrollbar if message we have in
|
automatic policy for horizontal scrollbar if message we have in
|
||||||
message_textview is too big
|
message_textview is too big
|
||||||
"""
|
"""
|
||||||
if msg_textview.window is None:
|
if msg_textview.get_window() is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
min_height = self.conv_scrolledwindow.get_property('height-request')
|
min_height = self.conv_scrolledwindow.get_property('height-request')
|
||||||
conversation_height = self.conv_textview.tv.window.get_size()[1]
|
conversation_height = self.conv_textview.tv.get_window().get_size()[1]
|
||||||
message_height = msg_textview.window.get_size()[1]
|
message_height = msg_textview.get_window().get_size()[1]
|
||||||
message_width = msg_textview.window.get_size()[0]
|
message_width = msg_textview.get_window().get_size()[0]
|
||||||
# new tab is not exposed yet
|
# new tab is not exposed yet
|
||||||
if conversation_height < 2:
|
if conversation_height < 2:
|
||||||
return
|
return
|
||||||
|
@ -1250,31 +1252,31 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# but we also want to avoid window resizing so if we reach that
|
# but we also want to avoid window resizing so if we reach that
|
||||||
# minimum for conversation_textview and maximum for message_textview
|
# minimum for conversation_textview and maximum for message_textview
|
||||||
# we set to automatic the scrollbar policy
|
# we set to automatic the scrollbar policy
|
||||||
diff_y = message_height - requisition.height
|
diff_y = message_height - event.height
|
||||||
if diff_y != 0:
|
if diff_y != 0:
|
||||||
if conversation_height + diff_y < min_height:
|
if conversation_height + diff_y < min_height:
|
||||||
if message_height + conversation_height - min_height > min_height:
|
if message_height + conversation_height - min_height > min_height:
|
||||||
policy = self.msg_scrolledwindow.get_property(
|
policy = self.msg_scrolledwindow.get_property(
|
||||||
'vscrollbar-policy')
|
'vscrollbar-policy')
|
||||||
if policy != gtk.POLICY_AUTOMATIC:
|
if policy != Gtk.PolicyType.AUTOMATIC:
|
||||||
self.msg_scrolledwindow.set_property('vscrollbar-policy',
|
self.msg_scrolledwindow.set_property('vscrollbar-policy',
|
||||||
gtk.POLICY_AUTOMATIC)
|
Gtk.PolicyType.AUTOMATIC)
|
||||||
self.msg_scrolledwindow.set_property('height-request',
|
self.msg_scrolledwindow.set_property('height-request',
|
||||||
message_height + conversation_height - min_height)
|
message_height + conversation_height - min_height)
|
||||||
else:
|
else:
|
||||||
self.msg_scrolledwindow.set_property('vscrollbar-policy',
|
self.msg_scrolledwindow.set_property('vscrollbar-policy',
|
||||||
gtk.POLICY_NEVER)
|
Gtk.PolicyType.NEVER)
|
||||||
self.msg_scrolledwindow.set_property('height-request', -1)
|
self.msg_scrolledwindow.set_property('height-request', -1)
|
||||||
|
|
||||||
self.smooth = True # reinit the flag
|
self.smooth = True # reinit the flag
|
||||||
# enable scrollbar automatic policy for horizontal scrollbar
|
# enable scrollbar automatic policy for horizontal scrollbar
|
||||||
# if message we have in message_textview is too big
|
# if message we have in message_textview is too big
|
||||||
if requisition.width > message_width:
|
if event.width > message_width:
|
||||||
self.msg_scrolledwindow.set_property('hscrollbar-policy',
|
self.msg_scrolledwindow.set_property('hscrollbar-policy',
|
||||||
gtk.POLICY_AUTOMATIC)
|
Gtk.PolicyType.AUTOMATIC)
|
||||||
else:
|
else:
|
||||||
self.msg_scrolledwindow.set_property('hscrollbar-policy',
|
self.msg_scrolledwindow.set_property('hscrollbar-policy',
|
||||||
gtk.POLICY_NEVER)
|
Gtk.PolicyType.NEVER)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1283,13 +1285,15 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# textview.
|
# textview.
|
||||||
if self.was_at_the_end:
|
if self.was_at_the_end:
|
||||||
self.conv_textview.bring_scroll_to_end(-18)
|
self.conv_textview.bring_scroll_to_end(-18)
|
||||||
self.was_at_the_end = (adjustment.upper - adjustment.value - adjustment.page_size) < 18
|
self.was_at_the_end = (adjustment.get_upper() - adjustment.get_value() \
|
||||||
|
- adjustment.get_page_size()) < 18
|
||||||
|
|
||||||
def on_conversation_vadjustment_value_changed(self, adjustment):
|
def on_conversation_vadjustment_value_changed(self, adjustment):
|
||||||
# stop automatic scroll when we manually scroll
|
# stop automatic scroll when we manually scroll
|
||||||
if not self.conv_textview.auto_scrolling:
|
if not self.conv_textview.auto_scrolling:
|
||||||
self.conv_textview.stop_scrolling()
|
self.conv_textview.stop_scrolling()
|
||||||
self.was_at_the_end = (adjustment.upper - adjustment.value - adjustment.page_size) < 18
|
self.was_at_the_end = (adjustment.get_upper() - adjustment.get_value() \
|
||||||
|
- adjustment.page_size) < 18
|
||||||
if self.resource:
|
if self.resource:
|
||||||
jid = self.contact.get_full_jid()
|
jid = self.contact.get_full_jid()
|
||||||
else:
|
else:
|
||||||
|
@ -1361,7 +1365,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# whatever is already typed
|
# whatever is already typed
|
||||||
start_iter = msg_buf.get_start_iter()
|
start_iter = msg_buf.get_start_iter()
|
||||||
end_iter = msg_buf.get_end_iter()
|
end_iter = msg_buf.get_end_iter()
|
||||||
self.orig_msg = msg_buf.get_text(start_iter, end_iter, 0).decode(
|
self.orig_msg = msg_buf.get_text(start_iter, end_iter, False).decode(
|
||||||
'utf-8')
|
'utf-8')
|
||||||
pos += -1 if direction == 'up' else +1
|
pos += -1 if direction == 'up' else +1
|
||||||
if pos == -1:
|
if pos == -1:
|
||||||
|
@ -1394,7 +1398,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
"""
|
"""
|
||||||
# make the last message visible, when changing to "full view"
|
# make the last message visible, when changing to "full view"
|
||||||
if not state:
|
if not state:
|
||||||
gobject.idle_add(self.conv_textview.scroll_to_end_iter)
|
GObject.idle_add(self.conv_textview.scroll_to_end_iter)
|
||||||
|
|
||||||
widget.set_no_show_all(state)
|
widget.set_no_show_all(state)
|
||||||
if state:
|
if state:
|
||||||
|
@ -1480,7 +1484,7 @@ class ChatControl(ChatControlBase):
|
||||||
self._send_file_button = self.xml.get_object('send_file_button')
|
self._send_file_button = self.xml.get_object('send_file_button')
|
||||||
# add a special img for send file button
|
# add a special img for send file button
|
||||||
path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload')
|
path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload')
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
img.set_from_file(path_to_upload_img)
|
img.set_from_file(path_to_upload_img)
|
||||||
self._send_file_button.set_image(img)
|
self._send_file_button.set_image(img)
|
||||||
id_ = self._send_file_button.connect('clicked',
|
id_ = self._send_file_button.connect('clicked',
|
||||||
|
@ -1600,15 +1604,15 @@ class ChatControl(ChatControlBase):
|
||||||
id_ = widget.connect('value_changed', self.on_sound_hscale_value_changed)
|
id_ = widget.connect('value_changed', self.on_sound_hscale_value_changed)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
self.info_bar = gtk.InfoBar()
|
self.info_bar = Gtk.InfoBar()
|
||||||
content_area = self.info_bar.get_content_area()
|
content_area = self.info_bar.get_content_area()
|
||||||
self.info_bar_label = gtk.Label()
|
self.info_bar_label = Gtk.Label()
|
||||||
self.info_bar_label.set_use_markup(True)
|
self.info_bar_label.set_use_markup(True)
|
||||||
self.info_bar_label.set_alignment(0, 0)
|
self.info_bar_label.set_alignment(0, 0)
|
||||||
content_area.add(self.info_bar_label)
|
content_area.add(self.info_bar_label)
|
||||||
self.info_bar.set_no_show_all(True)
|
self.info_bar.set_no_show_all(True)
|
||||||
widget = self.xml.get_object('vbox2')
|
widget = self.xml.get_object('vbox2')
|
||||||
widget.pack_start(self.info_bar, expand=False, padding=5)
|
widget.pack_start(self.info_bar, False, True, 5)
|
||||||
widget.reorder_child(self.info_bar, 1)
|
widget.reorder_child(self.info_bar, 1)
|
||||||
|
|
||||||
# List of waiting infobar messages
|
# List of waiting infobar messages
|
||||||
|
@ -1811,16 +1815,16 @@ class ChatControl(ChatControlBase):
|
||||||
banner_image.show()
|
banner_image.show()
|
||||||
if state == self.JINGLE_STATE_CONNECTING:
|
if state == self.JINGLE_STATE_CONNECTING:
|
||||||
banner_image.set_from_stock(
|
banner_image.set_from_stock(
|
||||||
gtk.STOCK_CONVERT, 1)
|
Gtk.STOCK_CONVERT, 1)
|
||||||
elif state == self.JINGLE_STATE_CONNECTION_RECEIVED:
|
elif state == self.JINGLE_STATE_CONNECTION_RECEIVED:
|
||||||
banner_image.set_from_stock(
|
banner_image.set_from_stock(
|
||||||
gtk.STOCK_NETWORK, 1)
|
Gtk.STOCK_NETWORK, 1)
|
||||||
elif state == self.JINGLE_STATE_CONNECTED:
|
elif state == self.JINGLE_STATE_CONNECTED:
|
||||||
banner_image.set_from_stock(
|
banner_image.set_from_stock(
|
||||||
gtk.STOCK_CONNECT, 1)
|
Gtk.STOCK_CONNECT, 1)
|
||||||
elif state == self.JINGLE_STATE_ERROR:
|
elif state == self.JINGLE_STATE_ERROR:
|
||||||
banner_image.set_from_stock(
|
banner_image.set_from_stock(
|
||||||
gtk.STOCK_DIALOG_WARNING, 1)
|
Gtk.STOCK_DIALOG_WARNING, 1)
|
||||||
self.update_toolbar()
|
self.update_toolbar()
|
||||||
|
|
||||||
def update_audio(self):
|
def update_audio(self):
|
||||||
|
@ -1948,8 +1952,8 @@ class ChatControl(ChatControlBase):
|
||||||
if avatar_w > scaled_buf_w or avatar_h > scaled_buf_h:
|
if avatar_w > scaled_buf_w or avatar_h > scaled_buf_h:
|
||||||
# wait for 0.5 sec in case we leave earlier
|
# wait for 0.5 sec in case we leave earlier
|
||||||
if self.show_bigger_avatar_timeout_id is not None:
|
if self.show_bigger_avatar_timeout_id is not None:
|
||||||
gobject.source_remove(self.show_bigger_avatar_timeout_id)
|
GObject.source_remove(self.show_bigger_avatar_timeout_id)
|
||||||
self.show_bigger_avatar_timeout_id = gobject.timeout_add(500,
|
self.show_bigger_avatar_timeout_id = GObject.timeout_add(500,
|
||||||
self.show_bigger_avatar, widget)
|
self.show_bigger_avatar, widget)
|
||||||
|
|
||||||
def on_avatar_eventbox_leave_notify_event(self, widget, event):
|
def on_avatar_eventbox_leave_notify_event(self, widget, event):
|
||||||
|
@ -1958,7 +1962,7 @@ class ChatControl(ChatControlBase):
|
||||||
"""
|
"""
|
||||||
# did we add a timeout? if yes remove it
|
# did we add a timeout? if yes remove it
|
||||||
if self.show_bigger_avatar_timeout_id is not None:
|
if self.show_bigger_avatar_timeout_id is not None:
|
||||||
gobject.source_remove(self.show_bigger_avatar_timeout_id)
|
GObject.source_remove(self.show_bigger_avatar_timeout_id)
|
||||||
self.show_bigger_avatar_timeout_id = None
|
self.show_bigger_avatar_timeout_id = None
|
||||||
|
|
||||||
def on_avatar_eventbox_button_press_event(self, widget, event):
|
def on_avatar_eventbox_button_press_event(self, widget, event):
|
||||||
|
@ -1966,8 +1970,8 @@ class ChatControl(ChatControlBase):
|
||||||
If right-clicked, show popup
|
If right-clicked, show popup
|
||||||
"""
|
"""
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
menu = gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
menuitem = gtk.ImageMenuItem(gtk.STOCK_SAVE_AS)
|
menuitem = Gtk.ImageMenuItem(Gtk.STOCK_SAVE_AS)
|
||||||
id_ = menuitem.connect('activate',
|
id_ = menuitem.connect('activate',
|
||||||
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
||||||
self.contact.jid, self.contact.get_shown_name())
|
self.contact.jid, self.contact.get_shown_name())
|
||||||
|
@ -1999,9 +2003,9 @@ class ChatControl(ChatControlBase):
|
||||||
self.mouse_over_in_last_30_secs = True
|
self.mouse_over_in_last_30_secs = True
|
||||||
|
|
||||||
def _schedule_activity_timers(self):
|
def _schedule_activity_timers(self):
|
||||||
self.possible_paused_timeout_id = gobject.timeout_add_seconds(5,
|
self.possible_paused_timeout_id = GObject.timeout_add_seconds(5,
|
||||||
self.check_for_possible_paused_chatstate, None)
|
self.check_for_possible_paused_chatstate, None)
|
||||||
self.possible_inactive_timeout_id = gobject.timeout_add_seconds(30,
|
self.possible_inactive_timeout_id = GObject.timeout_add_seconds(30,
|
||||||
self.check_for_possible_inactive_chatstate, None)
|
self.check_for_possible_inactive_chatstate, None)
|
||||||
|
|
||||||
def update_ui(self):
|
def update_ui(self):
|
||||||
|
@ -2032,7 +2036,7 @@ class ChatControl(ChatControlBase):
|
||||||
use_size_32 = False
|
use_size_32 = False
|
||||||
|
|
||||||
banner_status_img = self.xml.get_object('banner_status_image')
|
banner_status_img = self.xml.get_object('banner_status_image')
|
||||||
if banner_image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if banner_image.get_storage_type() == Gtk.ImageType.ANIMATION:
|
||||||
banner_status_img.set_from_animation(banner_image.get_animation())
|
banner_status_img.set_from_animation(banner_image.get_animation())
|
||||||
else:
|
else:
|
||||||
pix = banner_image.get_pixbuf()
|
pix = banner_image.get_pixbuf()
|
||||||
|
@ -2041,7 +2045,7 @@ class ChatControl(ChatControlBase):
|
||||||
banner_status_img.set_from_pixbuf(pix)
|
banner_status_img.set_from_pixbuf(pix)
|
||||||
else: # we need to scale 16x16 to 32x32
|
else: # we need to scale 16x16 to 32x32
|
||||||
scaled_pix = pix.scale_simple(32, 32,
|
scaled_pix = pix.scale_simple(32, 32,
|
||||||
gtk.gdk.INTERP_BILINEAR)
|
GdkPixbuf.InterpType.BILINEAR)
|
||||||
banner_status_img.set_from_pixbuf(scaled_pix)
|
banner_status_img.set_from_pixbuf(scaled_pix)
|
||||||
|
|
||||||
def draw_banner_text(self):
|
def draw_banner_text(self):
|
||||||
|
@ -2060,7 +2064,7 @@ class ChatControl(ChatControlBase):
|
||||||
if self.TYPE_ID == message_control.TYPE_PM:
|
if self.TYPE_ID == message_control.TYPE_PM:
|
||||||
name = _('%(nickname)s from group chat %(room_name)s') %\
|
name = _('%(nickname)s from group chat %(room_name)s') %\
|
||||||
{'nickname': name, 'room_name': self.room_name}
|
{'nickname': name, 'room_name': self.room_name}
|
||||||
name = gobject.markup_escape_text(name)
|
name = GObject.markup_escape_text(name)
|
||||||
|
|
||||||
# We know our contacts nick, but if another contact has the same nick
|
# We know our contacts nick, but if another contact has the same nick
|
||||||
# in another account we need to also display the account.
|
# in another account we need to also display the account.
|
||||||
|
@ -2076,17 +2080,17 @@ class ChatControl(ChatControlBase):
|
||||||
gajim.contacts.get_first_contact_from_jid(account, jid)
|
gajim.contacts.get_first_contact_from_jid(account, jid)
|
||||||
if other_contact_.get_shown_name() == self.contact.get_shown_name():
|
if other_contact_.get_shown_name() == self.contact.get_shown_name():
|
||||||
acct_info = ' (%s)' % \
|
acct_info = ' (%s)' % \
|
||||||
gobject.markup_escape_text(self.account)
|
GObject.markup_escape_text(self.account)
|
||||||
break
|
break
|
||||||
|
|
||||||
status = contact.status
|
status = contact.status
|
||||||
if status is not None:
|
if status is not None:
|
||||||
banner_name_label.set_ellipsize(pango.ELLIPSIZE_END)
|
banner_name_label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
self.banner_status_label.set_ellipsize(pango.ELLIPSIZE_END)
|
self.banner_status_label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
status_reduced = helpers.reduce_chars_newlines(status, max_lines=1)
|
status_reduced = helpers.reduce_chars_newlines(status, max_lines=1)
|
||||||
else:
|
else:
|
||||||
status_reduced = ''
|
status_reduced = ''
|
||||||
status_escaped = gobject.markup_escape_text(status_reduced)
|
status_escaped = GObject.markup_escape_text(status_reduced)
|
||||||
|
|
||||||
font_attrs, font_attrs_small = self.get_font_attrs()
|
font_attrs, font_attrs_small = self.get_font_attrs()
|
||||||
st = gajim.config.get('displayed_chat_state_notifications')
|
st = gajim.config.get('displayed_chat_state_notifications')
|
||||||
|
@ -2287,8 +2291,8 @@ class ChatControl(ChatControlBase):
|
||||||
chatstate_to_send = 'active'
|
chatstate_to_send = 'active'
|
||||||
contact.our_chatstate = 'active'
|
contact.our_chatstate = 'active'
|
||||||
|
|
||||||
gobject.source_remove(self.possible_paused_timeout_id)
|
GObject.source_remove(self.possible_paused_timeout_id)
|
||||||
gobject.source_remove(self.possible_inactive_timeout_id)
|
GObject.source_remove(self.possible_inactive_timeout_id)
|
||||||
self._schedule_activity_timers()
|
self._schedule_activity_timers()
|
||||||
|
|
||||||
def _on_sent(id_, contact, message, encrypted, xhtml, label):
|
def _on_sent(id_, contact, message, encrypted, xhtml, label):
|
||||||
|
@ -2523,19 +2527,21 @@ class ChatControl(ChatControlBase):
|
||||||
'state_paused_color')
|
'state_paused_color')
|
||||||
if color:
|
if color:
|
||||||
# We set the color for when it's the current tab or not
|
# We set the color for when it's the current tab or not
|
||||||
color = gtk.gdk.colormap_get_system().alloc_color(color)
|
ok, color = Gdk.Color.parse(color)
|
||||||
|
if not ok:
|
||||||
|
color = self.parent_win.notebook.get_style().fg[Gtk.StateType.ACTIVE]
|
||||||
# In inactive tab color to be lighter against the darker inactive
|
# In inactive tab color to be lighter against the darker inactive
|
||||||
# background
|
# background
|
||||||
if chatstate in ('inactive', 'gone') and\
|
if chatstate in ('inactive', 'gone') and\
|
||||||
self.parent_win.get_active_control() != self:
|
self.parent_win.get_active_control() != self:
|
||||||
color = self.lighten_color(color)
|
color = self.lighten_color(color)
|
||||||
else: # active or not chatstate, get color from gtk
|
else: # active or not chatstate, get color from gtk
|
||||||
color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
|
color = self.parent_win.notebook.get_style().fg[Gtk.StateType.ACTIVE]
|
||||||
|
|
||||||
name = self.contact.get_shown_name()
|
name = self.contact.get_shown_name()
|
||||||
if self.resource:
|
if self.resource:
|
||||||
name += '/' + self.resource
|
name += '/' + self.resource
|
||||||
label_str = gobject.markup_escape_text(name)
|
label_str = GObject.markup_escape_text(name)
|
||||||
if num_unread: # if unread, text in the label becomes bold
|
if num_unread: # if unread, text in the label becomes bold
|
||||||
label_str = '<b>' + unread + label_str + '</b>'
|
label_str = '<b>' + unread + label_str + '</b>'
|
||||||
return (label_str, color)
|
return (label_str, color)
|
||||||
|
@ -2673,8 +2679,8 @@ class ChatControl(ChatControlBase):
|
||||||
self.session.control = None
|
self.session.control = None
|
||||||
|
|
||||||
# Disconnect timer callbacks
|
# Disconnect timer callbacks
|
||||||
gobject.source_remove(self.possible_paused_timeout_id)
|
GObject.source_remove(self.possible_paused_timeout_id)
|
||||||
gobject.source_remove(self.possible_inactive_timeout_id)
|
GObject.source_remove(self.possible_inactive_timeout_id)
|
||||||
# Remove bigger avatar window
|
# Remove bigger avatar window
|
||||||
if self.bigger_avatar_window:
|
if self.bigger_avatar_window:
|
||||||
self.bigger_avatar_window.destroy()
|
self.bigger_avatar_window.destroy()
|
||||||
|
@ -2757,8 +2763,8 @@ class ChatControl(ChatControlBase):
|
||||||
else:
|
else:
|
||||||
self.send_chatstate('active', self.contact)
|
self.send_chatstate('active', self.contact)
|
||||||
self.reset_kbd_mouse_timeout_vars()
|
self.reset_kbd_mouse_timeout_vars()
|
||||||
gobject.source_remove(self.possible_paused_timeout_id)
|
GObject.source_remove(self.possible_paused_timeout_id)
|
||||||
gobject.source_remove(self.possible_inactive_timeout_id)
|
GObject.source_remove(self.possible_inactive_timeout_id)
|
||||||
self._schedule_activity_timers()
|
self._schedule_activity_timers()
|
||||||
else:
|
else:
|
||||||
self.send_chatstate('inactive', self.contact)
|
self.send_chatstate('inactive', self.contact)
|
||||||
|
@ -3017,8 +3023,8 @@ class ChatControl(ChatControlBase):
|
||||||
pixbuf.fill(0xffffff00L) # RGBA
|
pixbuf.fill(0xffffff00L) # RGBA
|
||||||
image.queue_draw()
|
image.queue_draw()
|
||||||
|
|
||||||
screen_w = gtk.gdk.screen_width()
|
screen_w = Gdk.Screen.width()
|
||||||
screen_h = gtk.gdk.screen_height()
|
screen_h = Gdk.Screen.height()
|
||||||
avatar_w = avatar_pixbuf.get_width()
|
avatar_w = avatar_pixbuf.get_width()
|
||||||
avatar_h = avatar_pixbuf.get_height()
|
avatar_h = avatar_pixbuf.get_height()
|
||||||
half_scr_w = screen_w / 2
|
half_scr_w = screen_w / 2
|
||||||
|
@ -3027,16 +3033,16 @@ class ChatControl(ChatControlBase):
|
||||||
avatar_w = half_scr_w
|
avatar_w = half_scr_w
|
||||||
if avatar_h > half_scr_h:
|
if avatar_h > half_scr_h:
|
||||||
avatar_h = half_scr_h
|
avatar_h = half_scr_h
|
||||||
window = gtk.Window(gtk.WINDOW_POPUP)
|
window = Gtk.Window(Gtk.WindowType.POPUP)
|
||||||
self.bigger_avatar_window = window
|
self.bigger_avatar_window = window
|
||||||
pixmap, mask = avatar_pixbuf.render_pixmap_and_mask()
|
pixmap, mask = avatar_pixbuf.render_pixmap_and_mask()
|
||||||
window.set_size_request(avatar_w, avatar_h)
|
window.set_size_request(avatar_w, avatar_h)
|
||||||
# we should make the cursor visible
|
# we should make the cursor visible
|
||||||
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
||||||
# so this line adds that
|
# so this line adds that
|
||||||
window.set_events(gtk.gdk.POINTER_MOTION_MASK)
|
window.set_events(Gdk.EventMask.POINTER_MOTION_MASK)
|
||||||
window.set_app_paintable(True)
|
window.set_app_paintable(True)
|
||||||
window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
|
window.set_type_hint(Gdk.WindowTypeHint.TOOLTIP)
|
||||||
|
|
||||||
window.realize()
|
window.realize()
|
||||||
window.window.set_back_pixmap(pixmap, False) # make it transparent
|
window.window.set_back_pixmap(pixmap, False) # make it transparent
|
||||||
|
@ -3075,7 +3081,7 @@ class ChatControl(ChatControlBase):
|
||||||
"""
|
"""
|
||||||
Just moved the mouse so show the cursor
|
Just moved the mouse so show the cursor
|
||||||
"""
|
"""
|
||||||
cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)
|
cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
|
||||||
self.bigger_avatar_window.window.set_cursor(cursor)
|
self.bigger_avatar_window.window.set_cursor(cursor)
|
||||||
|
|
||||||
def _on_send_file_menuitem_activate(self, widget):
|
def _on_send_file_menuitem_activate(self, widget):
|
||||||
|
@ -3196,7 +3202,7 @@ class ChatControl(ChatControlBase):
|
||||||
self.info_bar.show_all()
|
self.info_bar.show_all()
|
||||||
|
|
||||||
def _add_info_bar_message(self, markup, buttons, args,
|
def _add_info_bar_message(self, markup, buttons, args,
|
||||||
type_=gtk.MESSAGE_INFO):
|
type_=Gtk.MessageType.INFO):
|
||||||
self.info_bar_queue.append((markup, buttons, args, type_))
|
self.info_bar_queue.append((markup, buttons, args, type_))
|
||||||
self._info_bar_show_message()
|
self._info_bar_show_message()
|
||||||
|
|
||||||
|
@ -3229,12 +3235,12 @@ class ChatControl(ChatControlBase):
|
||||||
markup += ' (%s)' % file_props.desc
|
markup += ' (%s)' % file_props.desc
|
||||||
markup += '\n%s: %s' % (_('Size'), helpers.convert_bytes(
|
markup += '\n%s: %s' % (_('Size'), helpers.convert_bytes(
|
||||||
file_props.size))
|
file_props.size))
|
||||||
b1 = gtk.Button(_('_Accept'))
|
b1 = Gtk.Button(_('_Accept'))
|
||||||
b1.connect('clicked', self._on_accept_file_request, file_props)
|
b1.connect('clicked', self._on_accept_file_request, file_props)
|
||||||
b2 = gtk.Button(stock=gtk.STOCK_CANCEL)
|
b2 = Gtk.Button(stock=Gtk.STOCK_CANCEL)
|
||||||
b2.connect('clicked', self._on_cancel_file_request, file_props)
|
b2.connect('clicked', self._on_cancel_file_request, file_props)
|
||||||
self._add_info_bar_message(markup, [b1, b2], file_props,
|
self._add_info_bar_message(markup, [b1, b2], file_props,
|
||||||
gtk.MESSAGE_QUESTION)
|
Gtk.MessageType.QUESTION)
|
||||||
|
|
||||||
def _on_open_ft_folder(self, widget, file_props):
|
def _on_open_ft_folder(self, widget, file_props):
|
||||||
path = os.path.split(file_props.file_name)[0]
|
path = os.path.split(file_props.file_name)[0]
|
||||||
|
@ -3254,17 +3260,17 @@ class ChatControl(ChatControlBase):
|
||||||
file_props.name)
|
file_props.name)
|
||||||
if file_props.desc:
|
if file_props.desc:
|
||||||
markup += ' (%s)' % file_props.desc
|
markup += ' (%s)' % file_props.desc
|
||||||
b1 = gtk.Button(_('_Open Containing Folder'))
|
b1 = Gtk.Button(_('_Open Containing Folder'))
|
||||||
b1.connect('clicked', self._on_open_ft_folder, file_props)
|
b1.connect('clicked', self._on_open_ft_folder, file_props)
|
||||||
b2 = gtk.Button(stock=gtk.STOCK_OK)
|
b2 = Gtk.Button(stock=Gtk.STOCK_OK)
|
||||||
b2.connect('clicked', self._on_ok, file_props, 'file-completed')
|
b2.connect('clicked', self._on_ok, file_props, 'file-completed')
|
||||||
self._add_info_bar_message(markup, [b1, b2], file_props)
|
self._add_info_bar_message(markup, [b1, b2], file_props)
|
||||||
|
|
||||||
def _got_file_error(self, file_props, type_, pri_txt, sec_txt):
|
def _got_file_error(self, file_props, type_, pri_txt, sec_txt):
|
||||||
markup = '<b>%s:</b> %s' % (pri_txt, sec_txt)
|
markup = '<b>%s:</b> %s' % (pri_txt, sec_txt)
|
||||||
b = gtk.Button(stock=gtk.STOCK_OK)
|
b = Gtk.Button(stock=Gtk.STOCK_OK)
|
||||||
b.connect('clicked', self._on_ok, file_props, type_)
|
b.connect('clicked', self._on_ok, file_props, type_)
|
||||||
self._add_info_bar_message(markup, [b], file_props, gtk.MESSAGE_ERROR)
|
self._add_info_bar_message(markup, [b], file_props, Gtk.MessageType.ERROR)
|
||||||
|
|
||||||
def _on_accept_gc_invitation(self, widget, event):
|
def _on_accept_gc_invitation(self, widget, event):
|
||||||
room_jid = event.parameters[0]
|
room_jid = event.parameters[0]
|
||||||
|
@ -3289,12 +3295,12 @@ class ChatControl(ChatControlBase):
|
||||||
markup = '<b>%s:</b> %s' % (_('Groupchat Invitation'), room_jid)
|
markup = '<b>%s:</b> %s' % (_('Groupchat Invitation'), room_jid)
|
||||||
if comment:
|
if comment:
|
||||||
markup += ' (%s)' % comment
|
markup += ' (%s)' % comment
|
||||||
b1 = gtk.Button(_('_Join'))
|
b1 = Gtk.Button(_('_Join'))
|
||||||
b1.connect('clicked', self._on_accept_gc_invitation, event)
|
b1.connect('clicked', self._on_accept_gc_invitation, event)
|
||||||
b2 = gtk.Button(stock=gtk.STOCK_CANCEL)
|
b2 = Gtk.Button(stock=Gtk.STOCK_CANCEL)
|
||||||
b2.connect('clicked', self._on_cancel_gc_invitation, event)
|
b2.connect('clicked', self._on_cancel_gc_invitation, event)
|
||||||
self._add_info_bar_message(markup, [b1, b2], event.parameters,
|
self._add_info_bar_message(markup, [b1, b2], event.parameters,
|
||||||
gtk.MESSAGE_QUESTION)
|
Gtk.MessageType.QUESTION)
|
||||||
|
|
||||||
def on_event_added(self, event):
|
def on_event_added(self, event):
|
||||||
if event.account != self.account:
|
if event.account != self.account:
|
||||||
|
@ -3350,6 +3356,6 @@ class ChatControl(ChatControlBase):
|
||||||
self.info_bar.set_no_show_all(True)
|
self.info_bar.set_no_show_all(True)
|
||||||
self.info_bar.hide()
|
self.info_bar.hide()
|
||||||
# show next one?
|
# show next one?
|
||||||
gobject.idle_add(self._info_bar_show_message)
|
GObject.idle_add(self._info_bar_show_message)
|
||||||
break
|
break
|
||||||
i += 1
|
i += 1
|
||||||
|
|
|
@ -34,7 +34,7 @@ don't need to dig up the code itself to write basic commands.
|
||||||
from types import StringTypes
|
from types import StringTypes
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
|
|
||||||
from pango import FontDescription
|
from gi.repository import Pango
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
|
||||||
from ..framework import CommandProcessor
|
from ..framework import CommandProcessor
|
||||||
|
@ -117,7 +117,7 @@ class CommandTools:
|
||||||
|
|
||||||
name = gconf("/desktop/gnome/interface/monospace_font_name")
|
name = gconf("/desktop/gnome/interface/monospace_font_name")
|
||||||
name = name if name else "Monospace"
|
name = name if name else "Monospace"
|
||||||
font = FontDescription(name)
|
font = Pango.FontDescription(name)
|
||||||
|
|
||||||
command_ok_tag = buffer.create_tag("command_ok")
|
command_ok_tag = buffer.create_tag("command_ok")
|
||||||
command_ok_tag.set_property("font-desc", font)
|
command_ok_tag.set_property("font-desc", font)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
from types import *
|
from types import *
|
||||||
from glib import GError
|
#from glib import GError
|
||||||
|
|
||||||
def remove(sequence, target):
|
def remove(sequence, target):
|
||||||
if isinstance(sequence, ListType):
|
if isinstance(sequence, ListType):
|
||||||
|
@ -36,9 +36,9 @@ def remove(sequence, target):
|
||||||
del sequence[target]
|
del sequence[target]
|
||||||
|
|
||||||
def gconf(path):
|
def gconf(path):
|
||||||
try:
|
# try:
|
||||||
from gconf import client_get_default
|
# from gconf import client_get_default
|
||||||
client = client_get_default()
|
# client = client_get_default()
|
||||||
return client.get_string(path)
|
# return client.get_string(path)
|
||||||
except ImportError, GError:
|
# except ImportError, GError:
|
||||||
pass
|
pass
|
|
@ -36,7 +36,7 @@ import sys
|
||||||
import re
|
import re
|
||||||
import copy
|
import copy
|
||||||
import defs
|
import defs
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
|
|
||||||
(
|
(
|
||||||
OPT_TYPE,
|
OPT_TYPE,
|
||||||
|
@ -807,7 +807,7 @@ class Config:
|
||||||
def _timeout_save(self):
|
def _timeout_save(self):
|
||||||
if self.save_timeout_id:
|
if self.save_timeout_id:
|
||||||
return
|
return
|
||||||
self.save_timeout_id = gobject.timeout_add(1000, self._really_save)
|
self.save_timeout_id = GObject.timeout_add(1000, self._really_save)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
#init default values
|
#init default values
|
||||||
|
|
|
@ -174,6 +174,7 @@ else:
|
||||||
|
|
||||||
HAVE_FARSTREAM = True
|
HAVE_FARSTREAM = True
|
||||||
try:
|
try:
|
||||||
|
raise ImportError
|
||||||
farstream = __import__('farstream')
|
farstream = __import__('farstream')
|
||||||
import gst
|
import gst
|
||||||
import glib
|
import glib
|
||||||
|
@ -190,6 +191,7 @@ except ImportError:
|
||||||
|
|
||||||
HAVE_UPNP_IGD = True
|
HAVE_UPNP_IGD = True
|
||||||
try:
|
try:
|
||||||
|
raise ImportError
|
||||||
import gupnp.igd
|
import gupnp.igd
|
||||||
gupnp_igd = gupnp.igd.Simple()
|
gupnp_igd = gupnp.igd.Simple()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -17,7 +17,7 @@ Handles Jingle RTP sessions (XEP 0167)
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
|
@ -129,13 +129,13 @@ class JingleRTPContent(JingleContent):
|
||||||
events = deque(events)
|
events = deque(events)
|
||||||
self._dtmf_running = True
|
self._dtmf_running = True
|
||||||
self._start_dtmf(events.popleft())
|
self._start_dtmf(events.popleft())
|
||||||
gobject.timeout_add(500, self._next_dtmf, events)
|
GObject.timeout_add(500, self._next_dtmf, events)
|
||||||
|
|
||||||
def _next_dtmf(self, events):
|
def _next_dtmf(self, events):
|
||||||
self._stop_dtmf()
|
self._stop_dtmf()
|
||||||
if events:
|
if events:
|
||||||
self._start_dtmf(events.popleft())
|
self._start_dtmf(events.popleft())
|
||||||
gobject.timeout_add(500, self._next_dtmf, events)
|
GObject.timeout_add(500, self._next_dtmf, events)
|
||||||
else:
|
else:
|
||||||
self._dtmf_running = False
|
self._dtmf_running = False
|
||||||
|
|
||||||
|
|
|
@ -329,6 +329,7 @@ class JingleTransportIBB(JingleTransport):
|
||||||
return transport
|
return transport
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
raise ImportError
|
||||||
import farstream
|
import farstream
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -34,7 +34,7 @@ import time
|
||||||
import datetime
|
import datetime
|
||||||
from gzip import GzipFile
|
from gzip import GzipFile
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
|
|
||||||
import exceptions
|
import exceptions
|
||||||
import gajim
|
import gajim
|
||||||
|
@ -176,7 +176,7 @@ class Logger:
|
||||||
def _timeout_commit(self):
|
def _timeout_commit(self):
|
||||||
if self.commit_timout_id:
|
if self.commit_timout_id:
|
||||||
return
|
return
|
||||||
self.commit_timout_id = gobject.timeout_add(500, self._really_commit)
|
self.commit_timout_id = GObject.timeout_add(500, self._really_commit)
|
||||||
|
|
||||||
def simple_commit(self, sql_to_commit):
|
def simple_commit(self, sql_to_commit):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -214,8 +214,9 @@ LOCATION_DATA = {
|
||||||
'timestamp': _('timestamp'),
|
'timestamp': _('timestamp'),
|
||||||
'uri': _('uri')}
|
'uri': _('uri')}
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GdkPixbuf
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger('gajim.c.pep')
|
log = logging.getLogger('gajim.c.pep')
|
||||||
|
@ -310,10 +311,10 @@ class UserMoodPEP(AbstractPEP):
|
||||||
assert not self._retracted
|
assert not self._retracted
|
||||||
untranslated_mood = self._pep_specific_data['mood']
|
untranslated_mood = self._pep_specific_data['mood']
|
||||||
mood = self._translate_mood(untranslated_mood)
|
mood = self._translate_mood(untranslated_mood)
|
||||||
markuptext = '<b>%s</b>' % gobject.markup_escape_text(mood)
|
markuptext = '<b>%s</b>' % GObject.markup_escape_text(mood)
|
||||||
if 'text' in self._pep_specific_data:
|
if 'text' in self._pep_specific_data:
|
||||||
text = self._pep_specific_data['text']
|
text = self._pep_specific_data['text']
|
||||||
markuptext += ' (%s)' % gobject.markup_escape_text(text)
|
markuptext += ' (%s)' % GObject.markup_escape_text(text)
|
||||||
return markuptext
|
return markuptext
|
||||||
|
|
||||||
def _translate_mood(self, mood):
|
def _translate_mood(self, mood):
|
||||||
|
@ -348,20 +349,20 @@ class UserTunePEP(AbstractPEP):
|
||||||
def asPixbufIcon(self):
|
def asPixbufIcon(self):
|
||||||
import os
|
import os
|
||||||
path = os.path.join(gajim.DATA_DIR, 'emoticons', 'static', 'music.png')
|
path = os.path.join(gajim.DATA_DIR, 'emoticons', 'static', 'music.png')
|
||||||
return gtk.gdk.pixbuf_new_from_file(path)
|
return GdkPixbuf.Pixbuf.new_from_file(path)
|
||||||
|
|
||||||
def asMarkupText(self):
|
def asMarkupText(self):
|
||||||
assert not self._retracted
|
assert not self._retracted
|
||||||
tune = self._pep_specific_data
|
tune = self._pep_specific_data
|
||||||
|
|
||||||
artist = tune.get('artist', _('Unknown Artist'))
|
artist = tune.get('artist', _('Unknown Artist'))
|
||||||
artist = gobject.markup_escape_text(artist)
|
artist = GObject.markup_escape_text(artist)
|
||||||
|
|
||||||
title = tune.get('title', _('Unknown Title'))
|
title = tune.get('title', _('Unknown Title'))
|
||||||
title = gobject.markup_escape_text(title)
|
title = GObject.markup_escape_text(title)
|
||||||
|
|
||||||
source = tune.get('source', _('Unknown Source'))
|
source = tune.get('source', _('Unknown Source'))
|
||||||
source = gobject.markup_escape_text(source)
|
source = GObject.markup_escape_text(source)
|
||||||
|
|
||||||
tune_string = _('<b>"%(title)s"</b> by <i>%(artist)s</i>\n'
|
tune_string = _('<b>"%(title)s"</b> by <i>%(artist)s</i>\n'
|
||||||
'from <i>%(source)s</i>') % {'title': title,
|
'from <i>%(source)s</i>') % {'title': title,
|
||||||
|
@ -426,12 +427,12 @@ class UserActivityPEP(AbstractPEP):
|
||||||
subactivity = ACTIVITIES[activity][subactivity]
|
subactivity = ACTIVITIES[activity][subactivity]
|
||||||
activity = ACTIVITIES[activity]['category']
|
activity = ACTIVITIES[activity]['category']
|
||||||
|
|
||||||
markuptext = '<b>' + gobject.markup_escape_text(activity)
|
markuptext = '<b>' + GObject.markup_escape_text(activity)
|
||||||
if subactivity:
|
if subactivity:
|
||||||
markuptext += ': ' + gobject.markup_escape_text(subactivity)
|
markuptext += ': ' + GObject.markup_escape_text(subactivity)
|
||||||
markuptext += '</b>'
|
markuptext += '</b>'
|
||||||
if text:
|
if text:
|
||||||
markuptext += ' (%s)' % gobject.markup_escape_text(text)
|
markuptext += ' (%s)' % GObject.markup_escape_text(text)
|
||||||
return markuptext
|
return markuptext
|
||||||
|
|
||||||
|
|
||||||
|
@ -492,7 +493,7 @@ class UserLocationPEP(AbstractPEP):
|
||||||
|
|
||||||
def asPixbufIcon(self):
|
def asPixbufIcon(self):
|
||||||
path = gtkgui_helpers.get_icon_path('gajim-earth')
|
path = gtkgui_helpers.get_icon_path('gajim-earth')
|
||||||
return gtk.gdk.pixbuf_new_from_file(path)
|
return GdkPixbuf.Pixbuf.new_from_file(path)
|
||||||
|
|
||||||
def asMarkupText(self):
|
def asMarkupText(self):
|
||||||
assert not self._retracted
|
assert not self._retracted
|
||||||
|
@ -501,7 +502,7 @@ class UserLocationPEP(AbstractPEP):
|
||||||
|
|
||||||
for entry in location.keys():
|
for entry in location.keys():
|
||||||
text = location[entry]
|
text = location[entry]
|
||||||
text = gobject.markup_escape_text(text)
|
text = GObject.markup_escape_text(text)
|
||||||
# Translate standart location tag
|
# Translate standart location tag
|
||||||
tag = LOCATION_DATA.get(entry, entry)
|
tag = LOCATION_DATA.get(entry, entry)
|
||||||
location_string += '\n<b>%(tag)s</b>: %(text)s' % \
|
location_string += '\n<b>%(tag)s</b>: %(text)s' % \
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
import base64
|
import base64
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
|
@ -442,7 +442,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
||||||
|
|
||||||
def cleanup_gupnp():
|
def cleanup_gupnp():
|
||||||
if self.no_gupnp_reply_id:
|
if self.no_gupnp_reply_id:
|
||||||
gobject.source_remove(self.no_gupnp_reply_id)
|
GObject.source_remove(self.no_gupnp_reply_id)
|
||||||
self.no_gupnp_reply_id = 0
|
self.no_gupnp_reply_id = 0
|
||||||
gajim.gupnp_igd.disconnect(self.ok_id)
|
gajim.gupnp_igd.disconnect(self.ok_id)
|
||||||
gajim.gupnp_igd.disconnect(self.fail_id)
|
gajim.gupnp_igd.disconnect(self.fail_id)
|
||||||
|
@ -482,7 +482,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
||||||
self.fail_id = gajim.gupnp_igd.connect('error-mapping-port', fail)
|
self.fail_id = gajim.gupnp_igd.connect('error-mapping-port', fail)
|
||||||
|
|
||||||
port = gajim.config.get('file_transfers_port')
|
port = gajim.config.get('file_transfers_port')
|
||||||
self.no_gupnp_reply_id = gobject.timeout_add_seconds(10, no_upnp_reply)
|
self.no_gupnp_reply_id = GObject.timeout_add_seconds(10, no_upnp_reply)
|
||||||
gajim.gupnp_igd.add_port('TCP', 0, my_ip, port, 3600,
|
gajim.gupnp_igd.add_port('TCP', 0, my_ip, port, 3600,
|
||||||
'Gajim file transfer')
|
'Gajim file transfer')
|
||||||
|
|
||||||
|
|
|
@ -318,8 +318,8 @@ class NsLookup(IdleCommand):
|
||||||
|
|
||||||
# below lines is on how to use API and assist in testing
|
# below lines is on how to use API and assist in testing
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
from nbxmpp import idlequeue
|
from nbxmpp import idlequeue
|
||||||
|
|
||||||
idlequeue = idlequeue.get_idlequeue()
|
idlequeue = idlequeue.get_idlequeue()
|
||||||
|
@ -331,19 +331,19 @@ if __name__ == '__main__':
|
||||||
def on_result(host, result_array):
|
def on_result(host, result_array):
|
||||||
print 'Result:\n' + repr(result_array)
|
print 'Result:\n' + repr(result_array)
|
||||||
resolver.resolve(host, on_result)
|
resolver.resolve(host, on_result)
|
||||||
win = gtk.Window()
|
win = Gtk.Window()
|
||||||
win.set_border_width(6)
|
win.set_border_width(6)
|
||||||
text_view = gtk.Entry()
|
text_view = Gtk.Entry()
|
||||||
text_view.set_text('_xmpp-client._tcp.jabber.org')
|
text_view.set_text('_xmpp-client._tcp.jabber.org')
|
||||||
hbox = gtk.HBox()
|
hbox = Gtk.HBox()
|
||||||
hbox.set_spacing(3)
|
hbox.set_spacing(3)
|
||||||
but = gtk.Button(' Lookup SRV ')
|
but = Gtk.Button(' Lookup SRV ')
|
||||||
hbox.pack_start(text_view, 5)
|
hbox.pack_start(text_view, 5, True, 0)
|
||||||
hbox.pack_start(but, 0)
|
hbox.pack_start(but, 0, True, 0)
|
||||||
but.connect('clicked', clicked)
|
but.connect('clicked', clicked)
|
||||||
win.add(hbox)
|
win.add(hbox)
|
||||||
win.show_all()
|
win.show_all()
|
||||||
gobject.timeout_add(200, idlequeue.process)
|
GObject.timeout_add(200, idlequeue.process)
|
||||||
if USE_LIBASYNCNS:
|
if USE_LIBASYNCNS:
|
||||||
gobject.timeout_add(200, resolver.process)
|
GObject.timeout_add(200, resolver.process)
|
||||||
gtk.main()
|
Gtk.main()
|
||||||
|
|
|
@ -39,7 +39,7 @@ import signal
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||||
import getpass
|
import getpass
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
|
|
||||||
from common.connection import CommonConnection
|
from common.connection import CommonConnection
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
@ -240,7 +240,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
|
||||||
|
|
||||||
# refresh all contacts data every five seconds
|
# refresh all contacts data every five seconds
|
||||||
self.call_resolve_timeout = True
|
self.call_resolve_timeout = True
|
||||||
gobject.timeout_add_seconds(5, self._on_resolve_timeout)
|
GObject.timeout_add_seconds(5, self._on_resolve_timeout)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def disconnect(self, on_purpose=False):
|
def disconnect(self, on_purpose=False):
|
||||||
|
|
304
src/config.py
304
src/config.py
|
@ -31,9 +31,10 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import Gdk
|
||||||
import gobject
|
from gi.repository import Pango
|
||||||
|
from gi.repository import GObject
|
||||||
import os, sys
|
import os, sys
|
||||||
import common.config
|
import common.config
|
||||||
import common.sleepy
|
import common.sleepy
|
||||||
|
@ -63,6 +64,7 @@ from common import gpg
|
||||||
from common import ged
|
from common import ged
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
raise ImportError
|
||||||
from common.multimedia_helpers import AudioInputManager, AudioOutputManager
|
from common.multimedia_helpers import AudioInputManager, AudioOutputManager
|
||||||
from common.multimedia_helpers import VideoInputManager, VideoOutputManager
|
from common.multimedia_helpers import VideoInputManager, VideoOutputManager
|
||||||
HAS_GST = True
|
HAS_GST = True
|
||||||
|
@ -158,10 +160,10 @@ class PreferencesWindow:
|
||||||
# user themes
|
# user themes
|
||||||
if os.path.isdir(gajim.MY_EMOTS_PATH):
|
if os.path.isdir(gajim.MY_EMOTS_PATH):
|
||||||
emoticons_list += os.listdir(gajim.MY_EMOTS_PATH)
|
emoticons_list += os.listdir(gajim.MY_EMOTS_PATH)
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
emoticons_combobox.pack_start(renderer_text, True)
|
emoticons_combobox.pack_start(renderer_text, True)
|
||||||
emoticons_combobox.add_attribute(renderer_text, 'text', 0)
|
emoticons_combobox.add_attribute(renderer_text, 'text', 0)
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
emoticons_combobox.set_model(model)
|
emoticons_combobox.set_model(model)
|
||||||
l = []
|
l = []
|
||||||
for dir_ in emoticons_list:
|
for dir_ in emoticons_list:
|
||||||
|
@ -213,7 +215,7 @@ class PreferencesWindow:
|
||||||
### Style tab ###
|
### Style tab ###
|
||||||
# Themes
|
# Themes
|
||||||
theme_combobox = self.xml.get_object('theme_combobox')
|
theme_combobox = self.xml.get_object('theme_combobox')
|
||||||
cell = gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
theme_combobox.pack_start(cell, True)
|
theme_combobox.pack_start(cell, True)
|
||||||
theme_combobox.add_attribute(cell, 'text', 0)
|
theme_combobox.add_attribute(cell, 'text', 0)
|
||||||
self.update_theme_list()
|
self.update_theme_list()
|
||||||
|
@ -223,13 +225,13 @@ class PreferencesWindow:
|
||||||
if os.path.isdir(gajim.MY_ICONSETS_PATH):
|
if os.path.isdir(gajim.MY_ICONSETS_PATH):
|
||||||
iconsets_list += os.listdir(gajim.MY_ICONSETS_PATH)
|
iconsets_list += os.listdir(gajim.MY_ICONSETS_PATH)
|
||||||
# new model, image in 0, string in 1
|
# new model, image in 0, string in 1
|
||||||
model = gtk.ListStore(gtk.Image, str)
|
model = Gtk.ListStore(Gtk.Image, str)
|
||||||
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
|
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
renderer_text.set_property('xpad', 5)
|
renderer_text.set_property('xpad', 5)
|
||||||
self.iconset_combobox.pack_start(renderer_image, expand = False)
|
self.iconset_combobox.pack_start(renderer_image, False)
|
||||||
self.iconset_combobox.pack_start(renderer_text, expand = True)
|
self.iconset_combobox.pack_start(renderer_text, True)
|
||||||
self.iconset_combobox.set_attributes(renderer_text, text = 1)
|
self.iconset_combobox.add_attribute(renderer_text, 'text', 1)
|
||||||
self.iconset_combobox.add_attribute(renderer_image, 'image', 0)
|
self.iconset_combobox.add_attribute(renderer_image, 'image', 0)
|
||||||
self.iconset_combobox.set_model(model)
|
self.iconset_combobox.set_model(model)
|
||||||
l = []
|
l = []
|
||||||
|
@ -242,7 +244,7 @@ class PreferencesWindow:
|
||||||
if l.count == 0:
|
if l.count == 0:
|
||||||
l.append(' ')
|
l.append(' ')
|
||||||
for i in xrange(len(l)):
|
for i in xrange(len(l)):
|
||||||
preview = gtk.Image()
|
preview = Gtk.Image()
|
||||||
files = []
|
files = []
|
||||||
files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16',
|
files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16',
|
||||||
'online.png'))
|
'online.png'))
|
||||||
|
@ -395,45 +397,45 @@ class PreferencesWindow:
|
||||||
|
|
||||||
# Default Status messages
|
# Default Status messages
|
||||||
self.default_msg_tree = self.xml.get_object('default_msg_treeview')
|
self.default_msg_tree = self.xml.get_object('default_msg_treeview')
|
||||||
col2 = self.default_msg_tree.rc_get_style().bg[gtk.STATE_ACTIVE].\
|
col2 = self.default_msg_tree.get_style().bg[Gtk.StateType.ACTIVE].\
|
||||||
to_string()
|
to_string()
|
||||||
# (status, translated_status, message, enabled)
|
# (status, translated_status, message, enabled)
|
||||||
model = gtk.ListStore(str, str, str, bool)
|
model = Gtk.ListStore(str, str, str, bool)
|
||||||
self.default_msg_tree.set_model(model)
|
self.default_msg_tree.set_model(model)
|
||||||
col = gtk.TreeViewColumn(_('Status'))
|
col = Gtk.TreeViewColumn(_('Status'))
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.default_msg_tree.append_column(col)
|
self.default_msg_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, False)
|
col.pack_start(renderer, False)
|
||||||
col.set_attributes(renderer, text = 1)
|
col.add_attribute(renderer, 'text', 1)
|
||||||
col = gtk.TreeViewColumn(_('Default Message'))
|
col = Gtk.TreeViewColumn(_('Default Message'))
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.default_msg_tree.append_column(col)
|
self.default_msg_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, True)
|
col.pack_start(renderer, True)
|
||||||
col.set_attributes(renderer, text = 2)
|
col.add_attribute(renderer, 'text', 2)
|
||||||
renderer.connect('edited', self.on_default_msg_cell_edited)
|
renderer.connect('edited', self.on_default_msg_cell_edited)
|
||||||
renderer.set_property('editable', True)
|
renderer.set_property('editable', True)
|
||||||
renderer.set_property('cell-background', col2)
|
renderer.set_property('cell-background', col2)
|
||||||
col = gtk.TreeViewColumn(_('Enabled'))
|
col = Gtk.TreeViewColumn(_('Enabled'))
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.default_msg_tree.append_column(col)
|
self.default_msg_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererToggle()
|
renderer = Gtk.CellRendererToggle()
|
||||||
col.pack_start(renderer, False)
|
col.pack_start(renderer, False)
|
||||||
col.set_attributes(renderer, active = 3)
|
col.add_attribute(renderer, 'active', 3)
|
||||||
renderer.set_property('activatable', True)
|
renderer.set_property('activatable', True)
|
||||||
renderer.connect('toggled', self.default_msg_toggled_cb)
|
renderer.connect('toggled', self.default_msg_toggled_cb)
|
||||||
self.fill_default_msg_treeview()
|
self.fill_default_msg_treeview()
|
||||||
|
|
||||||
# Status messages
|
# Status messages
|
||||||
self.msg_tree = self.xml.get_object('msg_treeview')
|
self.msg_tree = self.xml.get_object('msg_treeview')
|
||||||
model = gtk.ListStore(str, str, str, str, str, str, str)
|
model = Gtk.ListStore(str, str, str, str, str, str, str)
|
||||||
self.msg_tree.set_model(model)
|
self.msg_tree.set_model(model)
|
||||||
col = gtk.TreeViewColumn('name')
|
col = Gtk.TreeViewColumn('name')
|
||||||
self.msg_tree.append_column(col)
|
self.msg_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, True)
|
col.pack_start(renderer, True)
|
||||||
col.set_attributes(renderer, text = 0)
|
col.add_attribute(renderer, 'text', 0)
|
||||||
renderer.connect('edited', self.on_msg_cell_edited)
|
renderer.connect('edited', self.on_msg_cell_edited)
|
||||||
renderer.set_property('editable', True)
|
renderer.set_property('editable', True)
|
||||||
self.fill_msg_treeview()
|
self.fill_msg_treeview()
|
||||||
|
@ -444,12 +446,12 @@ class PreferencesWindow:
|
||||||
def create_av_combobox(opt_name, device_dict, config_name=None,
|
def create_av_combobox(opt_name, device_dict, config_name=None,
|
||||||
key=None):
|
key=None):
|
||||||
combobox = self.xml.get_object(opt_name + '_combobox')
|
combobox = self.xml.get_object(opt_name + '_combobox')
|
||||||
cell = gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
cell.set_property('ellipsize', pango.ELLIPSIZE_END)
|
cell.set_property('ellipsize', Pango.EllipsizeMode.END)
|
||||||
cell.set_property('ellipsize-set', True)
|
cell.set_property('ellipsize-set', True)
|
||||||
combobox.pack_start(cell, True)
|
combobox.pack_start(cell, True)
|
||||||
combobox.add_attribute(cell, 'text', 0)
|
combobox.add_attribute(cell, 'text', 0)
|
||||||
model = gtk.ListStore(str, str)
|
model = Gtk.ListStore(str, str)
|
||||||
combobox.set_model(model)
|
combobox.set_model(model)
|
||||||
if config_name:
|
if config_name:
|
||||||
config = gajim.config.get(config_name)
|
config = gajim.config.get(config_name)
|
||||||
|
@ -589,10 +591,10 @@ class PreferencesWindow:
|
||||||
gtkgui_helpers.possibly_move_window_in_current_desktop(self.window)
|
gtkgui_helpers.possibly_move_window_in_current_desktop(self.window)
|
||||||
|
|
||||||
def on_preferences_notebook_switch_page(self, widget, page, page_num):
|
def on_preferences_notebook_switch_page(self, widget, page, page_num):
|
||||||
gobject.idle_add(self.xml.get_object('close_button').grab_focus)
|
GObject.idle_add(self.xml.get_object('close_button').grab_focus)
|
||||||
|
|
||||||
def on_preferences_window_key_press_event(self, widget, event):
|
def on_preferences_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
||||||
def get_per_account_option(self, opt):
|
def get_per_account_option(self, opt):
|
||||||
|
@ -751,7 +753,7 @@ class PreferencesWindow:
|
||||||
lang = gajim.config.get('speller_language')
|
lang = gajim.config.get('speller_language')
|
||||||
if not lang:
|
if not lang:
|
||||||
lang = gajim.LANG
|
lang = gajim.LANG
|
||||||
tv = gtk.TextView()
|
tv = Gtk.TextView()
|
||||||
try:
|
try:
|
||||||
gtkspell.Spell(tv, lang)
|
gtkspell.Spell(tv, lang)
|
||||||
except (TypeError, RuntimeError, OSError):
|
except (TypeError, RuntimeError, OSError):
|
||||||
|
@ -781,7 +783,7 @@ class PreferencesWindow:
|
||||||
|
|
||||||
def update_theme_list(self):
|
def update_theme_list(self):
|
||||||
theme_combobox = self.xml.get_object('theme_combobox')
|
theme_combobox = self.xml.get_object('theme_combobox')
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
theme_combobox.set_model(model)
|
theme_combobox.set_model(model)
|
||||||
i = 0
|
i = 0
|
||||||
for config_theme in gajim.config.get_per('themes'):
|
for config_theme in gajim.config.get_per('themes'):
|
||||||
|
@ -958,21 +960,21 @@ class PreferencesWindow:
|
||||||
if col:
|
if col:
|
||||||
if isinstance(col_to_widget[c], list):
|
if isinstance(col_to_widget[c], list):
|
||||||
self.xml.get_object(col_to_widget[c][0]).set_color(
|
self.xml.get_object(col_to_widget[c][0]).set_color(
|
||||||
gtk.gdk.color_parse(col))
|
Gdk.color_parse(col))
|
||||||
self.xml.get_object(col_to_widget[c][0]).set_sensitive(True)
|
self.xml.get_object(col_to_widget[c][0]).set_sensitive(True)
|
||||||
self.xml.get_object(col_to_widget[c][1]).set_active(True)
|
self.xml.get_object(col_to_widget[c][1]).set_active(True)
|
||||||
else:
|
else:
|
||||||
self.xml.get_object(col_to_widget[c]).set_color(
|
self.xml.get_object(col_to_widget[c]).set_color(
|
||||||
gtk.gdk.color_parse(col))
|
Gdk.color_parse(col))
|
||||||
else:
|
else:
|
||||||
if isinstance(col_to_widget[c], list):
|
if isinstance(col_to_widget[c], list):
|
||||||
self.xml.get_object(col_to_widget[c][0]).set_color(
|
self.xml.get_object(col_to_widget[c][0]).set_color(
|
||||||
gtk.gdk.color_parse('#000000'))
|
Gdk.color_parse('#000000'))
|
||||||
self.xml.get_object(col_to_widget[c][0]).set_sensitive(False)
|
self.xml.get_object(col_to_widget[c][0]).set_sensitive(False)
|
||||||
self.xml.get_object(col_to_widget[c][1]).set_active(False)
|
self.xml.get_object(col_to_widget[c][1]).set_active(False)
|
||||||
else:
|
else:
|
||||||
self.xml.get_object(col_to_widget[c]).set_color(
|
self.xml.get_object(col_to_widget[c]).set_color(
|
||||||
gtk.gdk.color_parse('#000000'))
|
Gdk.color_parse('#000000'))
|
||||||
|
|
||||||
def on_reset_colors_button_clicked(self, widget):
|
def on_reset_colors_button_clicked(self, widget):
|
||||||
col_to_widget = {'inmsgcolor': 'incoming_nick_colorbutton',
|
col_to_widget = {'inmsgcolor': 'incoming_nick_colorbutton',
|
||||||
|
@ -1078,7 +1080,7 @@ class PreferencesWindow:
|
||||||
eventbox = self.xml.get_object('default_status_eventbox')
|
eventbox = self.xml.get_object('default_status_eventbox')
|
||||||
vbox = self.xml.get_object('status_vbox')
|
vbox = self.xml.get_object('status_vbox')
|
||||||
vbox.set_child_packing(eventbox, not expander.get_expanded(), True, 0,
|
vbox.set_child_packing(eventbox, not expander.get_expanded(), True, 0,
|
||||||
gtk.PACK_START)
|
Gtk.PACK_START)
|
||||||
|
|
||||||
def save_status_messages(self, model):
|
def save_status_messages(self, model):
|
||||||
for msg in gajim.config.get_per('statusmsg'):
|
for msg in gajim.config.get_per('statusmsg'):
|
||||||
|
@ -1242,10 +1244,10 @@ class PreferencesWindow:
|
||||||
return
|
return
|
||||||
buf = self.xml.get_object('msg_textview').get_buffer()
|
buf = self.xml.get_object('msg_textview').get_buffer()
|
||||||
first_iter, end_iter = buf.get_bounds()
|
first_iter, end_iter = buf.get_bounds()
|
||||||
model.set_value(iter_, 1, buf.get_text(first_iter, end_iter))
|
model.set_value(iter_, 1, buf.get_text(first_iter, end_iter, True))
|
||||||
|
|
||||||
def on_msg_treeview_key_press_event(self, widget, event):
|
def on_msg_treeview_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Delete:
|
if event.keyval == Gdk.KEY_Delete:
|
||||||
self.on_delete_msg_button_clicked(widget)
|
self.on_delete_msg_button_clicked(widget)
|
||||||
|
|
||||||
def on_proxies_combobox_changed(self, widget):
|
def on_proxies_combobox_changed(self, widget):
|
||||||
|
@ -1288,7 +1290,7 @@ class ManageProxiesWindow:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('manage_proxies_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('manage_proxies_window.ui')
|
||||||
self.window = self.xml.get_object('manage_proxies_window')
|
self.window = self.xml.get_object('manage_proxies_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
self.proxies_treeview = self.xml.get_object('proxies_treeview')
|
self.proxies_treeview = self.xml.get_object('proxies_treeview')
|
||||||
self.proxyname_entry = self.xml.get_object('proxyname_entry')
|
self.proxyname_entry = self.xml.get_object('proxyname_entry')
|
||||||
self.proxytype_combobox = self.xml.get_object('proxytype_combobox')
|
self.proxytype_combobox = self.xml.get_object('proxytype_combobox')
|
||||||
|
@ -1327,12 +1329,12 @@ class ManageProxiesWindow:
|
||||||
self.xml.get_object('remove_proxy_button').set_sensitive(False)
|
self.xml.get_object('remove_proxy_button').set_sensitive(False)
|
||||||
self.proxytype_combobox.set_sensitive(False)
|
self.proxytype_combobox.set_sensitive(False)
|
||||||
self.xml.get_object('proxy_table').set_sensitive(False)
|
self.xml.get_object('proxy_table').set_sensitive(False)
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
self.proxies_treeview.set_model(model)
|
self.proxies_treeview.set_model(model)
|
||||||
col = gtk.TreeViewColumn('Proxies')
|
col = Gtk.TreeViewColumn('Proxies')
|
||||||
self.proxies_treeview.append_column(col)
|
self.proxies_treeview.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, True)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 0)
|
col.set_attributes(renderer, text = 0)
|
||||||
self.fill_proxies_treeview()
|
self.fill_proxies_treeview()
|
||||||
self.xml.get_object('proxytype_combobox').set_active(0)
|
self.xml.get_object('proxytype_combobox').set_active(0)
|
||||||
|
@ -1455,7 +1457,7 @@ class ManageProxiesWindow:
|
||||||
self.block_signal = False
|
self.block_signal = False
|
||||||
|
|
||||||
def on_proxies_treeview_key_press_event(self, widget, event):
|
def on_proxies_treeview_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Delete:
|
if event.keyval == Gdk.KEY_Delete:
|
||||||
self.on_remove_proxy_button_clicked(widget)
|
self.on_remove_proxy_button_clicked(widget)
|
||||||
|
|
||||||
def on_proxyname_entry_changed(self, widget):
|
def on_proxyname_entry_changed(self, widget):
|
||||||
|
@ -1547,12 +1549,15 @@ class AccountsWindow:
|
||||||
img.set_from_file(path_to_kbd_input_img)
|
img.set_from_file(path_to_kbd_input_img)
|
||||||
self.notebook = self.xml.get_object('notebook')
|
self.notebook = self.xml.get_object('notebook')
|
||||||
# Name
|
# Name
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
self.accounts_treeview.set_model(model)
|
self.accounts_treeview.set_model(model)
|
||||||
# column
|
# column
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
self.accounts_treeview.insert_column_with_attributes(-1, _('Name'),
|
col = Gtk.TreeViewColumn()
|
||||||
renderer, text=0)
|
col.set_title(_('Name'))
|
||||||
|
col.pack_start(renderer, False)
|
||||||
|
col.add_attribute(renderer, 'text', 0)
|
||||||
|
self.accounts_treeview.insert_column(col, -1)
|
||||||
|
|
||||||
self.current_account = None
|
self.current_account = None
|
||||||
# When we fill info, we don't want to handle the changed signals
|
# When we fill info, we don't want to handle the changed signals
|
||||||
|
@ -1582,13 +1587,13 @@ class AccountsWindow:
|
||||||
self.xml.get_object('close_button').grab_focus()
|
self.xml.get_object('close_button').grab_focus()
|
||||||
|
|
||||||
def on_accounts_window_key_press_event(self, widget, event):
|
def on_accounts_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.check_resend_relog()
|
self.check_resend_relog()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def select_account(self, account):
|
def select_account(self, account):
|
||||||
model = self.accounts_treeview.get_model()
|
model = self.accounts_treeview.get_model()
|
||||||
iter_ = model.get_iter_root()
|
iter_ = model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
acct = model[iter_][0].decode('utf-8')
|
acct = model[iter_][0].decode('utf-8')
|
||||||
if account == acct:
|
if account == acct:
|
||||||
|
@ -1610,7 +1615,7 @@ class AccountsWindow:
|
||||||
model.set(iter_, 0, account)
|
model.set(iter_, 0, account)
|
||||||
|
|
||||||
self.selection = self.accounts_treeview.get_selection()
|
self.selection = self.accounts_treeview.get_selection()
|
||||||
self.selection.select_iter(model.get_iter_root())
|
self.selection.select_iter(model.get_iter_first())
|
||||||
|
|
||||||
def resend(self, account):
|
def resend(self, account):
|
||||||
if not account in gajim.connections:
|
if not account in gajim.connections:
|
||||||
|
@ -1643,7 +1648,7 @@ class AccountsWindow:
|
||||||
status_before = gajim.connections[account].status
|
status_before = gajim.connections[account].status
|
||||||
gajim.interface.roster.send_status(account, 'offline',
|
gajim.interface.roster.send_status(account, 'offline',
|
||||||
_('Be right back.'))
|
_('Be right back.'))
|
||||||
gobject.timeout_add(500, login, account, show_before, status_before)
|
GObject.timeout_add(500, login, account, show_before, status_before)
|
||||||
|
|
||||||
def on_yes(checked, account):
|
def on_yes(checked, account):
|
||||||
relog(account)
|
relog(account)
|
||||||
|
@ -1667,11 +1672,14 @@ class AccountsWindow:
|
||||||
Activate modify buttons when a row is selected, update accounts info
|
Activate modify buttons when a row is selected, update accounts info
|
||||||
"""
|
"""
|
||||||
sel = self.accounts_treeview.get_selection()
|
sel = self.accounts_treeview.get_selection()
|
||||||
(model, iter_) = sel.get_selected()
|
if sel:
|
||||||
if iter_:
|
(model, iter_) = sel.get_selected()
|
||||||
account = model[iter_][0].decode('utf-8')
|
if iter_:
|
||||||
|
account = model[iter_][0].decode('utf-8')
|
||||||
|
else:
|
||||||
|
account = None
|
||||||
else:
|
else:
|
||||||
account = None
|
iter_ = account = None
|
||||||
if self.current_account and self.current_account == account:
|
if self.current_account and self.current_account == account:
|
||||||
# We're comming back to our current account, no need to update widgets
|
# We're comming back to our current account, no need to update widgets
|
||||||
return
|
return
|
||||||
|
@ -1738,7 +1746,7 @@ class AccountsWindow:
|
||||||
if not our_proxy:
|
if not our_proxy:
|
||||||
our_proxy = _('None')
|
our_proxy = _('None')
|
||||||
proxy_combobox = self.xml.get_object('proxies_combobox1')
|
proxy_combobox = self.xml.get_object('proxies_combobox1')
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
proxy_combobox.set_model(model)
|
proxy_combobox.set_model(model)
|
||||||
l = gajim.config.get_per('proxies')
|
l = gajim.config.get_per('proxies')
|
||||||
l.insert(0, _('None'))
|
l.insert(0, _('None'))
|
||||||
|
@ -2141,7 +2149,7 @@ class AccountsWindow:
|
||||||
if not widget.is_focus():
|
if not widget.is_focus():
|
||||||
pritext = _('Invalid Jabber ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
dialogs.ErrorDialog(pritext, str(s))
|
dialogs.ErrorDialog(pritext, str(s))
|
||||||
gobject.idle_add(lambda: widget.grab_focus())
|
GObject.idle_add(lambda: widget.grab_focus())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
jid_splited = jid.split('@', 1)
|
jid_splited = jid.split('@', 1)
|
||||||
|
@ -2151,7 +2159,7 @@ class AccountsWindow:
|
||||||
pritext = _('Invalid Jabber ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
sectext = _('A Jabber ID must be in the form "user@servername".')
|
sectext = _('A Jabber ID must be in the form "user@servername".')
|
||||||
dialogs.ErrorDialog(pritext, sectext)
|
dialogs.ErrorDialog(pritext, sectext)
|
||||||
gobject.idle_add(lambda: widget.grab_focus())
|
GObject.idle_add(lambda: widget.grab_focus())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -2218,7 +2226,7 @@ class AccountsWindow:
|
||||||
if not widget.is_focus():
|
if not widget.is_focus():
|
||||||
pritext = _('Invalid Jabber ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
dialogs.ErrorDialog(pritext, str(s))
|
dialogs.ErrorDialog(pritext, str(s))
|
||||||
gobject.idle_add(lambda: widget.grab_focus())
|
GObject.idle_add(lambda: widget.grab_focus())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.option_changed('resource', resource):
|
if self.option_changed('resource', resource):
|
||||||
|
@ -2374,7 +2382,7 @@ class AccountsWindow:
|
||||||
if not widget.is_focus():
|
if not widget.is_focus():
|
||||||
dialogs.ErrorDialog(_('Invalid entry'),
|
dialogs.ErrorDialog(_('Invalid entry'),
|
||||||
_('Custom port must be a port number.'))
|
_('Custom port must be a port number.'))
|
||||||
gobject.idle_add(lambda: widget.grab_focus())
|
GObject.idle_add(lambda: widget.grab_focus())
|
||||||
return True
|
return True
|
||||||
if self.option_changed('custom_port', custom_port):
|
if self.option_changed('custom_port', custom_port):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
|
@ -2662,14 +2670,14 @@ class AccountsWindow:
|
||||||
gajim.config.set_per('accounts', self.current_account,
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
'zeroconf_email', email)
|
'zeroconf_email', email)
|
||||||
|
|
||||||
class FakeDataForm(gtk.Table, object):
|
class FakeDataForm(Gtk.Table, object):
|
||||||
"""
|
"""
|
||||||
Class for forms that are in XML format <entry1>value1</entry1> infos in a
|
Class for forms that are in XML format <entry1>value1</entry1> infos in a
|
||||||
table {entry1: value1}
|
table {entry1: value1}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, infos):
|
def __init__(self, infos):
|
||||||
gtk.Table.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self.infos = infos
|
self.infos = infos
|
||||||
self.entries = {}
|
self.entries = {}
|
||||||
self._draw_table()
|
self._draw_table()
|
||||||
|
@ -2682,7 +2690,7 @@ class FakeDataForm(gtk.Table, object):
|
||||||
if 'instructions' in self.infos:
|
if 'instructions' in self.infos:
|
||||||
nbrow = 1
|
nbrow = 1
|
||||||
self.resize(rows = nbrow, columns = 2)
|
self.resize(rows = nbrow, columns = 2)
|
||||||
label = gtk.Label(self.infos['instructions'])
|
label = Gtk.Label(label=self.infos['instructions'])
|
||||||
self.attach(label, 0, 2, 0, 1, 0, 0, 0, 0)
|
self.attach(label, 0, 2, 0, 1, 0, 0, 0, 0)
|
||||||
for name in self.infos.keys():
|
for name in self.infos.keys():
|
||||||
if name in ('key', 'instructions', 'x', 'registered'):
|
if name in ('key', 'instructions', 'x', 'registered'):
|
||||||
|
@ -2692,9 +2700,9 @@ class FakeDataForm(gtk.Table, object):
|
||||||
|
|
||||||
nbrow = nbrow + 1
|
nbrow = nbrow + 1
|
||||||
self.resize(rows = nbrow, columns = 2)
|
self.resize(rows = nbrow, columns = 2)
|
||||||
label = gtk.Label(name.capitalize() + ':')
|
label = Gtk.Label(label=name.capitalize() + ':')
|
||||||
self.attach(label, 0, 1, nbrow - 1, nbrow, 0, 0, 0, 0)
|
self.attach(label, 0, 1, nbrow - 1, nbrow, 0, 0, 0, 0)
|
||||||
entry = gtk.Entry()
|
entry = Gtk.Entry()
|
||||||
entry.set_activates_default(True)
|
entry.set_activates_default(True)
|
||||||
if self.infos[name]:
|
if self.infos[name]:
|
||||||
entry.set_text(self.infos[name])
|
entry.set_text(self.infos[name])
|
||||||
|
@ -2722,7 +2730,7 @@ class ServiceRegistrationWindow:
|
||||||
self.is_form = is_form
|
self.is_form = is_form
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('service_registration_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('service_registration_window.ui')
|
||||||
self.window = self.xml.get_object('service_registration_window')
|
self.window = self.xml.get_object('service_registration_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
if self.is_form:
|
if self.is_form:
|
||||||
dataform = dataforms.ExtendForm(node = infos)
|
dataform = dataforms.ExtendForm(node = infos)
|
||||||
self.data_form_widget = dataforms_widget.DataFormWidget(dataform)
|
self.data_form_widget = dataforms_widget.DataFormWidget(dataform)
|
||||||
|
@ -2777,7 +2785,7 @@ class GroupchatConfigWindow:
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('data_form_window.ui',
|
self.xml = gtkgui_helpers.get_gtk_builder('data_form_window.ui',
|
||||||
'data_form_window')
|
'data_form_window')
|
||||||
self.window = self.xml.get_object('data_form_window')
|
self.window = self.xml.get_object('data_form_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
|
|
||||||
if self.form:
|
if self.form:
|
||||||
config_vbox = self.xml.get_object('config_vbox')
|
config_vbox = self.xml.get_object('config_vbox')
|
||||||
|
@ -2786,7 +2794,7 @@ class GroupchatConfigWindow:
|
||||||
# widget
|
# widget
|
||||||
sw = self.data_form_widget.xml.get_object(
|
sw = self.data_form_widget.xml.get_object(
|
||||||
'single_form_scrolledwindow')
|
'single_form_scrolledwindow')
|
||||||
sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
|
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER)
|
||||||
if self.form.title:
|
if self.form.title:
|
||||||
self.xml.get_object('title_label').set_text(self.form.title)
|
self.xml.get_object('title_label').set_text(self.form.title)
|
||||||
else:
|
else:
|
||||||
|
@ -2794,7 +2802,7 @@ class GroupchatConfigWindow:
|
||||||
self.xml.get_object('title_hseparator').hide()
|
self.xml.get_object('title_hseparator').hide()
|
||||||
|
|
||||||
self.data_form_widget.show()
|
self.data_form_widget.show()
|
||||||
config_vbox.pack_start(self.data_form_widget)
|
config_vbox.pack_start(self.data_form_widget, True, True, 0)
|
||||||
else:
|
else:
|
||||||
self.xml.get_object('title_label').set_no_show_all(True)
|
self.xml.get_object('title_label').set_no_show_all(True)
|
||||||
self.xml.get_object('title_label').hide()
|
self.xml.get_object('title_label').hide()
|
||||||
|
@ -2808,67 +2816,67 @@ class GroupchatConfigWindow:
|
||||||
|
|
||||||
for affiliation in self.affiliation_labels.keys():
|
for affiliation in self.affiliation_labels.keys():
|
||||||
self.start_users_dict[affiliation] = {}
|
self.start_users_dict[affiliation] = {}
|
||||||
hbox = gtk.HBox(spacing=5)
|
hbox = Gtk.HBox(spacing=5)
|
||||||
add_on_vbox.pack_start(hbox, False)
|
add_on_vbox.pack_start(hbox, False, True, 0)
|
||||||
|
|
||||||
label = gtk.Label(self.affiliation_labels[affiliation])
|
label = Gtk.Label(label=self.affiliation_labels[affiliation])
|
||||||
hbox.pack_start(label, False)
|
hbox.pack_start(label, False, True, 0)
|
||||||
|
|
||||||
bb = gtk.HButtonBox()
|
bb = Gtk.HButtonBox()
|
||||||
bb.set_layout(gtk.BUTTONBOX_END)
|
bb.set_layout(Gtk.ButtonBoxStyle.END)
|
||||||
bb.set_spacing(5)
|
bb.set_spacing(5)
|
||||||
hbox.pack_start(bb)
|
hbox.pack_start(bb, True, True, 0)
|
||||||
add_button = gtk.Button(stock=gtk.STOCK_ADD)
|
add_button = Gtk.Button(stock=Gtk.STOCK_ADD)
|
||||||
add_button.connect('clicked', self.on_add_button_clicked,
|
add_button.connect('clicked', self.on_add_button_clicked,
|
||||||
affiliation)
|
affiliation)
|
||||||
bb.pack_start(add_button)
|
bb.pack_start(add_button, True, True, 0)
|
||||||
self.remove_button[affiliation] = gtk.Button(stock=gtk.STOCK_REMOVE)
|
self.remove_button[affiliation] = Gtk.Button(stock=Gtk.STOCK_REMOVE)
|
||||||
self.remove_button[affiliation].set_sensitive(False)
|
self.remove_button[affiliation].set_sensitive(False)
|
||||||
self.remove_button[affiliation].connect('clicked',
|
self.remove_button[affiliation].connect('clicked',
|
||||||
self.on_remove_button_clicked, affiliation)
|
self.on_remove_button_clicked, affiliation)
|
||||||
bb.pack_start(self.remove_button[affiliation])
|
bb.pack_start(self.remove_button[affiliation], True, True, 0)
|
||||||
|
|
||||||
# jid, reason, nick, role
|
# jid, reason, nick, role
|
||||||
liststore = gtk.ListStore(str, str, str, str)
|
liststore = Gtk.ListStore(str, str, str, str)
|
||||||
self.affiliation_treeview[affiliation] = gtk.TreeView(liststore)
|
self.affiliation_treeview[affiliation] = Gtk.TreeView(liststore)
|
||||||
self.affiliation_treeview[affiliation].get_selection().set_mode(
|
self.affiliation_treeview[affiliation].get_selection().set_mode(
|
||||||
gtk.SELECTION_MULTIPLE)
|
Gtk.SelectionMode.MULTIPLE)
|
||||||
self.affiliation_treeview[affiliation].connect('cursor-changed',
|
self.affiliation_treeview[affiliation].connect('cursor-changed',
|
||||||
self.on_affiliation_treeview_cursor_changed, affiliation)
|
self.on_affiliation_treeview_cursor_changed, affiliation)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('JID'), renderer)
|
col = Gtk.TreeViewColumn(_('JID'), renderer)
|
||||||
col.add_attribute(renderer, 'text', 0)
|
col.add_attribute(renderer, 'text', 0)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_sort_column_id(0)
|
col.set_sort_column_id(0)
|
||||||
self.affiliation_treeview[affiliation].append_column(col)
|
self.affiliation_treeview[affiliation].append_column(col)
|
||||||
|
|
||||||
if affiliation == 'outcast':
|
if affiliation == 'outcast':
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
renderer.set_property('editable', True)
|
renderer.set_property('editable', True)
|
||||||
renderer.connect('edited', self.on_cell_edited)
|
renderer.connect('edited', self.on_cell_edited)
|
||||||
col = gtk.TreeViewColumn(_('Reason'), renderer)
|
col = Gtk.TreeViewColumn(_('Reason'), renderer)
|
||||||
col.add_attribute(renderer, 'text', 1)
|
col.add_attribute(renderer, 'text', 1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_sort_column_id(1)
|
col.set_sort_column_id(1)
|
||||||
self.affiliation_treeview[affiliation].append_column(col)
|
self.affiliation_treeview[affiliation].append_column(col)
|
||||||
elif affiliation == 'member':
|
elif affiliation == 'member':
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('Nick'), renderer)
|
col = Gtk.TreeViewColumn(_('Nick'), renderer)
|
||||||
col.add_attribute(renderer, 'text', 2)
|
col.add_attribute(renderer, 'text', 2)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_sort_column_id(2)
|
col.set_sort_column_id(2)
|
||||||
self.affiliation_treeview[affiliation].append_column(col)
|
self.affiliation_treeview[affiliation].append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('Role'), renderer)
|
col = Gtk.TreeViewColumn(_('Role'), renderer)
|
||||||
col.add_attribute(renderer, 'text', 3)
|
col.add_attribute(renderer, 'text', 3)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_sort_column_id(3)
|
col.set_sort_column_id(3)
|
||||||
self.affiliation_treeview[affiliation].append_column(col)
|
self.affiliation_treeview[affiliation].append_column(col)
|
||||||
|
|
||||||
sw = gtk.ScrolledWindow()
|
sw = Gtk.ScrolledWindow()
|
||||||
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
|
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER)
|
||||||
sw.add(self.affiliation_treeview[affiliation])
|
sw.add(self.affiliation_treeview[affiliation])
|
||||||
add_on_vbox.pack_start(sw)
|
add_on_vbox.pack_start(sw, True, True, 0)
|
||||||
gajim.connections[self.account].get_affiliation_list(self.room_jid,
|
gajim.connections[self.account].get_affiliation_list(self.room_jid,
|
||||||
affiliation)
|
affiliation)
|
||||||
|
|
||||||
|
@ -2917,7 +2925,7 @@ class GroupchatConfigWindow:
|
||||||
model, paths = selection.get_selected_rows()
|
model, paths = selection.get_selected_rows()
|
||||||
row_refs = []
|
row_refs = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
row_refs.append(gtk.TreeRowReference(model, path))
|
row_refs.append(Gtk.TreeRowReference(model, path))
|
||||||
for row_ref in row_refs:
|
for row_ref in row_refs:
|
||||||
path = row_ref.get_path()
|
path = row_ref.get_path()
|
||||||
iter_ = model.get_iter(path)
|
iter_ = model.get_iter(path)
|
||||||
|
@ -2996,7 +3004,7 @@ class RemoveAccountWindow:
|
||||||
self.account = account
|
self.account = account
|
||||||
xml = gtkgui_helpers.get_gtk_builder('remove_account_window.ui')
|
xml = gtkgui_helpers.get_gtk_builder('remove_account_window.ui')
|
||||||
self.window = xml.get_object('remove_account_window')
|
self.window = xml.get_object('remove_account_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
self.remove_and_unregister_radiobutton = xml.get_object(
|
self.remove_and_unregister_radiobutton = xml.get_object(
|
||||||
'remove_and_unregister_radiobutton')
|
'remove_and_unregister_radiobutton')
|
||||||
self.window.set_title(_('Removing %s account') % self.account)
|
self.window.set_title(_('Removing %s account') % self.account)
|
||||||
|
@ -3103,12 +3111,12 @@ class ManageBookmarksWindow:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('manage_bookmarks_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('manage_bookmarks_window.ui')
|
||||||
self.window = self.xml.get_object('manage_bookmarks_window')
|
self.window = self.xml.get_object('manage_bookmarks_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
|
|
||||||
# Account-JID, RoomName, Room-JID, Autojoin, Minimize, Passowrd, Nick,
|
# Account-JID, RoomName, Room-JID, Autojoin, Minimize, Passowrd, Nick,
|
||||||
# Show_Status
|
# Show_Status
|
||||||
self.treestore = gtk.TreeStore(str, str, str, bool, bool, str, str, str)
|
self.treestore = Gtk.TreeStore(str, str, str, bool, bool, str, str, str)
|
||||||
self.treestore.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
self.treestore.set_sort_column_id(1, Gtk.SortType.ASCENDING)
|
||||||
|
|
||||||
# Store bookmarks in treeview.
|
# Store bookmarks in treeview.
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
|
@ -3149,7 +3157,7 @@ class ManageBookmarksWindow:
|
||||||
print_status ])
|
print_status ])
|
||||||
|
|
||||||
self.print_status_combobox = self.xml.get_object('print_status_combobox')
|
self.print_status_combobox = self.xml.get_object('print_status_combobox')
|
||||||
model = gtk.ListStore(str, str)
|
model = Gtk.ListStore(str, str)
|
||||||
|
|
||||||
self.option_list = {'': _('Default'), 'all': Q_('?print_status:All'),
|
self.option_list = {'': _('Default'), 'all': Q_('?print_status:All'),
|
||||||
'in_and_out': _('Enter and leave only'),
|
'in_and_out': _('Enter and leave only'),
|
||||||
|
@ -3165,8 +3173,8 @@ class ManageBookmarksWindow:
|
||||||
self.view.set_model(self.treestore)
|
self.view.set_model(self.treestore)
|
||||||
self.view.expand_all()
|
self.view.expand_all()
|
||||||
|
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
column = gtk.TreeViewColumn('Bookmarks', renderer, text=1)
|
column = Gtk.TreeViewColumn('Bookmarks', renderer, text=1)
|
||||||
self.view.append_column(column)
|
self.view.append_column(column)
|
||||||
|
|
||||||
self.selection = self.view.get_selection()
|
self.selection = self.view.get_selection()
|
||||||
|
@ -3189,7 +3197,7 @@ class ManageBookmarksWindow:
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
# select root iter
|
# select root iter
|
||||||
self.selection.select_iter(self.treestore.get_iter_root())
|
self.selection.select_iter(self.treestore.get_iter_first())
|
||||||
|
|
||||||
def on_add_bookmark_button_clicked(self, widget):
|
def on_add_bookmark_button_clicked(self, widget):
|
||||||
"""
|
"""
|
||||||
|
@ -3456,39 +3464,23 @@ class AccountCreationWizardWindow:
|
||||||
self.window = self.xml.get_object('account_creation_wizard_window')
|
self.window = self.xml.get_object('account_creation_wizard_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.window.set_transient_for(gajim.interface.roster.window)
|
||||||
|
|
||||||
completion = gtk.EntryCompletion()
|
# Connect events from comboboxentry.get_child()
|
||||||
completion1 = gtk.EntryCompletion()
|
|
||||||
# Connect events from comboboxentry.child
|
|
||||||
server_comboboxentry = self.xml.get_object('server_comboboxentry')
|
server_comboboxentry = self.xml.get_object('server_comboboxentry')
|
||||||
entry = server_comboboxentry.child
|
entry = server_comboboxentry.get_child()
|
||||||
entry.connect('key_press_event',
|
entry.connect('key_press_event',
|
||||||
self.on_server_comboboxentry_key_press_event, server_comboboxentry)
|
self.on_server_comboboxentry_key_press_event, server_comboboxentry)
|
||||||
entry.set_completion(completion)
|
|
||||||
# Do the same for the other server comboboxentry
|
# Do the same for the other server comboboxentry
|
||||||
server_comboboxentry1 = self.xml.get_object('server_comboboxentry1')
|
server_comboboxentry1 = self.xml.get_object('server_comboboxentry1')
|
||||||
entry = server_comboboxentry1.child
|
|
||||||
entry.set_completion(completion1)
|
|
||||||
|
|
||||||
self.update_proxy_list()
|
self.update_proxy_list()
|
||||||
|
|
||||||
# parse servers.xml
|
# parse servers.xml
|
||||||
servers_xml = os.path.join(gajim.DATA_DIR, 'other', 'servers.xml')
|
servers_xml = os.path.join(gajim.DATA_DIR, 'other', 'servers.xml')
|
||||||
servers = gtkgui_helpers.parse_server_xml(servers_xml)
|
servers = gtkgui_helpers.parse_server_xml(servers_xml)
|
||||||
servers_model = gtk.ListStore(str)
|
servers_model = self.xml.get_object('server_liststore')
|
||||||
for server in servers:
|
for server in servers:
|
||||||
servers_model.append((server,))
|
servers_model.append((server,))
|
||||||
|
|
||||||
completion.set_model(servers_model)
|
|
||||||
completion.set_text_column(0)
|
|
||||||
completion1.set_model(servers_model)
|
|
||||||
completion1.set_text_column(0)
|
|
||||||
|
|
||||||
# Put servers into comboboxentries
|
|
||||||
server_comboboxentry.set_model(servers_model)
|
|
||||||
server_comboboxentry.set_text_column(0)
|
|
||||||
server_comboboxentry1.set_model(servers_model)
|
|
||||||
server_comboboxentry1.set_text_column(0)
|
|
||||||
|
|
||||||
# Generic widgets
|
# Generic widgets
|
||||||
self.notebook = self.xml.get_object('notebook')
|
self.notebook = self.xml.get_object('notebook')
|
||||||
self.cancel_button = self.xml.get_object('cancel_button')
|
self.cancel_button = self.xml.get_object('cancel_button')
|
||||||
|
@ -3597,7 +3589,7 @@ class AccountCreationWizardWindow:
|
||||||
self.go_online_checkbutton.show()
|
self.go_online_checkbutton.show()
|
||||||
img = self.xml.get_object('finish_image')
|
img = self.xml.get_object('finish_image')
|
||||||
if self.modify:
|
if self.modify:
|
||||||
img.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_DIALOG)
|
img.set_from_stock(Gtk.STOCK_APPLY, Gtk.IconSize.DIALOG)
|
||||||
else:
|
else:
|
||||||
path_to_file = gtkgui_helpers.get_icon_path('gajim', 48)
|
path_to_file = gtkgui_helpers.get_icon_path('gajim', 48)
|
||||||
img.set_from_file(path_to_file)
|
img.set_from_file(path_to_file)
|
||||||
|
@ -3630,7 +3622,7 @@ class AccountCreationWizardWindow:
|
||||||
'You must provide a username to configure this account.')
|
'You must provide a username to configure this account.')
|
||||||
dialogs.ErrorDialog(pritext, sectext)
|
dialogs.ErrorDialog(pritext, sectext)
|
||||||
return
|
return
|
||||||
server = self.xml.get_object('server_comboboxentry').child.\
|
server = self.xml.get_object('server_comboboxentry').get_child().\
|
||||||
get_text().decode('utf-8').strip()
|
get_text().decode('utf-8').strip()
|
||||||
savepass = self.xml.get_object('save_password_checkbutton').\
|
savepass = self.xml.get_object('save_password_checkbutton').\
|
||||||
get_active()
|
get_active()
|
||||||
|
@ -3664,7 +3656,7 @@ class AccountCreationWizardWindow:
|
||||||
self.show_finish_page()
|
self.show_finish_page()
|
||||||
elif cur_page == 2:
|
elif cur_page == 2:
|
||||||
# We are creating a new account
|
# We are creating a new account
|
||||||
server = self.xml.get_object('server_comboboxentry1').child.\
|
server = self.xml.get_object('server_comboboxentry1').get_child().\
|
||||||
get_text().decode('utf-8')
|
get_text().decode('utf-8')
|
||||||
|
|
||||||
if not server:
|
if not server:
|
||||||
|
@ -3707,7 +3699,7 @@ class AccountCreationWizardWindow:
|
||||||
self.notebook.set_current_page(5) # show creating page
|
self.notebook.set_current_page(5) # show creating page
|
||||||
self.back_button.hide()
|
self.back_button.hide()
|
||||||
self.forward_button.hide()
|
self.forward_button.hide()
|
||||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
self.update_progressbar_timeout_id = GObject.timeout_add(100,
|
||||||
self.update_progressbar)
|
self.update_progressbar)
|
||||||
# Get form from serveur
|
# Get form from serveur
|
||||||
con = connection.Connection(self.account)
|
con = connection.Connection(self.account)
|
||||||
|
@ -3749,12 +3741,12 @@ class AccountCreationWizardWindow:
|
||||||
self.notebook.set_current_page(5) # show creating page
|
self.notebook.set_current_page(5) # show creating page
|
||||||
self.back_button.hide()
|
self.back_button.hide()
|
||||||
self.forward_button.hide()
|
self.forward_button.hide()
|
||||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
self.update_progressbar_timeout_id = GObject.timeout_add(100,
|
||||||
self.update_progressbar)
|
self.update_progressbar)
|
||||||
|
|
||||||
def update_proxy_list(self):
|
def update_proxy_list(self):
|
||||||
proxies_combobox = self.xml.get_object('proxies_combobox')
|
proxies_combobox = self.xml.get_object('proxies_combobox')
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
proxies_combobox.set_model(model)
|
proxies_combobox.set_model(model)
|
||||||
l = gajim.config.get_per('proxies')
|
l = gajim.config.get_per('proxies')
|
||||||
l.insert(0, _('None'))
|
l.insert(0, _('None'))
|
||||||
|
@ -3785,7 +3777,7 @@ class AccountCreationWizardWindow:
|
||||||
if obj.conn.name != self.account:
|
if obj.conn.name != self.account:
|
||||||
return
|
return
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
self.back_button.show()
|
self.back_button.show()
|
||||||
self.forward_button.show()
|
self.forward_button.show()
|
||||||
self.is_form = obj.is_form
|
self.is_form = obj.is_form
|
||||||
|
@ -3802,7 +3794,7 @@ class AccountCreationWizardWindow:
|
||||||
empty_config = False
|
empty_config = False
|
||||||
break
|
break
|
||||||
self.data_form_widget.show_all()
|
self.data_form_widget.show_all()
|
||||||
self.xml.get_object('form_vbox').pack_start(self.data_form_widget)
|
self.xml.get_object('form_vbox').pack_start(self.data_form_widget, True, True, 0)
|
||||||
if empty_config:
|
if empty_config:
|
||||||
self.forward_button.set_sensitive(False)
|
self.forward_button.set_sensitive(False)
|
||||||
self.notebook.set_current_page(4) # show form page
|
self.notebook.set_current_page(4) # show form page
|
||||||
|
@ -3841,7 +3833,7 @@ class AccountCreationWizardWindow:
|
||||||
if self.account not in gajim.connections:
|
if self.account not in gajim.connections:
|
||||||
return
|
return
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
del gajim.connections[self.account]
|
del gajim.connections[self.account]
|
||||||
if self.account in gajim.config.get_per('accounts'):
|
if self.account in gajim.config.get_per('accounts'):
|
||||||
gajim.config.del_per('accounts', self.account)
|
gajim.config.del_per('accounts', self.account)
|
||||||
|
@ -3850,7 +3842,7 @@ class AccountCreationWizardWindow:
|
||||||
self.go_online_checkbutton.hide()
|
self.go_online_checkbutton.hide()
|
||||||
self.show_vcard_checkbutton.hide()
|
self.show_vcard_checkbutton.hide()
|
||||||
img = self.xml.get_object('finish_image')
|
img = self.xml.get_object('finish_image')
|
||||||
img.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG)
|
img.set_from_stock(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.DIALOG)
|
||||||
finish_text = '<big><b>%s</b></big>\n\n%s' % (
|
finish_text = '<big><b>%s</b></big>\n\n%s' % (
|
||||||
_('An error occurred during account creation'), obj.reason)
|
_('An error occurred during account creation'), obj.reason)
|
||||||
self.finish_label.set_markup(finish_text)
|
self.finish_label.set_markup(finish_text)
|
||||||
|
@ -3867,7 +3859,7 @@ class AccountCreationWizardWindow:
|
||||||
self.show_finish_page()
|
self.show_finish_page()
|
||||||
|
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
|
|
||||||
def _nec_acc_is_not_ok(self, obj):
|
def _nec_acc_is_not_ok(self, obj):
|
||||||
"""
|
"""
|
||||||
|
@ -3884,14 +3876,14 @@ class AccountCreationWizardWindow:
|
||||||
if self.account in gajim.config.get_per('accounts'):
|
if self.account in gajim.config.get_per('accounts'):
|
||||||
gajim.config.del_per('accounts', self.account)
|
gajim.config.del_per('accounts', self.account)
|
||||||
img = self.xml.get_object('finish_image')
|
img = self.xml.get_object('finish_image')
|
||||||
img.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG)
|
img.set_from_stock(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.DIALOG)
|
||||||
finish_text = '<big><b>%s</b></big>\n\n%s' % (_(
|
finish_text = '<big><b>%s</b></big>\n\n%s' % (_(
|
||||||
'An error occurred during account creation'), obj.reason)
|
'An error occurred during account creation'), obj.reason)
|
||||||
self.finish_label.set_markup(finish_text)
|
self.finish_label.set_markup(finish_text)
|
||||||
self.notebook.set_current_page(6) # show finish page
|
self.notebook.set_current_page(6) # show finish page
|
||||||
|
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
|
|
||||||
def on_advanced_button_clicked(self, widget):
|
def on_advanced_button_clicked(self, widget):
|
||||||
if 'accounts' in gajim.interface.instances:
|
if 'accounts' in gajim.interface.instances:
|
||||||
|
@ -3912,15 +3904,15 @@ class AccountCreationWizardWindow:
|
||||||
|
|
||||||
def on_username_entry_key_press_event(self, widget, event):
|
def on_username_entry_key_press_event(self, widget, event):
|
||||||
# Check for pressed @ and jump to combobox if found
|
# Check for pressed @ and jump to combobox if found
|
||||||
if event.keyval == gtk.keysyms.at:
|
if event.keyval == Gdk.KEY_at:
|
||||||
combobox = self.xml.get_object('server_comboboxentry')
|
combobox = self.xml.get_object('server_comboboxentry')
|
||||||
combobox.grab_focus()
|
combobox.grab_focus()
|
||||||
combobox.child.set_position(-1)
|
combobox.get_child().set_position(-1)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_server_comboboxentry_key_press_event(self, widget, event, combobox):
|
def on_server_comboboxentry_key_press_event(self, widget, event, combobox):
|
||||||
# If backspace is pressed in empty field, return to the nick entry field
|
# If backspace is pressed in empty field, return to the nick entry field
|
||||||
backspace = event.keyval == gtk.keysyms.BackSpace
|
backspace = event.keyval == Gdk.KEY_BackSpace
|
||||||
empty = len(combobox.get_active_text()) == 0
|
empty = len(combobox.get_active_text()) == 0
|
||||||
if backspace and empty and self.modify:
|
if backspace and empty and self.modify:
|
||||||
username_entry = self.xml.get_object('username_entry')
|
username_entry = self.xml.get_object('username_entry')
|
||||||
|
@ -4014,7 +4006,7 @@ class ManagePEPServicesWindow:
|
||||||
def __init__(self, account):
|
def __init__(self, account):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('manage_pep_services_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('manage_pep_services_window.ui')
|
||||||
self.window = self.xml.get_object('manage_pep_services_window')
|
self.window = self.xml.get_object('manage_pep_services_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
self.xml.get_object('configure_button').set_sensitive(False)
|
self.xml.get_object('configure_button').set_sensitive(False)
|
||||||
self.xml.get_object('delete_button').set_sensitive(False)
|
self.xml.get_object('delete_button').set_sensitive(False)
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
|
@ -4049,14 +4041,14 @@ class ManagePEPServicesWindow:
|
||||||
def init_services(self):
|
def init_services(self):
|
||||||
self.treeview = self.xml.get_object('services_treeview')
|
self.treeview = self.xml.get_object('services_treeview')
|
||||||
# service, access_model, group
|
# service, access_model, group
|
||||||
self.treestore = gtk.ListStore(str)
|
self.treestore = Gtk.ListStore(str)
|
||||||
self.treeview.set_model(self.treestore)
|
self.treeview.set_model(self.treestore)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn('Service')
|
col = Gtk.TreeViewColumn('Service')
|
||||||
self.treeview.append_column(col)
|
self.treeview.append_column(col)
|
||||||
|
|
||||||
cellrenderer_text = gtk.CellRendererText()
|
cellrenderer_text = Gtk.CellRendererText()
|
||||||
col.pack_start(cellrenderer_text)
|
col.pack_start(cellrenderer_text, True, True, 0)
|
||||||
col.add_attribute(cellrenderer_text, 'text', 0)
|
col.add_attribute(cellrenderer_text, 'text', 0)
|
||||||
|
|
||||||
our_jid = gajim.get_jid_from_account(self.account)
|
our_jid = gajim.get_jid_from_account(self.account)
|
||||||
|
@ -4072,7 +4064,7 @@ class ManagePEPServicesWindow:
|
||||||
if jid != gajim.get_jid_from_account(self.account):
|
if jid != gajim.get_jid_from_account(self.account):
|
||||||
return
|
return
|
||||||
model = self.treeview.get_model()
|
model = self.treeview.get_model()
|
||||||
iter_ = model.get_iter_root()
|
iter_ = model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
if model[iter_][0] == node:
|
if model[iter_][0] == node:
|
||||||
model.remove(iter_)
|
model.remove(iter_)
|
||||||
|
@ -4124,21 +4116,21 @@ class ManageSoundsWindow:
|
||||||
self.sound_tree = self.xml.get_object('sounds_treeview')
|
self.sound_tree = self.xml.get_object('sounds_treeview')
|
||||||
|
|
||||||
# active, event ui name, path to sound file, event_config_name
|
# active, event ui name, path to sound file, event_config_name
|
||||||
model = gtk.ListStore(bool, str, str, str)
|
model = Gtk.ListStore(bool, str, str, str)
|
||||||
self.sound_tree.set_model(model)
|
self.sound_tree.set_model(model)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Active'))
|
col = Gtk.TreeViewColumn(_('Active'))
|
||||||
self.sound_tree.append_column(col)
|
self.sound_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererToggle()
|
renderer = Gtk.CellRendererToggle()
|
||||||
renderer.set_property('activatable', True)
|
renderer.set_property('activatable', True)
|
||||||
renderer.connect('toggled', self.sound_toggled_cb)
|
renderer.connect('toggled', self.sound_toggled_cb)
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, active = 0)
|
col.set_attributes(renderer, active = 0)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Event'))
|
col = Gtk.TreeViewColumn(_('Event'))
|
||||||
self.sound_tree.append_column(col)
|
self.sound_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 1)
|
col.set_attributes(renderer, text = 1)
|
||||||
|
|
||||||
self.fill_sound_treeview()
|
self.fill_sound_treeview()
|
||||||
|
@ -4164,7 +4156,7 @@ class ManageSoundsWindow:
|
||||||
def fill_sound_treeview(self):
|
def fill_sound_treeview(self):
|
||||||
model = self.sound_tree.get_model()
|
model = self.sound_tree.get_model()
|
||||||
model.clear()
|
model.clear()
|
||||||
model.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
|
||||||
|
|
||||||
# NOTE: sounds_ui_names MUST have all items of
|
# NOTE: sounds_ui_names MUST have all items of
|
||||||
# sounds = gajim.config.get_per('soundevents') as keys
|
# sounds = gajim.config.get_per('soundevents') as keys
|
||||||
|
|
|
@ -29,9 +29,10 @@
|
||||||
|
|
||||||
from threading import Timer # for smooth scrolling
|
from threading import Timer # for smooth scrolling
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import GdkPixbuf
|
||||||
import gobject
|
from gi.repository import Pango
|
||||||
|
from gi.repository import GObject
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import tooltips
|
import tooltips
|
||||||
|
@ -63,9 +64,9 @@ def is_selection_modified(mark):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def has_focus(widget):
|
def has_focus(widget):
|
||||||
return widget.flags() & gtk.HAS_FOCUS == gtk.HAS_FOCUS
|
return widget.flags() & Gtk.HAS_FOCUS == Gtk.HAS_FOCUS
|
||||||
|
|
||||||
class TextViewImage(gtk.Image):
|
class TextViewImage(Gtk.Image):
|
||||||
|
|
||||||
def __init__(self, anchor, text):
|
def __init__(self, anchor, text):
|
||||||
super(TextViewImage, self).__init__()
|
super(TextViewImage, self).__init__()
|
||||||
|
@ -91,14 +92,14 @@ class TextViewImage(gtk.Image):
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
parent = self.get_parent()
|
parent = self.get_parent()
|
||||||
if not parent:
|
if not parent:
|
||||||
return gtk.STATE_NORMAL
|
return Gtk.StateType.NORMAL
|
||||||
if self._selected:
|
if self._selected:
|
||||||
if has_focus(parent):
|
if has_focus(parent):
|
||||||
return gtk.STATE_SELECTED
|
return Gtk.StateType.SELECTED
|
||||||
else:
|
else:
|
||||||
return gtk.STATE_ACTIVE
|
return Gtk.StateType.ACTIVE
|
||||||
else:
|
else:
|
||||||
return gtk.STATE_NORMAL
|
return Gtk.StateType.NORMAL
|
||||||
|
|
||||||
def _update_selected(self):
|
def _update_selected(self):
|
||||||
selected = self._get_selected()
|
selected = self._get_selected()
|
||||||
|
@ -149,21 +150,21 @@ class TextViewImage(gtk.Image):
|
||||||
|
|
||||||
def on_expose(self, widget, event):
|
def on_expose(self, widget, event):
|
||||||
state = self.get_state()
|
state = self.get_state()
|
||||||
if state != gtk.STATE_NORMAL:
|
if state != Gtk.StateType.NORMAL:
|
||||||
gc = widget.get_style().base_gc[state]
|
gc = widget.get_style().base_gc[state]
|
||||||
area = widget.allocation
|
area = widget.allocation
|
||||||
widget.window.draw_rectangle(gc, True, area.x, area.y,
|
widget.get_window(Gtk.TextWindowType.TEXT).draw_rectangle(gc, True,
|
||||||
area.width, area.height)
|
area.x, area.y, area.width, area.height)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class ConversationTextview(gobject.GObject):
|
class ConversationTextview(GObject.GObject):
|
||||||
"""
|
"""
|
||||||
Class for the conversation textview (where user reads already said messages)
|
Class for the conversation textview (where user reads already said messages)
|
||||||
for chat/groupchat windows
|
for chat/groupchat windows
|
||||||
"""
|
"""
|
||||||
__gsignals__ = dict(
|
__gsignals__ = dict(
|
||||||
quote = (gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION,
|
quote = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION,
|
||||||
None, # return value
|
None, # return value
|
||||||
(str, ) # arguments
|
(str, ) # arguments
|
||||||
)
|
)
|
||||||
|
@ -182,7 +183,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
If used_in_history_window is True, then we do not show Clear menuitem in
|
If used_in_history_window is True, then we do not show Clear menuitem in
|
||||||
context menu
|
context menu
|
||||||
"""
|
"""
|
||||||
gobject.GObject.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self.used_in_history_window = used_in_history_window
|
self.used_in_history_window = used_in_history_window
|
||||||
|
|
||||||
self.fc = FuzzyClock()
|
self.fc = FuzzyClock()
|
||||||
|
@ -197,7 +198,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
self.tv.set_accepts_tab(True)
|
self.tv.set_accepts_tab(True)
|
||||||
self.tv.set_editable(False)
|
self.tv.set_editable(False)
|
||||||
self.tv.set_cursor_visible(False)
|
self.tv.set_cursor_visible(False)
|
||||||
self.tv.set_wrap_mode(gtk.WRAP_WORD_CHAR)
|
self.tv.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
|
||||||
self.tv.set_left_margin(2)
|
self.tv.set_left_margin(2)
|
||||||
self.tv.set_right_margin(2)
|
self.tv.set_right_margin(2)
|
||||||
self.handlers = {}
|
self.handlers = {}
|
||||||
|
@ -219,8 +220,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
self.on_textview_button_press_event)
|
self.on_textview_button_press_event)
|
||||||
self.handlers[id_] = self.tv
|
self.handlers[id_] = self.tv
|
||||||
|
|
||||||
id_ = self.tv.connect('expose-event',
|
id_ = self.tv.connect('draw', self.on_textview_draw)
|
||||||
self.on_textview_expose_event)
|
|
||||||
self.handlers[id_] = self.tv
|
self.handlers[id_] = self.tv
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
self.change_cursor = False
|
self.change_cursor = False
|
||||||
self.last_time_printout = 0
|
self.last_time_printout = 0
|
||||||
|
|
||||||
font = pango.FontDescription(gajim.config.get('conversation_font'))
|
font = Pango.FontDescription(gajim.config.get('conversation_font'))
|
||||||
self.tv.modify_font(font)
|
self.tv.modify_font(font)
|
||||||
buffer_ = self.tv.get_buffer()
|
buffer_ = self.tv.get_buffer()
|
||||||
end_iter = buffer_.get_end_iter()
|
end_iter = buffer_.get_end_iter()
|
||||||
|
@ -236,25 +236,25 @@ class ConversationTextview(gobject.GObject):
|
||||||
|
|
||||||
self.tagIn = buffer_.create_tag('incoming')
|
self.tagIn = buffer_.create_tag('incoming')
|
||||||
color = gajim.config.get('inmsgcolor')
|
color = gajim.config.get('inmsgcolor')
|
||||||
font = pango.FontDescription(gajim.config.get('inmsgfont'))
|
font = Pango.FontDescription(gajim.config.get('inmsgfont'))
|
||||||
self.tagIn.set_property('foreground', color)
|
self.tagIn.set_property('foreground', color)
|
||||||
self.tagIn.set_property('font-desc', font)
|
self.tagIn.set_property('font-desc', font)
|
||||||
|
|
||||||
self.tagOut = buffer_.create_tag('outgoing')
|
self.tagOut = buffer_.create_tag('outgoing')
|
||||||
color = gajim.config.get('outmsgcolor')
|
color = gajim.config.get('outmsgcolor')
|
||||||
font = pango.FontDescription(gajim.config.get('outmsgfont'))
|
font = Pango.FontDescription(gajim.config.get('outmsgfont'))
|
||||||
self.tagOut.set_property('foreground', color)
|
self.tagOut.set_property('foreground', color)
|
||||||
self.tagOut.set_property('font-desc', font)
|
self.tagOut.set_property('font-desc', font)
|
||||||
|
|
||||||
self.tagStatus = buffer_.create_tag('status')
|
self.tagStatus = buffer_.create_tag('status')
|
||||||
color = gajim.config.get('statusmsgcolor')
|
color = gajim.config.get('statusmsgcolor')
|
||||||
font = pango.FontDescription(gajim.config.get('satusmsgfont'))
|
font = Pango.FontDescription(gajim.config.get('satusmsgfont'))
|
||||||
self.tagStatus.set_property('foreground', color)
|
self.tagStatus.set_property('foreground', color)
|
||||||
self.tagStatus.set_property('font-desc', font)
|
self.tagStatus.set_property('font-desc', font)
|
||||||
|
|
||||||
self.tagInText = buffer_.create_tag('incomingtxt')
|
self.tagInText = buffer_.create_tag('incomingtxt')
|
||||||
color = gajim.config.get('inmsgtxtcolor')
|
color = gajim.config.get('inmsgtxtcolor')
|
||||||
font = pango.FontDescription(gajim.config.get('inmsgtxtfont'))
|
font = Pango.FontDescription(gajim.config.get('inmsgtxtfont'))
|
||||||
if color:
|
if color:
|
||||||
self.tagInText.set_property('foreground', color)
|
self.tagInText.set_property('foreground', color)
|
||||||
self.tagInText.set_property('font-desc', font)
|
self.tagInText.set_property('font-desc', font)
|
||||||
|
@ -262,7 +262,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
self.tagOutText = buffer_.create_tag('outgoingtxt')
|
self.tagOutText = buffer_.create_tag('outgoingtxt')
|
||||||
color = gajim.config.get('outmsgtxtcolor')
|
color = gajim.config.get('outmsgtxtcolor')
|
||||||
if color:
|
if color:
|
||||||
font = pango.FontDescription(gajim.config.get('outmsgtxtfont'))
|
font = Pango.FontDescription(gajim.config.get('outmsgtxtfont'))
|
||||||
self.tagOutText.set_property('foreground', color)
|
self.tagOutText.set_property('foreground', color)
|
||||||
self.tagOutText.set_property('font-desc', font)
|
self.tagOutText.set_property('font-desc', font)
|
||||||
|
|
||||||
|
@ -276,15 +276,17 @@ class ConversationTextview(gobject.GObject):
|
||||||
tag = buffer_.create_tag('marked')
|
tag = buffer_.create_tag('marked')
|
||||||
color = gajim.config.get('markedmsgcolor')
|
color = gajim.config.get('markedmsgcolor')
|
||||||
tag.set_property('foreground', color)
|
tag.set_property('foreground', color)
|
||||||
tag.set_property('weight', pango.WEIGHT_BOLD)
|
tag.set_property('weight', Pango.Weight.BOLD)
|
||||||
|
|
||||||
tag = buffer_.create_tag('time_sometimes')
|
tag = buffer_.create_tag('time_sometimes')
|
||||||
tag.set_property('foreground', 'darkgrey')
|
tag.set_property('foreground', 'darkgrey')
|
||||||
tag.set_property('scale', pango.SCALE_SMALL)
|
#Pango.SCALE_SMALL
|
||||||
tag.set_property('justification', gtk.JUSTIFY_CENTER)
|
tag.set_property('scale', 0.8333333333333)
|
||||||
|
tag.set_property('justification', Gtk.Justification.CENTER)
|
||||||
|
|
||||||
tag = buffer_.create_tag('small')
|
tag = buffer_.create_tag('small')
|
||||||
tag.set_property('scale', pango.SCALE_SMALL)
|
#Pango.SCALE_SMALL
|
||||||
|
tag.set_property('scale', 0.8333333333333)
|
||||||
|
|
||||||
tag = buffer_.create_tag('restored_message')
|
tag = buffer_.create_tag('restored_message')
|
||||||
color = gajim.config.get('restored_messages_color')
|
color = gajim.config.get('restored_messages_color')
|
||||||
|
@ -293,39 +295,39 @@ class ConversationTextview(gobject.GObject):
|
||||||
self.tagURL = buffer_.create_tag('url')
|
self.tagURL = buffer_.create_tag('url')
|
||||||
color = gajim.config.get('urlmsgcolor')
|
color = gajim.config.get('urlmsgcolor')
|
||||||
self.tagURL.set_property('foreground', color)
|
self.tagURL.set_property('foreground', color)
|
||||||
self.tagURL.set_property('underline', pango.UNDERLINE_SINGLE)
|
self.tagURL.set_property('underline', Pango.Underline.SINGLE)
|
||||||
id_ = self.tagURL.connect('event', self.hyperlink_handler, 'url')
|
id_ = self.tagURL.connect('event', self.hyperlink_handler, 'url')
|
||||||
self.handlers[id_] = self.tagURL
|
self.handlers[id_] = self.tagURL
|
||||||
|
|
||||||
self.tagMail = buffer_.create_tag('mail')
|
self.tagMail = buffer_.create_tag('mail')
|
||||||
self.tagMail.set_property('foreground', color)
|
self.tagMail.set_property('foreground', color)
|
||||||
self.tagMail.set_property('underline', pango.UNDERLINE_SINGLE)
|
self.tagMail.set_property('underline', Pango.Underline.SINGLE)
|
||||||
id_ = self.tagMail.connect('event', self.hyperlink_handler, 'mail')
|
id_ = self.tagMail.connect('event', self.hyperlink_handler, 'mail')
|
||||||
self.handlers[id_] = self.tagMail
|
self.handlers[id_] = self.tagMail
|
||||||
|
|
||||||
self.tagXMPP = buffer_.create_tag('xmpp')
|
self.tagXMPP = buffer_.create_tag('xmpp')
|
||||||
self.tagXMPP.set_property('foreground', color)
|
self.tagXMPP.set_property('foreground', color)
|
||||||
self.tagXMPP.set_property('underline', pango.UNDERLINE_SINGLE)
|
self.tagXMPP.set_property('underline', Pango.Underline.SINGLE)
|
||||||
id_ = self.tagXMPP.connect('event', self.hyperlink_handler, 'xmpp')
|
id_ = self.tagXMPP.connect('event', self.hyperlink_handler, 'xmpp')
|
||||||
self.handlers[id_] = self.tagXMPP
|
self.handlers[id_] = self.tagXMPP
|
||||||
|
|
||||||
self.tagSthAtSth = buffer_.create_tag('sth_at_sth')
|
self.tagSthAtSth = buffer_.create_tag('sth_at_sth')
|
||||||
self.tagSthAtSth.set_property('foreground', color)
|
self.tagSthAtSth.set_property('foreground', color)
|
||||||
self.tagSthAtSth.set_property('underline', pango.UNDERLINE_SINGLE)
|
self.tagSthAtSth.set_property('underline', Pango.Underline.SINGLE)
|
||||||
id_ = self.tagSthAtSth.connect('event', self.hyperlink_handler,
|
id_ = self.tagSthAtSth.connect('event', self.hyperlink_handler,
|
||||||
'sth_at_sth')
|
'sth_at_sth')
|
||||||
self.handlers[id_] = self.tagSthAtSth
|
self.handlers[id_] = self.tagSthAtSth
|
||||||
|
|
||||||
tag = buffer_.create_tag('bold')
|
tag = buffer_.create_tag('bold')
|
||||||
tag.set_property('weight', pango.WEIGHT_BOLD)
|
tag.set_property('weight', Pango.Weight.BOLD)
|
||||||
|
|
||||||
tag = buffer_.create_tag('italic')
|
tag = buffer_.create_tag('italic')
|
||||||
tag.set_property('style', pango.STYLE_ITALIC)
|
tag.set_property('style', Pango.Style.ITALIC)
|
||||||
|
|
||||||
tag = buffer_.create_tag('underline')
|
tag = buffer_.create_tag('underline')
|
||||||
tag.set_property('underline', pango.UNDERLINE_SINGLE)
|
tag.set_property('underline', Pango.Underline.SINGLE)
|
||||||
|
|
||||||
buffer_.create_tag('focus-out-line', justification = gtk.JUSTIFY_CENTER)
|
buffer_.create_tag('focus-out-line', justification = Gtk.Justification.CENTER)
|
||||||
self.displaymarking_tags = {}
|
self.displaymarking_tags = {}
|
||||||
|
|
||||||
tag = buffer_.create_tag('xep0184-warning')
|
tag = buffer_.create_tag('xep0184-warning')
|
||||||
|
@ -378,7 +380,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
if not parent:
|
if not parent:
|
||||||
return False
|
return False
|
||||||
vadj = parent.get_vadjustment()
|
vadj = parent.get_vadjustment()
|
||||||
max_val = vadj.upper - vadj.page_size + 1
|
max_val = vadj.get_upper() - vadj.get_page_size() + 1
|
||||||
cur_val = vadj.get_value()
|
cur_val = vadj.get_value()
|
||||||
# scroll by 1/3rd of remaining distance
|
# scroll by 1/3rd of remaining distance
|
||||||
onethird = cur_val + ((max_val - cur_val) / 3.0)
|
onethird = cur_val + ((max_val - cur_val) / 3.0)
|
||||||
|
@ -392,26 +394,26 @@ class ConversationTextview(gobject.GObject):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def smooth_scroll_timeout(self):
|
def smooth_scroll_timeout(self):
|
||||||
gobject.idle_add(self.do_smooth_scroll_timeout)
|
GObject.idle_add(self.do_smooth_scroll_timeout)
|
||||||
return
|
return
|
||||||
|
|
||||||
def do_smooth_scroll_timeout(self):
|
def do_smooth_scroll_timeout(self):
|
||||||
if not self.smooth_id:
|
if not self.smooth_id:
|
||||||
# we finished scrolling
|
# we finished scrolling
|
||||||
return
|
return
|
||||||
gobject.source_remove(self.smooth_id)
|
GObject.source_remove(self.smooth_id)
|
||||||
self.smooth_id = None
|
self.smooth_id = None
|
||||||
parent = self.tv.get_parent()
|
parent = self.tv.get_parent()
|
||||||
if parent:
|
if parent:
|
||||||
vadj = parent.get_vadjustment()
|
vadj = parent.get_vadjustment()
|
||||||
self.auto_scrolling = True
|
self.auto_scrolling = True
|
||||||
vadj.set_value(vadj.upper - vadj.page_size + 1)
|
vadj.set_value(vadj.get_upper() - vadj.get_page_size() + 1)
|
||||||
self.auto_scrolling = False
|
self.auto_scrolling = False
|
||||||
|
|
||||||
def smooth_scroll_to_end(self):
|
def smooth_scroll_to_end(self):
|
||||||
if None != self.smooth_id: # already scrolling
|
if None != self.smooth_id: # already scrolling
|
||||||
return False
|
return False
|
||||||
self.smooth_id = gobject.timeout_add(self.SCROLL_DELAY,
|
self.smooth_id = GObject.timeout_add(self.SCROLL_DELAY,
|
||||||
self.smooth_scroll)
|
self.smooth_scroll)
|
||||||
self.smooth_scroll_timer = Timer(self.MAX_SCROLL_TIME,
|
self.smooth_scroll_timer = Timer(self.MAX_SCROLL_TIME,
|
||||||
self.smooth_scroll_timeout)
|
self.smooth_scroll_timeout)
|
||||||
|
@ -441,9 +443,9 @@ class ConversationTextview(gobject.GObject):
|
||||||
# scroll only if expected end is not visible
|
# scroll only if expected end is not visible
|
||||||
if end_rect.y >= (visible_rect.y + visible_rect.height + diff_y):
|
if end_rect.y >= (visible_rect.y + visible_rect.height + diff_y):
|
||||||
if use_smooth:
|
if use_smooth:
|
||||||
gobject.idle_add(self.smooth_scroll_to_end)
|
GObject.idle_add(self.smooth_scroll_to_end)
|
||||||
else:
|
else:
|
||||||
gobject.idle_add(self.scroll_to_end_iter)
|
GObject.idle_add(self.scroll_to_end_iter)
|
||||||
|
|
||||||
def scroll_to_end_iter(self):
|
def scroll_to_end_iter(self):
|
||||||
buffer_ = self.tv.get_buffer()
|
buffer_ = self.tv.get_buffer()
|
||||||
|
@ -455,7 +457,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
|
|
||||||
def stop_scrolling(self):
|
def stop_scrolling(self):
|
||||||
if self.smooth_id:
|
if self.smooth_id:
|
||||||
gobject.source_remove(self.smooth_id)
|
GObject.source_remove(self.smooth_id)
|
||||||
self.smooth_id = None
|
self.smooth_id = None
|
||||||
self.smooth_scroll_timer.cancel()
|
self.smooth_scroll_timer.cancel()
|
||||||
|
|
||||||
|
@ -491,7 +493,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
|
|
||||||
self.xep0184_shown[id_] = SHOWN
|
self.xep0184_shown[id_] = SHOWN
|
||||||
return False
|
return False
|
||||||
gobject.timeout_add_seconds(3, show_it)
|
GObject.timeout_add_seconds(3, show_it)
|
||||||
|
|
||||||
buffer_.end_user_action()
|
buffer_.end_user_action()
|
||||||
|
|
||||||
|
@ -583,12 +585,12 @@ class ConversationTextview(gobject.GObject):
|
||||||
if scroll:
|
if scroll:
|
||||||
# scroll to the end (via idle in case the scrollbar has
|
# scroll to the end (via idle in case the scrollbar has
|
||||||
# appeared)
|
# appeared)
|
||||||
gobject.idle_add(self.scroll_to_end)
|
GObject.idle_add(self.scroll_to_end)
|
||||||
|
|
||||||
def show_xep0184_warning_tooltip(self):
|
def show_xep0184_warning_tooltip(self):
|
||||||
pointer = self.tv.get_pointer()
|
pointer = self.tv.get_pointer()
|
||||||
x, y = self.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
|
x, y = self.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
|
||||||
pointer[0], pointer[1])
|
pointer[1], pointer[2])
|
||||||
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
||||||
tag_table = self.tv.get_buffer().get_tag_table()
|
tag_table = self.tv.get_buffer().get_tag_table()
|
||||||
xep0184_warning = False
|
xep0184_warning = False
|
||||||
|
@ -598,16 +600,16 @@ class ConversationTextview(gobject.GObject):
|
||||||
break
|
break
|
||||||
if xep0184_warning and not self.xep0184_warning_tooltip.win:
|
if xep0184_warning and not self.xep0184_warning_tooltip.win:
|
||||||
# check if the current pointer is still over the line
|
# check if the current pointer is still over the line
|
||||||
position = self.tv.window.get_origin()
|
position = self.tv.get_window(Gtk.TextWindowType.TEXT).get_origin()
|
||||||
self.xep0184_warning_tooltip.show_tooltip(_('This icon indicates that '
|
self.xep0184_warning_tooltip.show_tooltip(_('This icon indicates that '
|
||||||
'this message has not yet\nbeen received by the remote end. '
|
'this message has not yet\nbeen received by the remote end. '
|
||||||
"If this icon stays\nfor a long time, it's likely the message got "
|
"If this icon stays\nfor a long time, it's likely the message got "
|
||||||
'lost.'), 8, position[1] + pointer[1])
|
'lost.'), 8, position[1] + pointer[2])
|
||||||
|
|
||||||
def show_line_tooltip(self):
|
def show_line_tooltip(self):
|
||||||
pointer = self.tv.get_pointer()
|
pointer = self.tv.get_pointer()
|
||||||
x, y = self.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
|
x, y = self.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
|
||||||
pointer[0], pointer[1])
|
pointer[0], pointer[2])
|
||||||
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
||||||
tag_table = self.tv.get_buffer().get_tag_table()
|
tag_table = self.tv.get_buffer().get_tag_table()
|
||||||
over_line = False
|
over_line = False
|
||||||
|
@ -617,12 +619,14 @@ class ConversationTextview(gobject.GObject):
|
||||||
break
|
break
|
||||||
if over_line and not self.line_tooltip.win:
|
if over_line and not self.line_tooltip.win:
|
||||||
# check if the current pointer is still over the line
|
# check if the current pointer is still over the line
|
||||||
position = self.tv.window.get_origin()
|
position = self.tv.get_window(Gtk.TextWindowType.TEXT).get_origin()
|
||||||
self.line_tooltip.show_tooltip(_('Text below this line is what has '
|
self.line_tooltip.show_tooltip(_('Text below this line is what has '
|
||||||
'been said since the\nlast time you paid attention to this group '
|
'been said since the\nlast time you paid attention to this group '
|
||||||
'chat'), 8, position[1] + pointer[1])
|
'chat'), 8, position[1] + pointer[2])
|
||||||
|
|
||||||
def on_textview_expose_event(self, widget, event):
|
def on_textview_draw(self, widget, ctx):
|
||||||
|
return
|
||||||
|
#TODO
|
||||||
expalloc = event.area
|
expalloc = event.area
|
||||||
exp_x0 = expalloc.x
|
exp_x0 = expalloc.x
|
||||||
exp_y0 = expalloc.y
|
exp_y0 = expalloc.y
|
||||||
|
@ -652,13 +656,14 @@ class ConversationTextview(gobject.GObject):
|
||||||
"""
|
"""
|
||||||
Change the cursor to a hand when we are over a mail or an url
|
Change the cursor to a hand when we are over a mail or an url
|
||||||
"""
|
"""
|
||||||
pointer_x, pointer_y = self.tv.window.get_pointer()[0:2]
|
pointer_x, pointer_y = self.tv.get_window(Gtk.TextWindowType.TEXT).\
|
||||||
x, y = self.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
|
get_pointer()[1:3]
|
||||||
pointer_x, pointer_y)
|
x, y = self.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
|
||||||
|
pointer_x, pointer_y)
|
||||||
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
||||||
if self.change_cursor:
|
if self.change_cursor:
|
||||||
self.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.XTERM))
|
Gdk.Cursor.new(Gdk.XTERM))
|
||||||
self.change_cursor = False
|
self.change_cursor = False
|
||||||
tag_table = self.tv.get_buffer().get_tag_table()
|
tag_table = self.tv.get_buffer().get_tag_table()
|
||||||
over_line = False
|
over_line = False
|
||||||
|
@ -666,8 +671,8 @@ class ConversationTextview(gobject.GObject):
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag in (tag_table.lookup('url'), tag_table.lookup('mail'), \
|
if tag in (tag_table.lookup('url'), tag_table.lookup('mail'), \
|
||||||
tag_table.lookup('xmpp'), tag_table.lookup('sth_at_sth')):
|
tag_table.lookup('xmpp'), tag_table.lookup('sth_at_sth')):
|
||||||
self.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.HAND2))
|
Gdk.Cursor.new(Gdk.HAND2))
|
||||||
self.change_cursor = True
|
self.change_cursor = True
|
||||||
elif tag == tag_table.lookup('focus-out-line'):
|
elif tag == tag_table.lookup('focus-out-line'):
|
||||||
over_line = True
|
over_line = True
|
||||||
|
@ -683,16 +688,16 @@ class ConversationTextview(gobject.GObject):
|
||||||
if not xep0184_warning:
|
if not xep0184_warning:
|
||||||
self.xep0184_warning_tooltip.hide_tooltip()
|
self.xep0184_warning_tooltip.hide_tooltip()
|
||||||
if over_line and not self.line_tooltip.win:
|
if over_line and not self.line_tooltip.win:
|
||||||
self.line_tooltip.timeout = gobject.timeout_add(500,
|
self.line_tooltip.timeout = GObject.timeout_add(500,
|
||||||
self.show_line_tooltip)
|
self.show_line_tooltip)
|
||||||
self.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
|
Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
|
||||||
self.change_cursor = True
|
self.change_cursor = True
|
||||||
if xep0184_warning and not self.xep0184_warning_tooltip.win:
|
if xep0184_warning and not self.xep0184_warning_tooltip.win:
|
||||||
self.xep0184_warning_tooltip.timeout = gobject.timeout_add(500,
|
self.xep0184_warning_tooltip.timeout = GObject.timeout_add(500,
|
||||||
self.show_xep0184_warning_tooltip)
|
self.show_xep0184_warning_tooltip)
|
||||||
self.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
|
Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
|
||||||
self.change_cursor = True
|
self.change_cursor = True
|
||||||
|
|
||||||
def clear(self, tv = None):
|
def clear(self, tv = None):
|
||||||
|
@ -723,31 +728,31 @@ class ConversationTextview(gobject.GObject):
|
||||||
"""
|
"""
|
||||||
separator_menuitem_was_added = False
|
separator_menuitem_was_added = False
|
||||||
if not self.used_in_history_window:
|
if not self.used_in_history_window:
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
separator_menuitem_was_added = True
|
separator_menuitem_was_added = True
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
|
item = Gtk.ImageMenuItem(Gtk.STOCK_CLEAR)
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
id_ = item.connect('activate', self.clear)
|
id_ = item.connect('activate', self.clear)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
if self.selected_phrase:
|
if self.selected_phrase:
|
||||||
if not separator_menuitem_was_added:
|
if not separator_menuitem_was_added:
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
|
|
||||||
if not self.used_in_history_window:
|
if not self.used_in_history_window:
|
||||||
item = gtk.MenuItem(_('_Quote'))
|
item = Gtk.MenuItem(_('_Quote'))
|
||||||
id_ = item.connect('activate', self.on_quote)
|
id_ = item.connect('activate', self.on_quote)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
|
|
||||||
_selected_phrase = helpers.reduce_chars_newlines(
|
_selected_phrase = helpers.reduce_chars_newlines(
|
||||||
self.selected_phrase, 25, 2)
|
self.selected_phrase, 25, 2)
|
||||||
item = gtk.MenuItem(_('_Actions for "%s"') % _selected_phrase)
|
item = Gtk.MenuItem(_('_Actions for "%s"') % _selected_phrase)
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
submenu = gtk.Menu()
|
submenu = Gtk.Menu()
|
||||||
item.set_submenu(submenu)
|
item.set_submenu(submenu)
|
||||||
phrase_for_url = urllib.quote(self.selected_phrase.encode('utf-8'))
|
phrase_for_url = urllib.quote(self.selected_phrase.encode('utf-8'))
|
||||||
|
|
||||||
|
@ -758,12 +763,12 @@ class ConversationTextview(gobject.GObject):
|
||||||
else:
|
else:
|
||||||
link = 'http://%s.wikipedia.org/wiki/Special:Search?search=%s'\
|
link = 'http://%s.wikipedia.org/wiki/Special:Search?search=%s'\
|
||||||
% (gajim.LANG, phrase_for_url)
|
% (gajim.LANG, phrase_for_url)
|
||||||
item = gtk.MenuItem(_('Read _Wikipedia Article'))
|
item = Gtk.MenuItem(_('Read _Wikipedia Article'))
|
||||||
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
|
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
|
||||||
item = gtk.MenuItem(_('Look it up in _Dictionary'))
|
item = Gtk.MenuItem(_('Look it up in _Dictionary'))
|
||||||
dict_link = gajim.config.get('dictionary_url')
|
dict_link = gajim.config.get('dictionary_url')
|
||||||
if dict_link == 'WIKTIONARY':
|
if dict_link == 'WIKTIONARY':
|
||||||
# special link (yeah undocumented but default)
|
# special link (yeah undocumented but default)
|
||||||
|
@ -779,7 +784,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
else:
|
else:
|
||||||
if dict_link.find('%s') == -1:
|
if dict_link.find('%s') == -1:
|
||||||
# we must have %s in the url if not WIKTIONARY
|
# we must have %s in the url if not WIKTIONARY
|
||||||
item = gtk.MenuItem(_(
|
item = Gtk.MenuItem(_(
|
||||||
'Dictionary URL is missing an "%s" and it is not WIKTIONARY'))
|
'Dictionary URL is missing an "%s" and it is not WIKTIONARY'))
|
||||||
item.set_property('sensitive', False)
|
item.set_property('sensitive', False)
|
||||||
else:
|
else:
|
||||||
|
@ -793,16 +798,16 @@ class ConversationTextview(gobject.GObject):
|
||||||
search_link = gajim.config.get('search_engine')
|
search_link = gajim.config.get('search_engine')
|
||||||
if search_link.find('%s') == -1:
|
if search_link.find('%s') == -1:
|
||||||
# we must have %s in the url
|
# we must have %s in the url
|
||||||
item = gtk.MenuItem(_('Web Search URL is missing an "%s"'))
|
item = Gtk.MenuItem(_('Web Search URL is missing an "%s"'))
|
||||||
item.set_property('sensitive', False)
|
item.set_property('sensitive', False)
|
||||||
else:
|
else:
|
||||||
item = gtk.MenuItem(_('Web _Search for it'))
|
item = Gtk.MenuItem(_('Web _Search for it'))
|
||||||
link = search_link % phrase_for_url
|
link = search_link % phrase_for_url
|
||||||
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
|
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
|
||||||
item = gtk.MenuItem(_('Open as _Link'))
|
item = Gtk.MenuItem(_('Open as _Link'))
|
||||||
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
|
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
@ -820,7 +825,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
if event.button != 3: # if not right click
|
if event.button != 3: # if not right click
|
||||||
return False
|
return False
|
||||||
|
|
||||||
x, y = self.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
|
x, y = self.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
|
||||||
int(event.x), int(event.y))
|
int(event.x), int(event.y))
|
||||||
iter_ = self.tv.get_iter_at_location(x, y)
|
iter_ = self.tv.get_iter_at_location(x, y)
|
||||||
tags = iter_.get_tags()
|
tags = iter_.get_tags()
|
||||||
|
@ -840,7 +845,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
if return_val: # if sth was selected when we right-clicked
|
if return_val: # if sth was selected when we right-clicked
|
||||||
# get the selected text
|
# get the selected text
|
||||||
start_sel, finish_sel = return_val[0], return_val[1]
|
start_sel, finish_sel = return_val[0], return_val[1]
|
||||||
self.selected_phrase = buffer_.get_text(start_sel, finish_sel).decode(
|
self.selected_phrase = buffer_.get_text(start_sel, finish_sel, True).decode(
|
||||||
'utf-8')
|
'utf-8')
|
||||||
elif ord(iter_.get_char()) > 31:
|
elif ord(iter_.get_char()) > 31:
|
||||||
# we clicked on a word, do as if it's selected for context menu
|
# we clicked on a word, do as if it's selected for context menu
|
||||||
|
@ -850,14 +855,14 @@ class ConversationTextview(gobject.GObject):
|
||||||
finish_sel = iter_.copy()
|
finish_sel = iter_.copy()
|
||||||
if not finish_sel.ends_word():
|
if not finish_sel.ends_word():
|
||||||
finish_sel.forward_word_end()
|
finish_sel.forward_word_end()
|
||||||
self.selected_phrase = buffer_.get_text(start_sel, finish_sel).decode(
|
self.selected_phrase = buffer_.get_text(start_sel, finish_sel, True).decode(
|
||||||
'utf-8')
|
'utf-8')
|
||||||
|
|
||||||
def on_open_link_activate(self, widget, kind, text):
|
def on_open_link_activate(self, widget, kind, text):
|
||||||
helpers.launch_browser_mailer(kind, text)
|
helpers.launch_browser_mailer(kind, text)
|
||||||
|
|
||||||
def on_copy_link_activate(self, widget, text):
|
def on_copy_link_activate(self, widget, text):
|
||||||
clip = gtk.clipboard_get()
|
clip = Gtk.clipboard_get()
|
||||||
clip.set_text(text)
|
clip.set_text(text)
|
||||||
|
|
||||||
def on_start_chat_activate(self, widget, jid):
|
def on_start_chat_activate(self, widget, jid):
|
||||||
|
@ -943,7 +948,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
menu.popup(None, None, None, event.button, event.time)
|
menu.popup(None, None, None, event.button, event.time)
|
||||||
|
|
||||||
def hyperlink_handler(self, texttag, widget, event, iter_, kind):
|
def hyperlink_handler(self, texttag, widget, event, iter_, kind):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
begin_iter = iter_.copy()
|
begin_iter = iter_.copy()
|
||||||
# we get the begining of the tag
|
# we get the begining of the tag
|
||||||
while not begin_iter.begins_tag(texttag):
|
while not begin_iter.begins_tag(texttag):
|
||||||
|
@ -964,7 +969,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
# it's a JID or mail
|
# it's a JID or mail
|
||||||
kind = 'sth_at_sth'
|
kind = 'sth_at_sth'
|
||||||
else:
|
else:
|
||||||
word = self.tv.get_buffer().get_text(begin_iter, end_iter).decode(
|
word = self.tv.get_buffer().get_text(begin_iter, end_iter, True).decode(
|
||||||
'utf-8')
|
'utf-8')
|
||||||
|
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
|
@ -997,9 +1002,9 @@ class ConversationTextview(gobject.GObject):
|
||||||
|
|
||||||
insert_tags_func = buffer_.insert_with_tags_by_name
|
insert_tags_func = buffer_.insert_with_tags_by_name
|
||||||
# detect_and_print_special_text() is also used by
|
# detect_and_print_special_text() is also used by
|
||||||
# HtmlHandler.handle_specials() and there tags is gtk.TextTag objects,
|
# HtmlHandler.handle_specials() and there tags is Gtk.TextTag objects,
|
||||||
# not strings
|
# not strings
|
||||||
if other_tags and isinstance(other_tags[0], gtk.TextTag):
|
if other_tags and isinstance(other_tags[0], Gtk.TextTag):
|
||||||
insert_tags_func = buffer_.insert_with_tags
|
insert_tags_func = buffer_.insert_with_tags
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
|
@ -1083,7 +1088,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
img = TextViewImage(anchor, special_text)
|
img = TextViewImage(anchor, special_text)
|
||||||
animations = gajim.interface.emoticons_animations
|
animations = gajim.interface.emoticons_animations
|
||||||
if not emot_ascii in animations:
|
if not emot_ascii in animations:
|
||||||
animations[emot_ascii] = gtk.gdk.PixbufAnimation(
|
animations[emot_ascii] = GdkPixbuf.PixbufAnimation(
|
||||||
gajim.interface.emoticons[emot_ascii])
|
gajim.interface.emoticons[emot_ascii])
|
||||||
img.set_from_animation(animations[emot_ascii])
|
img.set_from_animation(animations[emot_ascii])
|
||||||
img.show()
|
img.show()
|
||||||
|
@ -1152,7 +1157,7 @@ class ConversationTextview(gobject.GObject):
|
||||||
if use_other_tags:
|
if use_other_tags:
|
||||||
end_iter = buffer_.get_end_iter()
|
end_iter = buffer_.get_end_iter()
|
||||||
insert_tags_func = buffer_.insert_with_tags_by_name
|
insert_tags_func = buffer_.insert_with_tags_by_name
|
||||||
if other_tags and isinstance(other_tags[0], gtk.TextTag):
|
if other_tags and isinstance(other_tags[0], Gtk.TextTag):
|
||||||
insert_tags_func = buffer_.insert_with_tags
|
insert_tags_func = buffer_.insert_with_tags
|
||||||
|
|
||||||
insert_tags_func(end_iter, special_text, *other_tags)
|
insert_tags_func(end_iter, special_text, *other_tags)
|
||||||
|
@ -1277,9 +1282,9 @@ class ConversationTextview(gobject.GObject):
|
||||||
# we are at the end or we are sending something
|
# we are at the end or we are sending something
|
||||||
# scroll to the end (via idle in case the scrollbar has appeared)
|
# scroll to the end (via idle in case the scrollbar has appeared)
|
||||||
if gajim.config.get('use_smooth_scrolling'):
|
if gajim.config.get('use_smooth_scrolling'):
|
||||||
gobject.idle_add(self.smooth_scroll_to_end)
|
GObject.idle_add(self.smooth_scroll_to_end)
|
||||||
else:
|
else:
|
||||||
gobject.idle_add(self.scroll_to_end)
|
GObject.idle_add(self.scroll_to_end)
|
||||||
|
|
||||||
self.just_cleared = False
|
self.just_cleared = False
|
||||||
buffer_.end_user_action()
|
buffer_.end_user_action()
|
||||||
|
|
|
@ -25,8 +25,9 @@ Words single and multiple refers here to types of data forms:
|
||||||
single means these with one record of data (without <reported/> element),
|
single means these with one record of data (without <reported/> element),
|
||||||
multiple - these which may contain more data (with <reported/> element).'''
|
multiple - these which may contain more data (with <reported/> element).'''
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GdkPixbuf
|
||||||
|
from gi.repository import GObject
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
|
@ -37,19 +38,19 @@ from common import helpers
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
class DataFormWidget(gtk.Alignment, object):
|
class DataFormWidget(Gtk.Alignment, object):
|
||||||
# "public" interface
|
# "public" interface
|
||||||
"""
|
"""
|
||||||
Data Form widget. Use like any other widget
|
Data Form widget. Use like any other widget
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__gsignals__ = dict(
|
__gsignals__ = dict(
|
||||||
validated = (gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION, None, ())
|
validated = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ())
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dataformnode=None):
|
def __init__(self, dataformnode=None):
|
||||||
''' Create a widget. '''
|
''' Create a widget. '''
|
||||||
gtk.Alignment.__init__(self, xscale=1.0, yscale=1.0)
|
GObject.GObject.__init__(self, xscale=1.0, yscale=1.0)
|
||||||
|
|
||||||
self._data_form = None
|
self._data_form = None
|
||||||
self.selectable = False
|
self.selectable = False
|
||||||
|
@ -71,7 +72,7 @@ class DataFormWidget(gtk.Alignment, object):
|
||||||
|
|
||||||
selection = self.records_treeview.get_selection()
|
selection = self.records_treeview.get_selection()
|
||||||
selection.connect('changed', self.on_records_selection_changed)
|
selection.connect('changed', self.on_records_selection_changed)
|
||||||
selection.set_mode(gtk.SELECTION_MULTIPLE)
|
selection.set_mode(Gtk.SelectionMode.MULTIPLE)
|
||||||
|
|
||||||
def on_data_form_vbox_key_press_event(self, widget, event):
|
def on_data_form_vbox_key_press_event(self, widget, event):
|
||||||
print 'key pressed'
|
print 'key pressed'
|
||||||
|
@ -189,7 +190,7 @@ class DataFormWidget(gtk.Alignment, object):
|
||||||
fieldtypes.append(str)
|
fieldtypes.append(str)
|
||||||
fieldvars.append(field.var)
|
fieldvars.append(field.var)
|
||||||
|
|
||||||
self.multiplemodel = gtk.ListStore(*fieldtypes)
|
self.multiplemodel = Gtk.ListStore(*fieldtypes)
|
||||||
|
|
||||||
# moving all data to model
|
# moving all data to model
|
||||||
for item in self._data_form.iter_records():
|
for item in self._data_form.iter_records():
|
||||||
|
@ -203,7 +204,7 @@ class DataFormWidget(gtk.Alignment, object):
|
||||||
for field, counter in zip(self._data_form.reported.iter_fields(),
|
for field, counter in zip(self._data_form.reported.iter_fields(),
|
||||||
itertools.count()):
|
itertools.count()):
|
||||||
self.records_treeview.append_column(
|
self.records_treeview.append_column(
|
||||||
gtk.TreeViewColumn(field.label, gtk.CellRendererText(),
|
Gtk.TreeViewColumn(field.label, Gtk.CellRendererText(),
|
||||||
text=counter))
|
text=counter))
|
||||||
|
|
||||||
self.records_treeview.set_model(self.multiplemodel)
|
self.records_treeview.set_model(self.multiplemodel)
|
||||||
|
@ -277,7 +278,7 @@ class DataFormWidget(gtk.Alignment, object):
|
||||||
model, rowrefs = selection.get_selected_rows()
|
model, rowrefs = selection.get_selected_rows()
|
||||||
# rowref is a list of paths
|
# rowref is a list of paths
|
||||||
for i in xrange(len(rowrefs)):
|
for i in xrange(len(rowrefs)):
|
||||||
rowrefs[i] = gtk.TreeRowReference(model, rowrefs[i])
|
rowrefs[i] = Gtk.TreeRowReference(model, rowrefs[i])
|
||||||
# rowref is a list of row references; need to convert because we will
|
# rowref is a list of row references; need to convert because we will
|
||||||
# modify the model, paths would change
|
# modify the model, paths would change
|
||||||
for rowref in rowrefs:
|
for rowref in rowrefs:
|
||||||
|
@ -305,7 +306,7 @@ class DataFormWidget(gtk.Alignment, object):
|
||||||
def on_records_selection_changed(self, widget):
|
def on_records_selection_changed(self, widget):
|
||||||
self.refresh_multiple_buttons()
|
self.refresh_multiple_buttons()
|
||||||
|
|
||||||
class SingleForm(gtk.Table, object):
|
class SingleForm(Gtk.Table, object):
|
||||||
"""
|
"""
|
||||||
Widget that represent DATAFORM_SINGLE mode form. Because this is used not
|
Widget that represent DATAFORM_SINGLE mode form. Because this is used not
|
||||||
only to display single forms, but to form input windows of multiple-type
|
only to display single forms, but to form input windows of multiple-type
|
||||||
|
@ -313,13 +314,13 @@ class SingleForm(gtk.Table, object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__gsignals__ = dict(
|
__gsignals__ = dict(
|
||||||
validated = (gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION, None, ())
|
validated = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ())
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dataform, selectable=False):
|
def __init__(self, dataform, selectable=False):
|
||||||
assert isinstance(dataform, dataforms.SimpleDataForm)
|
assert isinstance(dataform, dataforms.SimpleDataForm)
|
||||||
|
|
||||||
gtk.Table.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self.set_col_spacings(12)
|
self.set_col_spacings(12)
|
||||||
self.set_row_spacings(6)
|
self.set_row_spacings(6)
|
||||||
|
|
||||||
|
@ -330,8 +331,8 @@ class SingleForm(gtk.Table, object):
|
||||||
widget
|
widget
|
||||||
"""
|
"""
|
||||||
if field.description != '':
|
if field.description != '':
|
||||||
if widget.flags() & gtk.NO_WINDOW:
|
if widget.flags() & Gtk.NO_WINDOW:
|
||||||
evbox = gtk.EventBox()
|
evbox = Gtk.EventBox()
|
||||||
evbox.add(widget)
|
evbox.add(widget)
|
||||||
widget = evbox
|
widget = evbox
|
||||||
widget.set_tooltip_text(field.description)
|
widget.set_tooltip_text(field.description)
|
||||||
|
@ -356,7 +357,7 @@ class SingleForm(gtk.Table, object):
|
||||||
|
|
||||||
if field.type_ == 'boolean':
|
if field.type_ == 'boolean':
|
||||||
commonlabelcenter = True
|
commonlabelcenter = True
|
||||||
widget = gtk.CheckButton()
|
widget = Gtk.CheckButton()
|
||||||
widget.connect('toggled', self.on_boolean_checkbutton_toggled,
|
widget.connect('toggled', self.on_boolean_checkbutton_toggled,
|
||||||
field)
|
field)
|
||||||
widget.set_active(field.value)
|
widget.set_active(field.value)
|
||||||
|
@ -369,23 +370,23 @@ class SingleForm(gtk.Table, object):
|
||||||
leftattach = 0
|
leftattach = 0
|
||||||
|
|
||||||
commonwidget = False
|
commonwidget = False
|
||||||
widget = gtk.Label(field.value)
|
widget = Gtk.Label(label=field.value)
|
||||||
widget.set_property('selectable', selectable)
|
widget.set_property('selectable', selectable)
|
||||||
widget.set_line_wrap(True)
|
widget.set_line_wrap(True)
|
||||||
self.attach(widget, leftattach, rightattach, linecounter,
|
self.attach(widget, leftattach, rightattach, linecounter,
|
||||||
linecounter+1, xoptions=gtk.FILL, yoptions=gtk.FILL)
|
linecounter+1, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL)
|
||||||
|
|
||||||
elif field.type_ == 'list-single':
|
elif field.type_ == 'list-single':
|
||||||
# TODO: What if we have radio buttons and non-required field?
|
# TODO: What if we have radio buttons and non-required field?
|
||||||
# TODO: We cannot deactivate them all...
|
# TODO: We cannot deactivate them all...
|
||||||
if len(field.options) < 6:
|
if len(field.options) < 6:
|
||||||
# 5 option max: show radiobutton
|
# 5 option max: show radiobutton
|
||||||
widget = gtk.VBox()
|
widget = Gtk.VBox()
|
||||||
first_radio = None
|
first_radio = None
|
||||||
for value, label in field.iter_options():
|
for value, label in field.iter_options():
|
||||||
if not label:
|
if not label:
|
||||||
label = value
|
label = value
|
||||||
radio = gtk.RadioButton(first_radio, label=label)
|
radio = Gtk.RadioButton(first_radio, label=label)
|
||||||
radio.connect('toggled',
|
radio.connect('toggled',
|
||||||
self.on_list_single_radiobutton_toggled, field, value)
|
self.on_list_single_radiobutton_toggled, field, value)
|
||||||
if first_radio is None:
|
if first_radio is None:
|
||||||
|
@ -394,7 +395,7 @@ class SingleForm(gtk.Table, object):
|
||||||
field.value = value
|
field.value = value
|
||||||
if value == field.value:
|
if value == field.value:
|
||||||
radio.set_active(True)
|
radio.set_active(True)
|
||||||
widget.pack_start(radio, expand=False)
|
widget.pack_start(radio, False, True, 0)
|
||||||
else:
|
else:
|
||||||
# more than 5 options: show combobox
|
# more than 5 options: show combobox
|
||||||
def on_list_single_combobox_changed(combobox, f):
|
def on_list_single_combobox_changed(combobox, f):
|
||||||
|
@ -413,13 +414,13 @@ class SingleForm(gtk.Table, object):
|
||||||
# TODO: When more than few choices, make a list
|
# TODO: When more than few choices, make a list
|
||||||
if len(field.options) < 6:
|
if len(field.options) < 6:
|
||||||
# 5 option max: show checkbutton
|
# 5 option max: show checkbutton
|
||||||
widget = gtk.VBox()
|
widget = Gtk.VBox()
|
||||||
for value, label in field.iter_options():
|
for value, label in field.iter_options():
|
||||||
check = gtk.CheckButton(label, use_underline=False)
|
check = Gtk.CheckButton(label, use_underline=False)
|
||||||
check.set_active(value in field.values)
|
check.set_active(value in field.values)
|
||||||
check.connect('toggled',
|
check.connect('toggled',
|
||||||
self.on_list_multi_checkbutton_toggled, field, value)
|
self.on_list_multi_checkbutton_toggled, field, value)
|
||||||
widget.pack_start(check, expand=False)
|
widget.pack_start(check, False, True, 0)
|
||||||
widget.set_sensitive(readwrite)
|
widget.set_sensitive(readwrite)
|
||||||
else:
|
else:
|
||||||
# more than 5 options: show combobox
|
# more than 5 options: show combobox
|
||||||
|
@ -429,8 +430,8 @@ class SingleForm(gtk.Table, object):
|
||||||
vals = []
|
vals = []
|
||||||
selection.selected_foreach(for_selected)
|
selection.selected_foreach(for_selected)
|
||||||
field.values = vals[:]
|
field.values = vals[:]
|
||||||
widget = gtk.ScrolledWindow()
|
widget = Gtk.ScrolledWindow()
|
||||||
widget.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
widget.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
tv = gtkgui_helpers.create_list_multi(field.options,
|
tv = gtkgui_helpers.create_list_multi(field.options,
|
||||||
field.values)
|
field.values)
|
||||||
widget.add(tv)
|
widget.add(tv)
|
||||||
|
@ -440,7 +441,7 @@ class SingleForm(gtk.Table, object):
|
||||||
tv.set_sensitive(readwrite)
|
tv.set_sensitive(readwrite)
|
||||||
|
|
||||||
elif field.type_ == 'jid-single':
|
elif field.type_ == 'jid-single':
|
||||||
widget = gtk.Entry()
|
widget = Gtk.Entry()
|
||||||
widget.connect('changed', self.on_text_single_entry_changed, field)
|
widget.connect('changed', self.on_text_single_entry_changed, field)
|
||||||
widget.set_text(field.value)
|
widget.set_text(field.value)
|
||||||
|
|
||||||
|
@ -452,20 +453,20 @@ class SingleForm(gtk.Table, object):
|
||||||
widget = xml.get_object('multiple_form_hbox')
|
widget = xml.get_object('multiple_form_hbox')
|
||||||
treeview = xml.get_object('records_treeview')
|
treeview = xml.get_object('records_treeview')
|
||||||
|
|
||||||
listmodel = gtk.ListStore(str)
|
listmodel = Gtk.ListStore(str)
|
||||||
for value in field.iter_values():
|
for value in field.iter_values():
|
||||||
# nobody will create several megabytes long stanza
|
# nobody will create several megabytes long stanza
|
||||||
listmodel.insert(999999, (value,))
|
listmodel.insert(999999, (value,))
|
||||||
|
|
||||||
treeview.set_model(listmodel)
|
treeview.set_model(listmodel)
|
||||||
|
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
renderer.set_property('editable', True)
|
renderer.set_property('editable', True)
|
||||||
renderer.connect('edited',
|
renderer.connect('edited',
|
||||||
self.on_jid_multi_cellrenderertext_edited, treeview, listmodel,
|
self.on_jid_multi_cellrenderertext_edited, treeview, listmodel,
|
||||||
field)
|
field)
|
||||||
|
|
||||||
treeview.append_column(gtk.TreeViewColumn(None, renderer,
|
treeview.append_column(Gtk.TreeViewColumn(None, renderer,
|
||||||
text=0))
|
text=0))
|
||||||
|
|
||||||
decorate_with_tooltip(treeview, field)
|
decorate_with_tooltip(treeview, field)
|
||||||
|
@ -495,7 +496,7 @@ class SingleForm(gtk.Table, object):
|
||||||
|
|
||||||
elif field.type_ == 'text-private':
|
elif field.type_ == 'text-private':
|
||||||
commonlabelcenter = True
|
commonlabelcenter = True
|
||||||
widget = gtk.Entry()
|
widget = Gtk.Entry()
|
||||||
widget.connect('changed', self.on_text_single_entry_changed, field)
|
widget.connect('changed', self.on_text_single_entry_changed, field)
|
||||||
widget.set_visibility(False)
|
widget.set_visibility(False)
|
||||||
widget.set_text(field.value)
|
widget.set_text(field.value)
|
||||||
|
@ -504,8 +505,8 @@ class SingleForm(gtk.Table, object):
|
||||||
# TODO: bigger text view
|
# TODO: bigger text view
|
||||||
commonwidget = False
|
commonwidget = False
|
||||||
|
|
||||||
textwidget = gtk.TextView()
|
textwidget = Gtk.TextView()
|
||||||
textwidget.set_wrap_mode(gtk.WRAP_WORD)
|
textwidget.set_wrap_mode(Gtk.WrapMode.WORD)
|
||||||
textwidget.get_buffer().connect('changed',
|
textwidget.get_buffer().connect('changed',
|
||||||
self.on_text_multi_textbuffer_changed, field)
|
self.on_text_multi_textbuffer_changed, field)
|
||||||
textwidget.get_buffer().set_text(field.value)
|
textwidget.get_buffer().set_text(field.value)
|
||||||
|
@ -517,7 +518,7 @@ class SingleForm(gtk.Table, object):
|
||||||
else:
|
else:
|
||||||
textwidget.set_sensitive(False)
|
textwidget.set_sensitive(False)
|
||||||
|
|
||||||
widget = gtk.ScrolledWindow()
|
widget = Gtk.ScrolledWindow()
|
||||||
widget.add(textwidget)
|
widget.add(textwidget)
|
||||||
|
|
||||||
widget=decorate_with_tooltip(widget, field)
|
widget=decorate_with_tooltip(widget, field)
|
||||||
|
@ -529,10 +530,10 @@ class SingleForm(gtk.Table, object):
|
||||||
# should handle it as text-single
|
# should handle it as text-single
|
||||||
commonlabelcenter = True
|
commonlabelcenter = True
|
||||||
if readwrite:
|
if readwrite:
|
||||||
widget = gtk.Entry()
|
widget = Gtk.Entry()
|
||||||
def kpe(widget, event):
|
def kpe(widget, event):
|
||||||
if event.keyval == gtk.keysyms.Return or \
|
if event.keyval == Gdk.KEY_Return or \
|
||||||
event.keyval == gtk.keysyms.KP_Enter:
|
event.keyval == Gdk.KEY_KP_Enter:
|
||||||
self.emit('validated')
|
self.emit('validated')
|
||||||
widget.connect('key-press-event', kpe)
|
widget.connect('key-press-event', kpe)
|
||||||
widget.connect('changed', self.on_text_single_entry_changed,
|
widget.connect('changed', self.on_text_single_entry_changed,
|
||||||
|
@ -543,52 +544,52 @@ class SingleForm(gtk.Table, object):
|
||||||
widget.set_text(field.value)
|
widget.set_text(field.value)
|
||||||
else:
|
else:
|
||||||
commonwidget=False
|
commonwidget=False
|
||||||
widget = gtk.Label(field.value)
|
widget = Gtk.Label(label=field.value)
|
||||||
widget.set_property('selectable', selectable)
|
widget.set_property('selectable', selectable)
|
||||||
widget.set_sensitive(True)
|
widget.set_sensitive(True)
|
||||||
widget.set_alignment(0.0, 0.5)
|
widget.set_alignment(0.0, 0.5)
|
||||||
widget=decorate_with_tooltip(widget, field)
|
widget=decorate_with_tooltip(widget, field)
|
||||||
self.attach(widget, 1, 2, linecounter, linecounter+1,
|
self.attach(widget, 1, 2, linecounter, linecounter+1,
|
||||||
yoptions=gtk.FILL)
|
yoptions=Gtk.AttachOptions.FILL)
|
||||||
|
|
||||||
if commonlabel and field.label is not None:
|
if commonlabel and field.label is not None:
|
||||||
label = gtk.Label(field.label)
|
label = Gtk.Label(label=field.label)
|
||||||
if commonlabelcenter:
|
if commonlabelcenter:
|
||||||
label.set_alignment(0.0, 0.5)
|
label.set_alignment(0.0, 0.5)
|
||||||
else:
|
else:
|
||||||
label.set_alignment(0.0, 0.0)
|
label.set_alignment(0.0, 0.0)
|
||||||
label = decorate_with_tooltip(label, field)
|
label = decorate_with_tooltip(label, field)
|
||||||
self.attach(label, 0, 1, linecounter, linecounter+1,
|
self.attach(label, 0, 1, linecounter, linecounter+1,
|
||||||
xoptions=gtk.FILL, yoptions=gtk.FILL)
|
xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL)
|
||||||
|
|
||||||
if field.media is not None:
|
if field.media is not None:
|
||||||
for uri in field.media.uris:
|
for uri in field.media.uris:
|
||||||
if uri.type_.startswith('image/'):
|
if uri.type_.startswith('image/'):
|
||||||
try:
|
try:
|
||||||
img_data = base64.decodestring(uri.uri_data)
|
img_data = base64.decodestring(uri.uri_data)
|
||||||
pixbuf_l = gtk.gdk.PixbufLoader()
|
pixbuf_l = GdkPixbuf.PixbufLoader()
|
||||||
pixbuf_l.write(img_data)
|
pixbuf_l.write(img_data)
|
||||||
pixbuf_l.close()
|
pixbuf_l.close()
|
||||||
media = gtk.image_new_from_pixbuf(pixbuf_l.\
|
media = Gtk.image_new_from_pixbuf(pixbuf_l.\
|
||||||
get_pixbuf())
|
get_pixbuf())
|
||||||
except Exception:
|
except Exception:
|
||||||
media = gtk.Label(_('Unable to load image'))
|
media = Gtk.Label(label=_('Unable to load image'))
|
||||||
else:
|
else:
|
||||||
media = gtk.Label(_('Media type not supported: %s') % \
|
media = Gtk.Label(label=_('Media type not supported: %s') % \
|
||||||
uri.type_)
|
uri.type_)
|
||||||
linecounter += 1
|
linecounter += 1
|
||||||
self.attach(media, 0, 1, linecounter, linecounter+1,
|
self.attach(media, 0, 1, linecounter, linecounter+1,
|
||||||
xoptions=gtk.FILL, yoptions=gtk.FILL)
|
xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL)
|
||||||
|
|
||||||
if commonwidget:
|
if commonwidget:
|
||||||
assert widget is not None
|
assert widget is not None
|
||||||
widget.set_sensitive(readwrite)
|
widget.set_sensitive(readwrite)
|
||||||
widget = decorate_with_tooltip(widget, field)
|
widget = decorate_with_tooltip(widget, field)
|
||||||
self.attach(widget, 1, 2, linecounter, linecounter+1,
|
self.attach(widget, 1, 2, linecounter, linecounter+1,
|
||||||
yoptions=gtk.FILL)
|
yoptions=Gtk.AttachOptions.FILL)
|
||||||
|
|
||||||
if field.required:
|
if field.required:
|
||||||
label = gtk.Label('*')
|
label = Gtk.Label(label='*')
|
||||||
label.set_tooltip_text(_('This field is required'))
|
label.set_tooltip_text(_('This field is required'))
|
||||||
self.attach(label, 2, 3, linecounter, linecounter+1, xoptions=0,
|
self.attach(label, 2, 3, linecounter, linecounter+1, xoptions=0,
|
||||||
yoptions=0)
|
yoptions=0)
|
||||||
|
@ -618,9 +619,8 @@ class SingleForm(gtk.Table, object):
|
||||||
field.value = widget.get_text()
|
field.value = widget.get_text()
|
||||||
|
|
||||||
def on_text_multi_textbuffer_changed(self, widget, field):
|
def on_text_multi_textbuffer_changed(self, widget, field):
|
||||||
field.value = widget.get_text(
|
field.value = widget.get_text(widget.get_start_iter(),
|
||||||
widget.get_start_iter(),
|
widget.get_end_iter(), True)
|
||||||
widget.get_end_iter())
|
|
||||||
|
|
||||||
def on_jid_multi_cellrenderertext_edited(self, cell, path, newtext, treeview,
|
def on_jid_multi_cellrenderertext_edited(self, cell, path, newtext, treeview,
|
||||||
model, field):
|
model, field):
|
||||||
|
@ -636,7 +636,7 @@ class SingleForm(gtk.Table, object):
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_('Jabber ID already in list'),
|
_('Jabber ID already in list'),
|
||||||
_('The Jabber ID you entered is already in the list. Choose another one.'))
|
_('The Jabber ID you entered is already in the list. Choose another one.'))
|
||||||
gobject.idle_add(treeview.set_cursor, path)
|
GObject.idle_add(treeview.set_cursor, path)
|
||||||
return
|
return
|
||||||
model[path][0]=newtext
|
model[path][0]=newtext
|
||||||
|
|
||||||
|
|
479
src/dialogs.py
479
src/dialogs.py
File diff suppressed because it is too large
Load Diff
217
src/disco.py
217
src/disco.py
|
@ -47,9 +47,10 @@
|
||||||
import os
|
import os
|
||||||
import types
|
import types
|
||||||
import weakref
|
import weakref
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import GdkPixbuf
|
||||||
|
from gi.repository import Pango
|
||||||
|
|
||||||
import dialogs
|
import dialogs
|
||||||
import tooltips
|
import tooltips
|
||||||
|
@ -151,7 +152,7 @@ class CacheDictionary:
|
||||||
for key in self.cache.keys():
|
for key in self.cache.keys():
|
||||||
item = self.cache[key]
|
item = self.cache[key]
|
||||||
if item.source:
|
if item.source:
|
||||||
gobject.source_remove(item.source)
|
GObject.source_remove(item.source)
|
||||||
del self.cache[key]
|
del self.cache[key]
|
||||||
|
|
||||||
def _expire_timeout(self, key):
|
def _expire_timeout(self, key):
|
||||||
|
@ -168,9 +169,9 @@ class CacheDictionary:
|
||||||
"""
|
"""
|
||||||
item = self.cache[key]
|
item = self.cache[key]
|
||||||
if item.source:
|
if item.source:
|
||||||
gobject.source_remove(item.source)
|
GObject.source_remove(item.source)
|
||||||
if self.lifetime:
|
if self.lifetime:
|
||||||
source = gobject.timeout_add_seconds(self.lifetime/1000, self._expire_timeout, key)
|
source = GObject.timeout_add_seconds(self.lifetime/1000, self._expire_timeout, key)
|
||||||
item.source = source
|
item.source = source
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
|
@ -187,7 +188,7 @@ class CacheDictionary:
|
||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
item = self.cache[key]
|
item = self.cache[key]
|
||||||
if item.source:
|
if item.source:
|
||||||
gobject.source_remove(item.source)
|
GObject.source_remove(item.source)
|
||||||
del self.cache[key]
|
del self.cache[key]
|
||||||
|
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
|
@ -549,7 +550,7 @@ _('Without a connection, you can not browse available services'))
|
||||||
if address_entry:
|
if address_entry:
|
||||||
self.address_comboboxentry = self.xml.get_object(
|
self.address_comboboxentry = self.xml.get_object(
|
||||||
'address_comboboxentry')
|
'address_comboboxentry')
|
||||||
self.address_comboboxentry_entry = self.address_comboboxentry.child
|
self.address_comboboxentry_entry = self.address_comboboxentry.get_child()
|
||||||
self.address_comboboxentry_entry.set_activates_default(True)
|
self.address_comboboxentry_entry.set_activates_default(True)
|
||||||
|
|
||||||
self.latest_addresses = gajim.config.get(
|
self.latest_addresses = gajim.config.get(
|
||||||
|
@ -561,15 +562,15 @@ _('Without a connection, you can not browse available services'))
|
||||||
self.latest_addresses = self.latest_addresses[0:10]
|
self.latest_addresses = self.latest_addresses[0:10]
|
||||||
for j in self.latest_addresses:
|
for j in self.latest_addresses:
|
||||||
self.address_comboboxentry.append_text(j)
|
self.address_comboboxentry.append_text(j)
|
||||||
self.address_comboboxentry.child.set_text(jid)
|
self.address_comboboxentry.get_child().set_text(jid)
|
||||||
else:
|
else:
|
||||||
# Don't show it at all if we didn't ask for it
|
# Don't show it at all if we didn't ask for it
|
||||||
address_table.set_no_show_all(True)
|
address_table.set_no_show_all(True)
|
||||||
address_table.hide()
|
address_table.hide()
|
||||||
|
|
||||||
accel_group = gtk.AccelGroup()
|
accel_group = Gtk.AccelGroup()
|
||||||
keyval, mod = gtk.accelerator_parse('<Control>r')
|
keyval, mod = Gtk.accelerator_parse('<Control>r')
|
||||||
accel_group.connect_group(keyval, mod, gtk.ACCEL_VISIBLE,
|
accel_group.connect(keyval, mod, Gtk.AccelFlags.VISIBLE,
|
||||||
self.accel_group_func)
|
self.accel_group_func)
|
||||||
self.window.add_accel_group(accel_group)
|
self.window.add_accel_group(accel_group)
|
||||||
|
|
||||||
|
@ -590,7 +591,7 @@ _('Without a connection, you can not browse available services'))
|
||||||
self.browser.account = value
|
self.browser.account = value
|
||||||
|
|
||||||
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
||||||
if (modifier & gtk.gdk.CONTROL_MASK) and (keyval == gtk.keysyms.r):
|
if (modifier & Gdk.ModifierType.CONTROL_MASK) and (keyval == Gdk.KEY_r):
|
||||||
self.reload()
|
self.reload()
|
||||||
|
|
||||||
def _initial_state(self):
|
def _initial_state(self):
|
||||||
|
@ -612,15 +613,15 @@ _('Without a connection, you can not browse available services'))
|
||||||
'bannerfontattrs')
|
'bannerfontattrs')
|
||||||
|
|
||||||
if bannerfont:
|
if bannerfont:
|
||||||
font = pango.FontDescription(bannerfont)
|
font = Pango.FontDescription(bannerfont)
|
||||||
else:
|
else:
|
||||||
font = pango.FontDescription('Normal')
|
font = Pango.FontDescription('Normal')
|
||||||
if bannerfontattrs:
|
if bannerfontattrs:
|
||||||
# B is attribute set by default
|
# B is attribute set by default
|
||||||
if 'B' in bannerfontattrs:
|
if 'B' in bannerfontattrs:
|
||||||
font.set_weight(pango.WEIGHT_HEAVY)
|
font.set_weight(Pango.Weight.HEAVY)
|
||||||
if 'I' in bannerfontattrs:
|
if 'I' in bannerfontattrs:
|
||||||
font.set_style(pango.STYLE_ITALIC)
|
font.set_style(Pango.Style.ITALIC)
|
||||||
|
|
||||||
font_attrs = 'font_desc="%s"' % font.to_string()
|
font_attrs = 'font_desc="%s"' % font.to_string()
|
||||||
font_size = font.get_size()
|
font_size = font.get_size()
|
||||||
|
@ -630,7 +631,7 @@ _('Without a connection, you can not browse available services'))
|
||||||
font_attrs = '%s size="large"' % font_attrs
|
font_attrs = '%s size="large"' % font_attrs
|
||||||
markup = '<span %s>%s</span>' % (font_attrs, text)
|
markup = '<span %s>%s</span>' % (font_attrs, text)
|
||||||
if text_after:
|
if text_after:
|
||||||
font.set_weight(pango.WEIGHT_NORMAL)
|
font.set_weight(Pango.Weight.NORMAL)
|
||||||
markup = '%s\n<span font_desc="%s" size="small">%s</span>' % \
|
markup = '%s\n<span font_desc="%s" size="small">%s</span>' % \
|
||||||
(markup, font.to_string(), text_after)
|
(markup, font.to_string(), text_after)
|
||||||
self.banner.set_markup(markup)
|
self.banner.set_markup(markup)
|
||||||
|
@ -644,15 +645,15 @@ _('Without a connection, you can not browse available services'))
|
||||||
textcolor = gajim.config.get_per('themes', theme, 'bannertextcolor')
|
textcolor = gajim.config.get_per('themes', theme, 'bannertextcolor')
|
||||||
self.disconnect_style_event()
|
self.disconnect_style_event()
|
||||||
if bgcolor:
|
if bgcolor:
|
||||||
color = gtk.gdk.color_parse(bgcolor)
|
color = Gdk.color_parse(bgcolor)
|
||||||
self.banner_eventbox.modify_bg(gtk.STATE_NORMAL, color)
|
self.banner_eventbox.modify_bg(Gtk.StateType.NORMAL, color)
|
||||||
default_bg = False
|
default_bg = False
|
||||||
else:
|
else:
|
||||||
default_bg = True
|
default_bg = True
|
||||||
|
|
||||||
if textcolor:
|
if textcolor:
|
||||||
color = gtk.gdk.color_parse(textcolor)
|
color = Gdk.color_parse(textcolor)
|
||||||
self.banner.modify_fg(gtk.STATE_NORMAL, color)
|
self.banner.modify_fg(Gtk.StateType.NORMAL, color)
|
||||||
default_fg = False
|
default_fg = False
|
||||||
else:
|
else:
|
||||||
default_fg = True
|
default_fg = True
|
||||||
|
@ -679,11 +680,11 @@ _('Without a connection, you can not browse available services'))
|
||||||
"""
|
"""
|
||||||
self.disconnect_style_event()
|
self.disconnect_style_event()
|
||||||
if opts[1]:
|
if opts[1]:
|
||||||
bg_color = widget.style.bg[gtk.STATE_SELECTED]
|
bg_color = widget.get_style().bg[Gtk.StateType.SELECTED]
|
||||||
self.banner_eventbox.modify_bg(gtk.STATE_NORMAL, bg_color)
|
self.banner_eventbox.modify_bg(Gtk.StateType.NORMAL, bg_color)
|
||||||
if opts[0]:
|
if opts[0]:
|
||||||
fg_color = widget.style.fg[gtk.STATE_SELECTED]
|
fg_color = widget.get_style().fg[Gtk.StateType.SELECTED]
|
||||||
self.banner.modify_fg(gtk.STATE_NORMAL, fg_color)
|
self.banner.modify_fg(Gtk.StateType.NORMAL, fg_color)
|
||||||
self.banner.ensure_style()
|
self.banner.ensure_style()
|
||||||
self.connect_style_event(opts[0], opts[1])
|
self.connect_style_event(opts[0], opts[1])
|
||||||
|
|
||||||
|
@ -799,7 +800,7 @@ _('This type of service does not contain any items to browse.'))
|
||||||
def on_address_comboboxentry_changed(self, widget):
|
def on_address_comboboxentry_changed(self, widget):
|
||||||
if self.address_comboboxentry.get_active() != -1:
|
if self.address_comboboxentry.get_active() != -1:
|
||||||
# user selected one of the entries so do auto-visit
|
# user selected one of the entries so do auto-visit
|
||||||
jid = self.address_comboboxentry.child.get_text().decode('utf-8')
|
jid = self.address_comboboxentry.get_child().get_text().decode('utf-8')
|
||||||
try:
|
try:
|
||||||
jid = helpers.parse_jid(jid)
|
jid = helpers.parse_jid(jid)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
|
@ -809,7 +810,7 @@ _('This type of service does not contain any items to browse.'))
|
||||||
self.travel(jid, '')
|
self.travel(jid, '')
|
||||||
|
|
||||||
def on_go_button_clicked(self, widget):
|
def on_go_button_clicked(self, widget):
|
||||||
jid = self.address_comboboxentry.child.get_text().decode('utf-8')
|
jid = self.address_comboboxentry.get_child().get_text().decode('utf-8')
|
||||||
try:
|
try:
|
||||||
jid = helpers.parse_jid(jid)
|
jid = helpers.parse_jid(jid)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
|
@ -878,20 +879,20 @@ class AgentBrowser:
|
||||||
the JID and node of the item respectively
|
the JID and node of the item respectively
|
||||||
"""
|
"""
|
||||||
# JID, node, name, address
|
# JID, node, name, address
|
||||||
self.model = gtk.ListStore(str, str, str, str)
|
self.model = Gtk.ListStore(str, str, str, str)
|
||||||
self.model.set_sort_column_id(3, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(3, Gtk.SortType.ASCENDING)
|
||||||
self.window.services_treeview.set_model(self.model)
|
self.window.services_treeview.set_model(self.model)
|
||||||
# Name column
|
# Name column
|
||||||
col = gtk.TreeViewColumn(_('Name'))
|
col = Gtk.TreeViewColumn(_('Name'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 2)
|
col.set_attributes(renderer, text = 2)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
# Address column
|
# Address column
|
||||||
col = gtk.TreeViewColumn(_('JID'))
|
col = Gtk.TreeViewColumn(_('JID'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 3)
|
col.set_attributes(renderer, text = 3)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
@ -908,11 +909,11 @@ class AgentBrowser:
|
||||||
Add the action buttons to the buttonbox for actions the browser can
|
Add the action buttons to the buttonbox for actions the browser can
|
||||||
perform
|
perform
|
||||||
"""
|
"""
|
||||||
self.browse_button = gtk.Button()
|
self.browse_button = Gtk.Button()
|
||||||
image = gtk.image_new_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
|
image = Gtk.Image.new_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
|
||||||
label = gtk.Label(_('_Browse'))
|
label = Gtk.Label(label=_('_Browse'))
|
||||||
label.set_use_underline(True)
|
label.set_use_underline(True)
|
||||||
hbox = gtk.HBox()
|
hbox = Gtk.HBox()
|
||||||
hbox.pack_start(image, False, True, 6)
|
hbox.pack_start(image, False, True, 6)
|
||||||
hbox.pack_end(label, True, True)
|
hbox.pack_end(label, True, True)
|
||||||
self.browse_button.add(hbox)
|
self.browse_button.add(hbox)
|
||||||
|
@ -963,7 +964,7 @@ class AgentBrowser:
|
||||||
# or pack_end, so we repack the close button here to make sure it's last
|
# or pack_end, so we repack the close button here to make sure it's last
|
||||||
close_button = self.window.xml.get_object('close_button')
|
close_button = self.window.xml.get_object('close_button')
|
||||||
self.window.action_buttonbox.remove(close_button)
|
self.window.action_buttonbox.remove(close_button)
|
||||||
self.window.action_buttonbox.pack_end(close_button)
|
self.window.action_buttonbox.pack_end(close_button, True, True, 0)
|
||||||
close_button.show_all()
|
close_button.show_all()
|
||||||
|
|
||||||
self.update_actions()
|
self.update_actions()
|
||||||
|
@ -1056,7 +1057,7 @@ class AgentBrowser:
|
||||||
self.model.clear()
|
self.model.clear()
|
||||||
self._total_items = self._progress = 0
|
self._total_items = self._progress = 0
|
||||||
self.window.progressbar.show()
|
self.window.progressbar.show()
|
||||||
self._pulse_timeout = gobject.timeout_add(250, self._pulse_timeout_cb)
|
self._pulse_timeout = GObject.timeout_add(250, self._pulse_timeout_cb)
|
||||||
self.cache.get_items(self.jid, self.node, self._agent_items,
|
self.cache.get_items(self.jid, self.node, self._agent_items,
|
||||||
force=force, args=(force,))
|
force=force, args=(force,))
|
||||||
|
|
||||||
|
@ -1074,7 +1075,7 @@ class AgentBrowser:
|
||||||
Check if an item is already in the treeview. Return an iter to it if so,
|
Check if an item is already in the treeview. Return an iter to it if so,
|
||||||
None otherwise
|
None otherwise
|
||||||
"""
|
"""
|
||||||
iter_ = self.model.get_iter_root()
|
iter_ = self.model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
cjid = self.model.get_value(iter_, 0).decode('utf-8')
|
cjid = self.model.get_value(iter_, 0).decode('utf-8')
|
||||||
cnode = self.model.get_value(iter_, 1).decode('utf-8')
|
cnode = self.model.get_value(iter_, 1).decode('utf-8')
|
||||||
|
@ -1091,7 +1092,7 @@ class AgentBrowser:
|
||||||
"""
|
"""
|
||||||
self.model.clear()
|
self.model.clear()
|
||||||
self._total_items = 0
|
self._total_items = 0
|
||||||
gobject.source_remove(self._pulse_timeout)
|
GObject.source_remove(self._pulse_timeout)
|
||||||
self.window.progressbar.hide()
|
self.window.progressbar.hide()
|
||||||
# The server returned an error
|
# The server returned an error
|
||||||
if items == 0:
|
if items == 0:
|
||||||
|
@ -1236,7 +1237,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
def _show_tooltip(self, state):
|
def _show_tooltip(self, state):
|
||||||
view = self.window.services_treeview
|
view = self.window.services_treeview
|
||||||
pointer = view.get_pointer()
|
pointer = view.get_pointer()
|
||||||
props = view.get_path_at_pos(pointer[0], pointer[1])
|
props = view.get_path_at_pos(pointer[1], pointer[2])
|
||||||
# check if the current pointer is at the same path
|
# check if the current pointer is at the same path
|
||||||
# as it was before setting the timeout
|
# as it was before setting the timeout
|
||||||
if props and self.tooltip.id == props[0]:
|
if props and self.tooltip.id == props[0]:
|
||||||
|
@ -1274,7 +1275,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
if jid and state > 0 and \
|
if jid and state > 0 and \
|
||||||
(self.tooltip.timeout == 0 or self.tooltip.id != props[0]):
|
(self.tooltip.timeout == 0 or self.tooltip.id != props[0]):
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = GObject.timeout_add(500,
|
||||||
self._show_tooltip, state)
|
self._show_tooltip, state)
|
||||||
|
|
||||||
def on_treeview_event_hide_tooltip(self, widget, event):
|
def on_treeview_event_hide_tooltip(self, widget, event):
|
||||||
|
@ -1287,20 +1288,20 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
# JID, node, icon, description, state
|
# JID, node, icon, description, state
|
||||||
# State means 2 when error, 1 when fetching, 0 when succes.
|
# State means 2 when error, 1 when fetching, 0 when succes.
|
||||||
view = self.window.services_treeview
|
view = self.window.services_treeview
|
||||||
self.model = gtk.TreeStore(str, str, gtk.gdk.Pixbuf, str, int)
|
self.model = Gtk.TreeStore(str, str, GdkPixbuf.Pixbuf, str, int)
|
||||||
self.model.set_sort_func(4, self._treemodel_sort_func)
|
self.model.set_sort_func(4, self._treemodel_sort_func)
|
||||||
self.model.set_sort_column_id(4, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(4, Gtk.SortType.ASCENDING)
|
||||||
view.set_model(self.model)
|
view.set_model(self.model)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn()
|
col = Gtk.TreeViewColumn()
|
||||||
# Icon Renderer
|
# Icon Renderer
|
||||||
renderer = gtk.CellRendererPixbuf()
|
renderer = Gtk.CellRendererPixbuf()
|
||||||
renderer.set_property('xpad', 6)
|
renderer.set_property('xpad', 6)
|
||||||
col.pack_start(renderer, expand=False)
|
col.pack_start(renderer, False, True, 0)
|
||||||
col.set_cell_data_func(renderer, self._pixbuf_renderer_data_func)
|
col.set_cell_data_func(renderer, self._pixbuf_renderer_data_func)
|
||||||
# Text Renderer
|
# Text Renderer
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, expand=True)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_cell_data_func(renderer, self._text_renderer_data_func)
|
col.set_cell_data_func(renderer, self._text_renderer_data_func)
|
||||||
renderer.set_property('foreground', 'dark gray')
|
renderer.set_property('foreground', 'dark gray')
|
||||||
# Save this so we can go along with theme changes
|
# Save this so we can go along with theme changes
|
||||||
|
@ -1337,11 +1338,11 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
|
|
||||||
def _add_actions(self):
|
def _add_actions(self):
|
||||||
AgentBrowser._add_actions(self)
|
AgentBrowser._add_actions(self)
|
||||||
self.execute_button = gtk.Button()
|
self.execute_button = Gtk.Button()
|
||||||
image = gtk.image_new_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON)
|
image = Gtk.Image.new_from_stock(Gtk.STOCK_EXECUTE, Gtk.IconSize.BUTTON)
|
||||||
label = gtk.Label(_('_Execute Command'))
|
label = Gtk.Label(label=_('_Execute Command'))
|
||||||
label.set_use_underline(True)
|
label.set_use_underline(True)
|
||||||
hbox = gtk.HBox()
|
hbox = Gtk.HBox()
|
||||||
hbox.pack_start(image, False, True, 6)
|
hbox.pack_start(image, False, True, 6)
|
||||||
hbox.pack_end(label, True, True)
|
hbox.pack_end(label, True, True)
|
||||||
self.execute_button.add(hbox)
|
self.execute_button.add(hbox)
|
||||||
|
@ -1349,17 +1350,17 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.window.action_buttonbox.add(self.execute_button)
|
self.window.action_buttonbox.add(self.execute_button)
|
||||||
self.execute_button.show_all()
|
self.execute_button.show_all()
|
||||||
|
|
||||||
self.register_button = gtk.Button(label=_("Re_gister"),
|
self.register_button = Gtk.Button(label=_("Re_gister"),
|
||||||
use_underline=True)
|
use_underline=True)
|
||||||
self.register_button.connect('clicked', self.on_register_button_clicked)
|
self.register_button.connect('clicked', self.on_register_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.register_button)
|
self.window.action_buttonbox.add(self.register_button)
|
||||||
self.register_button.show_all()
|
self.register_button.show_all()
|
||||||
|
|
||||||
self.join_button = gtk.Button()
|
self.join_button = Gtk.Button()
|
||||||
image = gtk.image_new_from_stock(gtk.STOCK_CONNECT, gtk.ICON_SIZE_BUTTON)
|
image = Gtk.Image.new_from_stock(Gtk.STOCK_CONNECT, Gtk.IconSize.BUTTON)
|
||||||
label = gtk.Label(_('_Join'))
|
label = Gtk.Label(label=_('_Join'))
|
||||||
label.set_use_underline(True)
|
label.set_use_underline(True)
|
||||||
hbox = gtk.HBox()
|
hbox = Gtk.HBox()
|
||||||
hbox.pack_start(image, False, True, 6)
|
hbox.pack_start(image, False, True, 6)
|
||||||
hbox.pack_end(label, True, True)
|
hbox.pack_end(label, True, True)
|
||||||
self.join_button.add(hbox)
|
self.join_button.add(hbox)
|
||||||
|
@ -1367,11 +1368,11 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.window.action_buttonbox.add(self.join_button)
|
self.window.action_buttonbox.add(self.join_button)
|
||||||
self.join_button.show_all()
|
self.join_button.show_all()
|
||||||
|
|
||||||
self.search_button = gtk.Button()
|
self.search_button = Gtk.Button()
|
||||||
image = gtk.image_new_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON)
|
image = Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.BUTTON)
|
||||||
label = gtk.Label(_('_Search'))
|
label = Gtk.Label(label=_('_Search'))
|
||||||
label.set_use_underline(True)
|
label.set_use_underline(True)
|
||||||
hbox = gtk.HBox()
|
hbox = Gtk.HBox()
|
||||||
hbox.pack_start(image, False, True, 6)
|
hbox.pack_start(image, False, True, 6)
|
||||||
hbox.pack_end(label, True, True)
|
hbox.pack_end(label, True, True)
|
||||||
self.search_button.add(hbox)
|
self.search_button.add(hbox)
|
||||||
|
@ -1546,7 +1547,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
# self.expanding = False
|
# self.expanding = False
|
||||||
# return False
|
# return False
|
||||||
#self.expanding = True
|
#self.expanding = True
|
||||||
#gobject.idle_add(expand_all)
|
#GObject.idle_add(expand_all)
|
||||||
self.window.services_treeview.expand_all()
|
self.window.services_treeview.expand_all()
|
||||||
|
|
||||||
def _update_progressbar(self):
|
def _update_progressbar(self):
|
||||||
|
@ -1555,7 +1556,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
"""
|
"""
|
||||||
# Refresh this every update
|
# Refresh this every update
|
||||||
if self._progressbar_sourceid:
|
if self._progressbar_sourceid:
|
||||||
gobject.source_remove(self._progressbar_sourceid)
|
GObject.source_remove(self._progressbar_sourceid)
|
||||||
|
|
||||||
fraction = 0
|
fraction = 0
|
||||||
if self._total_items:
|
if self._total_items:
|
||||||
|
@ -1564,12 +1565,12 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
fraction = float(self._progress) / float(self._total_items)
|
fraction = float(self._progress) / float(self._total_items)
|
||||||
if self._progress >= self._total_items:
|
if self._progress >= self._total_items:
|
||||||
# We show the progressbar for just a bit before hiding it.
|
# We show the progressbar for just a bit before hiding it.
|
||||||
id_ = gobject.timeout_add_seconds(2, self._hide_progressbar_cb)
|
id_ = GObject.timeout_add_seconds(2, self._hide_progressbar_cb)
|
||||||
self._progressbar_sourceid = id_
|
self._progressbar_sourceid = id_
|
||||||
else:
|
else:
|
||||||
self.window.progressbar.show()
|
self.window.progressbar.show()
|
||||||
# Hide the progressbar if we're timing out anyways. (20 secs)
|
# Hide the progressbar if we're timing out anyways. (20 secs)
|
||||||
id_ = gobject.timeout_add_seconds(20, self._hide_progressbar_cb)
|
id_ = GObject.timeout_add_seconds(20, self._hide_progressbar_cb)
|
||||||
self._progressbar_sourceid = id_
|
self._progressbar_sourceid = id_
|
||||||
self.window.progressbar.set_fraction(fraction)
|
self.window.progressbar.set_fraction(fraction)
|
||||||
|
|
||||||
|
@ -1611,7 +1612,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
Looks up a category row and returns the iterator to it, or None
|
Looks up a category row and returns the iterator to it, or None
|
||||||
"""
|
"""
|
||||||
cat = self._friendly_category(cat, type_)[0]
|
cat = self._friendly_category(cat, type_)[0]
|
||||||
iter_ = self.model.get_iter_root()
|
iter_ = self.model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
if self.model.get_value(iter_, 3).decode('utf-8') == cat:
|
if self.model.get_value(iter_, 3).decode('utf-8') == cat:
|
||||||
break
|
break
|
||||||
|
@ -1622,7 +1623,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
|
|
||||||
def _find_item(self, jid, node):
|
def _find_item(self, jid, node):
|
||||||
iter_ = None
|
iter_ = None
|
||||||
cat_iter = self.model.get_iter_root()
|
cat_iter = self.model.get_iter_first()
|
||||||
while cat_iter and not iter_:
|
while cat_iter and not iter_:
|
||||||
iter_ = self.model.iter_children(cat_iter)
|
iter_ = self.model.iter_children(cat_iter)
|
||||||
while iter_:
|
while iter_:
|
||||||
|
@ -1661,7 +1662,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
if not cat:
|
if not cat:
|
||||||
cat = self._create_category(*cat_args)
|
cat = self._create_category(*cat_args)
|
||||||
self.model.append(cat, (jid, node, pix, descr, 1))
|
self.model.append(cat, (jid, node, pix, descr, 1))
|
||||||
gobject.idle_add(self._expand_all)
|
GObject.idle_add(self._expand_all)
|
||||||
# Grab info on the service
|
# Grab info on the service
|
||||||
self.cache.get_info(jid, node, self._agent_info, force=force)
|
self.cache.get_info(jid, node, self._agent_info, force=force)
|
||||||
self._update_progressbar()
|
self._update_progressbar()
|
||||||
|
@ -1736,39 +1737,39 @@ class MucBrowser(AgentBrowser):
|
||||||
# JID, node, name, users_int, users_str, description, fetched
|
# JID, node, name, users_int, users_str, description, fetched
|
||||||
# This is rather long, I'd rather not use a data_func here though.
|
# This is rather long, I'd rather not use a data_func here though.
|
||||||
# Users is a string, because want to be able to leave it empty.
|
# Users is a string, because want to be able to leave it empty.
|
||||||
self.model = gtk.ListStore(str, str, str, int, str, str, bool)
|
self.model = Gtk.ListStore(str, str, str, int, str, str, bool)
|
||||||
self.model.set_sort_column_id(2, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(2, Gtk.SortType.ASCENDING)
|
||||||
self.window.services_treeview.set_model(self.model)
|
self.window.services_treeview.set_model(self.model)
|
||||||
# Name column
|
# Name column
|
||||||
col = gtk.TreeViewColumn(_('Name'))
|
col = Gtk.TreeViewColumn(_('Name'))
|
||||||
col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
col.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
|
||||||
col.set_fixed_width(100)
|
col.set_fixed_width(100)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 2)
|
col.set_attributes(renderer, text = 2)
|
||||||
col.set_sort_column_id(2)
|
col.set_sort_column_id(2)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
# Users column
|
# Users column
|
||||||
col = gtk.TreeViewColumn(_('Users'))
|
col = Gtk.TreeViewColumn(_('Users'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 4)
|
col.set_attributes(renderer, text = 4)
|
||||||
col.set_sort_column_id(3)
|
col.set_sort_column_id(3)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
# Description column
|
# Description column
|
||||||
col = gtk.TreeViewColumn(_('Description'))
|
col = Gtk.TreeViewColumn(_('Description'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 5)
|
col.set_attributes(renderer, text = 5)
|
||||||
col.set_sort_column_id(4)
|
col.set_sort_column_id(4)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
# Id column
|
# Id column
|
||||||
col = gtk.TreeViewColumn(_('Id'))
|
col = Gtk.TreeViewColumn(_('Id'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 0)
|
col.set_attributes(renderer, text = 0)
|
||||||
col.set_sort_column_id(0)
|
col.set_sort_column_id(0)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
|
@ -1796,11 +1797,11 @@ class MucBrowser(AgentBrowser):
|
||||||
AgentBrowser._clean_treemodel(self)
|
AgentBrowser._clean_treemodel(self)
|
||||||
|
|
||||||
def _add_actions(self):
|
def _add_actions(self):
|
||||||
self.bookmark_button = gtk.Button(label=_('_Bookmark'), use_underline=True)
|
self.bookmark_button = Gtk.Button(label=_('_Bookmark'), use_underline=True)
|
||||||
self.bookmark_button.connect('clicked', self.on_bookmark_button_clicked)
|
self.bookmark_button.connect('clicked', self.on_bookmark_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.bookmark_button)
|
self.window.action_buttonbox.add(self.bookmark_button)
|
||||||
self.bookmark_button.show_all()
|
self.bookmark_button.show_all()
|
||||||
self.join_button = gtk.Button(label=_('_Join'), use_underline=True)
|
self.join_button = Gtk.Button(label=_('_Join'), use_underline=True)
|
||||||
self.join_button.connect('clicked', self.on_join_button_clicked)
|
self.join_button.connect('clicked', self.on_join_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.join_button)
|
self.window.action_buttonbox.add(self.join_button)
|
||||||
self.join_button.show_all()
|
self.join_button.show_all()
|
||||||
|
@ -1896,9 +1897,9 @@ class MucBrowser(AgentBrowser):
|
||||||
# We're already fetching
|
# We're already fetching
|
||||||
return
|
return
|
||||||
view = self.window.services_treeview
|
view = self.window.services_treeview
|
||||||
if not view.flags() & gtk.REALIZED:
|
if not view.get_realized():
|
||||||
# Prevent a silly warning, try again in a bit.
|
# Prevent a silly warning, try again in a bit.
|
||||||
self._fetch_source = gobject.timeout_add(100, self._start_info_query)
|
self._fetch_source = GObject.timeout_add(100, self._start_info_query)
|
||||||
return
|
return
|
||||||
# We have to do this in a pygtk <2.8 compatible way :/
|
# We have to do this in a pygtk <2.8 compatible way :/
|
||||||
#start, end = self.window.services_treeview.get_visible_range()
|
#start, end = self.window.services_treeview.get_visible_range()
|
||||||
|
@ -1965,7 +1966,7 @@ class MucBrowser(AgentBrowser):
|
||||||
def _add_item(self, jid, node, parent_node, item, force):
|
def _add_item(self, jid, node, parent_node, item, force):
|
||||||
self.model.append((jid, node, item.get('name', ''), -1, '', '', False))
|
self.model.append((jid, node, item.get('name', ''), -1, '', '', False))
|
||||||
if not self._fetch_source:
|
if not self._fetch_source:
|
||||||
self._fetch_source = gobject.idle_add(self._start_info_query)
|
self._fetch_source = GObject.idle_add(self._start_info_query)
|
||||||
|
|
||||||
def _update_info(self, iter_, jid, node, identities, features, data):
|
def _update_info(self, iter_, jid, node, identities, features, data):
|
||||||
name = identities[0].get('name', '')
|
name = identities[0].get('name', '')
|
||||||
|
@ -2033,34 +2034,34 @@ class DiscussionGroupsBrowser(AgentBrowser):
|
||||||
Create treemodel for the window
|
Create treemodel for the window
|
||||||
"""
|
"""
|
||||||
# JID, node, name (with description) - pango markup, dont have info?, subscribed?
|
# JID, node, name (with description) - pango markup, dont have info?, subscribed?
|
||||||
self.model = gtk.TreeStore(str, str, str, bool, bool)
|
self.model = Gtk.TreeStore(str, str, str, bool, bool)
|
||||||
# sort by name
|
# sort by name
|
||||||
self.model.set_sort_column_id(2, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(2, Gtk.SortType.ASCENDING)
|
||||||
self.window.services_treeview.set_model(self.model)
|
self.window.services_treeview.set_model(self.model)
|
||||||
|
|
||||||
# Name column
|
# Name column
|
||||||
# Pango markup for name and description, description printed with
|
# Pango markup for name and description, description printed with
|
||||||
# <small/> font
|
# <small/> font
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('Name'))
|
col = Gtk.TreeViewColumn(_('Name'))
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, markup=2)
|
col.set_attributes(renderer, markup=2)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
self.window.services_treeview.set_headers_visible(True)
|
self.window.services_treeview.set_headers_visible(True)
|
||||||
|
|
||||||
# Subscription state
|
# Subscription state
|
||||||
renderer = gtk.CellRendererToggle()
|
renderer = Gtk.CellRendererToggle()
|
||||||
col = gtk.TreeViewColumn(_('Subscribed'))
|
col = Gtk.TreeViewColumn(_('Subscribed'))
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, inconsistent=3, active=4)
|
col.set_attributes(renderer, inconsistent=3, active=4)
|
||||||
col.set_resizable(False)
|
col.set_resizable(False)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
|
|
||||||
# Node Column
|
# Node Column
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('Node'))
|
col = Gtk.TreeViewColumn(_('Node'))
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, markup=1)
|
col.set_attributes(renderer, markup=1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
|
@ -2095,7 +2096,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
|
||||||
dunno = True
|
dunno = True
|
||||||
subscribed = False
|
subscribed = False
|
||||||
|
|
||||||
name = gobject.markup_escape_text(name)
|
name = GObject.markup_escape_text(name)
|
||||||
name = '<b>%s</b>' % name
|
name = '<b>%s</b>' % name
|
||||||
|
|
||||||
if parent_node:
|
if parent_node:
|
||||||
|
@ -2126,19 +2127,19 @@ class DiscussionGroupsBrowser(AgentBrowser):
|
||||||
return self.found_iter
|
return self.found_iter
|
||||||
|
|
||||||
def _add_actions(self):
|
def _add_actions(self):
|
||||||
self.post_button = gtk.Button(label=_('New post'), use_underline=True)
|
self.post_button = Gtk.Button(label=_('New post'), use_underline=True)
|
||||||
self.post_button.set_sensitive(False)
|
self.post_button.set_sensitive(False)
|
||||||
self.post_button.connect('clicked', self.on_post_button_clicked)
|
self.post_button.connect('clicked', self.on_post_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.post_button)
|
self.window.action_buttonbox.add(self.post_button)
|
||||||
self.post_button.show_all()
|
self.post_button.show_all()
|
||||||
|
|
||||||
self.subscribe_button = gtk.Button(label=_('_Subscribe'), use_underline=True)
|
self.subscribe_button = Gtk.Button(label=_('_Subscribe'), use_underline=True)
|
||||||
self.subscribe_button.set_sensitive(False)
|
self.subscribe_button.set_sensitive(False)
|
||||||
self.subscribe_button.connect('clicked', self.on_subscribe_button_clicked)
|
self.subscribe_button.connect('clicked', self.on_subscribe_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.subscribe_button)
|
self.window.action_buttonbox.add(self.subscribe_button)
|
||||||
self.subscribe_button.show_all()
|
self.subscribe_button.show_all()
|
||||||
|
|
||||||
self.unsubscribe_button = gtk.Button(label=_('_Unsubscribe'), use_underline=True)
|
self.unsubscribe_button = Gtk.Button(label=_('_Unsubscribe'), use_underline=True)
|
||||||
self.unsubscribe_button.set_sensitive(False)
|
self.unsubscribe_button.set_sensitive(False)
|
||||||
self.unsubscribe_button.connect('clicked', self.on_unsubscribe_button_clicked)
|
self.unsubscribe_button.connect('clicked', self.on_unsubscribe_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.unsubscribe_button)
|
self.window.action_buttonbox.add(self.unsubscribe_button)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
@ -41,7 +41,7 @@ class FeaturesWindow:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('features_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('features_window.ui')
|
||||||
self.window = self.xml.get_object('features_window')
|
self.window = self.xml.get_object('features_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
treeview = self.xml.get_object('features_treeview')
|
treeview = self.xml.get_object('features_treeview')
|
||||||
self.desc_label = self.xml.get_object('feature_desc_label')
|
self.desc_label = self.xml.get_object('feature_desc_label')
|
||||||
|
|
||||||
|
@ -114,20 +114,20 @@ class FeaturesWindow:
|
||||||
}
|
}
|
||||||
|
|
||||||
# name, supported
|
# name, supported
|
||||||
self.model = gtk.ListStore(str, bool)
|
self.model = Gtk.ListStore(str, bool)
|
||||||
treeview.set_model(self.model)
|
treeview.set_model(self.model)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(Q_('?features:Available'))
|
col = Gtk.TreeViewColumn(Q_('?features:Available'))
|
||||||
treeview.append_column(col)
|
treeview.append_column(col)
|
||||||
cell = gtk.CellRendererToggle()
|
cell = Gtk.CellRendererToggle()
|
||||||
cell.set_property('radio', True)
|
cell.set_property('radio', True)
|
||||||
col.pack_start(cell)
|
col.pack_start(cell, True, True, 0)
|
||||||
col.set_attributes(cell, active = 1)
|
col.set_attributes(cell, active = 1)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Feature'))
|
col = Gtk.TreeViewColumn(_('Feature'))
|
||||||
treeview.append_column(col)
|
treeview.append_column(col)
|
||||||
cell = gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
col.pack_start(cell, expand = True)
|
col.pack_start(cell, True, True, 0)
|
||||||
col.add_attribute(cell, 'text', 0)
|
col.add_attribute(cell, 'text', 0)
|
||||||
|
|
||||||
# Fill model
|
# Fill model
|
||||||
|
@ -136,7 +136,7 @@ class FeaturesWindow:
|
||||||
rep = func()
|
rep = func()
|
||||||
self.model.append([feature, rep])
|
self.model.append([feature, rep])
|
||||||
|
|
||||||
self.model.set_sort_column_id(0, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||||
|
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GdkPixbuf
|
||||||
import pango
|
from gi.repository import GObject
|
||||||
|
from gi.repository import Pango
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -66,52 +67,52 @@ class FileTransfersWindow:
|
||||||
shall_notify = gajim.config.get('notify_on_file_complete')
|
shall_notify = gajim.config.get('notify_on_file_complete')
|
||||||
self.notify_ft_checkbox.set_active(shall_notify
|
self.notify_ft_checkbox.set_active(shall_notify
|
||||||
)
|
)
|
||||||
self.model = gtk.ListStore(gtk.gdk.Pixbuf, str, str, str, str, int,
|
self.model = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str, str, int,
|
||||||
int, str)
|
int, str)
|
||||||
self.tree.set_model(self.model)
|
self.tree.set_model(self.model)
|
||||||
col = gtk.TreeViewColumn()
|
col = Gtk.TreeViewColumn()
|
||||||
|
|
||||||
render_pixbuf = gtk.CellRendererPixbuf()
|
render_pixbuf = Gtk.CellRendererPixbuf()
|
||||||
|
|
||||||
col.pack_start(render_pixbuf, expand=True)
|
col.pack_start(render_pixbuf, True)
|
||||||
render_pixbuf.set_property('xpad', 3)
|
render_pixbuf.set_property('xpad', 3)
|
||||||
render_pixbuf.set_property('ypad', 3)
|
render_pixbuf.set_property('ypad', 3)
|
||||||
render_pixbuf.set_property('yalign', .0)
|
render_pixbuf.set_property('yalign', .0)
|
||||||
col.add_attribute(render_pixbuf, 'pixbuf', 0)
|
col.add_attribute(render_pixbuf, 'pixbuf', 0)
|
||||||
self.tree.append_column(col)
|
self.tree.append_column(col)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('File'))
|
col = Gtk.TreeViewColumn(_('File'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, expand=False)
|
col.pack_start(renderer, False)
|
||||||
col.add_attribute(renderer, 'markup', C_LABELS)
|
col.add_attribute(renderer, 'markup', C_LABELS)
|
||||||
renderer.set_property('yalign', 0.)
|
renderer.set_property('yalign', 0.)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, expand=True)
|
col.pack_start(renderer, True)
|
||||||
col.add_attribute(renderer, 'markup', C_FILE)
|
col.add_attribute(renderer, 'markup', C_FILE)
|
||||||
renderer.set_property('xalign', 0.)
|
renderer.set_property('xalign', 0.)
|
||||||
renderer.set_property('yalign', 0.)
|
renderer.set_property('yalign', 0.)
|
||||||
renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
|
renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_expand(True)
|
col.set_expand(True)
|
||||||
self.tree.append_column(col)
|
self.tree.append_column(col)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Time'))
|
col = Gtk.TreeViewColumn(_('Time'))
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, expand=False)
|
col.pack_start(renderer, False)
|
||||||
col.add_attribute(renderer, 'markup', C_TIME)
|
col.add_attribute(renderer, 'markup', C_TIME)
|
||||||
renderer.set_property('yalign', 0.5)
|
renderer.set_property('yalign', 0.5)
|
||||||
renderer.set_property('xalign', 0.5)
|
renderer.set_property('xalign', 0.5)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
|
renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_expand(False)
|
col.set_expand(False)
|
||||||
self.tree.append_column(col)
|
self.tree.append_column(col)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Progress'))
|
col = Gtk.TreeViewColumn(_('Progress'))
|
||||||
renderer = gtk.CellRendererProgress()
|
renderer = Gtk.CellRendererProgress()
|
||||||
renderer.set_property('yalign', 0.5)
|
renderer.set_property('yalign', 0.5)
|
||||||
renderer.set_property('xalign', 0.5)
|
renderer.set_property('xalign', 0.5)
|
||||||
col.pack_start(renderer, expand=False)
|
col.pack_start(renderer, False)
|
||||||
col.add_attribute(renderer, 'text', C_PROGRESS)
|
col.add_attribute(renderer, 'text', C_PROGRESS)
|
||||||
col.add_attribute(renderer, 'value', C_PERCENT)
|
col.add_attribute(renderer, 'value', C_PERCENT)
|
||||||
col.add_attribute(renderer, 'pulse', C_PULSE)
|
col.add_attribute(renderer, 'pulse', C_PULSE)
|
||||||
|
@ -121,18 +122,18 @@ class FileTransfersWindow:
|
||||||
|
|
||||||
self.images = {}
|
self.images = {}
|
||||||
self.icons = {
|
self.icons = {
|
||||||
'upload': gtk.STOCK_GO_UP,
|
'upload': Gtk.STOCK_GO_UP,
|
||||||
'download': gtk.STOCK_GO_DOWN,
|
'download': Gtk.STOCK_GO_DOWN,
|
||||||
'stop': gtk.STOCK_STOP,
|
'stop': Gtk.STOCK_STOP,
|
||||||
'waiting': gtk.STOCK_REFRESH,
|
'waiting': Gtk.STOCK_REFRESH,
|
||||||
'pause': gtk.STOCK_MEDIA_PAUSE,
|
'pause': Gtk.STOCK_MEDIA_PAUSE,
|
||||||
'continue': gtk.STOCK_MEDIA_PLAY,
|
'continue': Gtk.STOCK_MEDIA_PLAY,
|
||||||
'ok': gtk.STOCK_APPLY,
|
'ok': Gtk.STOCK_APPLY,
|
||||||
'computing': gtk.STOCK_EXECUTE,
|
'computing': Gtk.STOCK_EXECUTE,
|
||||||
'hash_error': gtk.STOCK_STOP,
|
'hash_error': Gtk.STOCK_STOP,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tree.get_selection().set_mode(gtk.SELECTION_SINGLE)
|
self.tree.get_selection().set_mode(Gtk.SelectionMode.SINGLE)
|
||||||
self.tree.get_selection().connect('changed', self.selection_changed)
|
self.tree.get_selection().connect('changed', self.selection_changed)
|
||||||
self.tooltip = tooltips.FileTransfersTooltip()
|
self.tooltip = tooltips.FileTransfersTooltip()
|
||||||
self.file_transfers_menu = self.xml.get_object('file_transfers_menu')
|
self.file_transfers_menu = self.xml.get_object('file_transfers_menu')
|
||||||
|
@ -182,7 +183,7 @@ class FileTransfersWindow:
|
||||||
(file_path, file_name) = os.path.split(file_props.file_name)
|
(file_path, file_name) = os.path.split(file_props.file_name)
|
||||||
else:
|
else:
|
||||||
file_name = file_props.name
|
file_name = file_props.name
|
||||||
sectext = '\t' + _('Filename: %s') % gobject.markup_escape_text(
|
sectext = '\t' + _('Filename: %s') % GObject.markup_escape_text(
|
||||||
file_name)
|
file_name)
|
||||||
sectext += '\n\t' + _('Size: %s') % \
|
sectext += '\n\t' + _('Size: %s') % \
|
||||||
helpers.convert_bytes(file_props.size)
|
helpers.convert_bytes(file_props.size)
|
||||||
|
@ -207,13 +208,13 @@ class FileTransfersWindow:
|
||||||
sectext += recipient
|
sectext += recipient
|
||||||
if file_props.type_ == 'r':
|
if file_props.type_ == 'r':
|
||||||
sectext += '\n\t' + _('Saved in: %s') % file_path
|
sectext += '\n\t' + _('Saved in: %s') % file_path
|
||||||
dialog = dialogs.HigDialog(None, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE,
|
dialog = dialogs.HigDialog(None, Gtk.MessageType.INFO, Gtk.ButtonsType.NONE,
|
||||||
_('File transfer completed'), sectext)
|
_('File transfer completed'), sectext)
|
||||||
if file_props.type_ == 'r':
|
if file_props.type_ == 'r':
|
||||||
button = gtk.Button(_('_Open Containing Folder'))
|
button = Gtk.Button(_('_Open Containing Folder'))
|
||||||
button.connect('clicked', on_open, file_props)
|
button.connect('clicked', on_open, file_props)
|
||||||
dialog.action_area.pack_start(button)
|
dialog.action_area.pack_start(button, True, True, 0)
|
||||||
ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
|
ok_button = dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
|
||||||
def on_ok(widget):
|
def on_ok(widget):
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
ok_button.connect('clicked', on_ok)
|
ok_button.connect('clicked', on_ok)
|
||||||
|
@ -239,7 +240,7 @@ class FileTransfersWindow:
|
||||||
file_name = os.path.basename(file_props.file_name)
|
file_name = os.path.basename(file_props.file_name)
|
||||||
else:
|
else:
|
||||||
file_name = file_props.name
|
file_name = file_props.name
|
||||||
sectext = '\t' + _('Filename: %s') % gobject.markup_escape_text(
|
sectext = '\t' + _('Filename: %s') % GObject.markup_escape_text(
|
||||||
file_name)
|
file_name)
|
||||||
sectext += '\n\t' + _('Recipient: %s') % jid
|
sectext += '\n\t' + _('Recipient: %s') % jid
|
||||||
if error_msg:
|
if error_msg:
|
||||||
|
@ -283,12 +284,12 @@ class FileTransfersWindow:
|
||||||
_('The file %(file)s has been fully received, but it seems to be '
|
_('The file %(file)s has been fully received, but it seems to be '
|
||||||
'wrongly received.\nDo you want to reload it?') % \
|
'wrongly received.\nDo you want to reload it?') % \
|
||||||
{'file': file_name}, on_response_yes=(on_yes, jid, file_props,
|
{'file': file_name}, on_response_yes=(on_yes, jid, file_props,
|
||||||
account), type_=gtk.MESSAGE_ERROR)
|
account), type_=Gtk.MessageType.ERROR)
|
||||||
|
|
||||||
def show_file_send_request(self, account, contact):
|
def show_file_send_request(self, account, contact):
|
||||||
win = gtk.ScrolledWindow()
|
win = Gtk.ScrolledWindow()
|
||||||
win.set_shadow_type(gtk.SHADOW_IN)
|
win.set_shadow_type(Gtk.ShadowType.IN)
|
||||||
win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
|
win.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER)
|
||||||
|
|
||||||
from message_textview import MessageTextView
|
from message_textview import MessageTextView
|
||||||
desc_entry = MessageTextView()
|
desc_entry = MessageTextView()
|
||||||
|
@ -301,7 +302,7 @@ class FileTransfersWindow:
|
||||||
files_path_list)
|
files_path_list)
|
||||||
text_buffer = desc_entry.get_buffer()
|
text_buffer = desc_entry.get_buffer()
|
||||||
desc = text_buffer.get_text(text_buffer.get_start_iter(),
|
desc = text_buffer.get_text(text_buffer.get_start_iter(),
|
||||||
text_buffer.get_end_iter())
|
text_buffer.get_end_iter(), True)
|
||||||
for file_path in files_path_list:
|
for file_path in files_path_list:
|
||||||
if self.send_file(account, contact, file_path, desc) \
|
if self.send_file(account, contact, file_path, desc) \
|
||||||
and file_dir is None:
|
and file_dir is None:
|
||||||
|
@ -311,22 +312,22 @@ class FileTransfersWindow:
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
dialog = dialogs.FileChooserDialog(_('Choose File to Send...'),
|
dialog = dialogs.FileChooserDialog(_('Choose File to Send...'),
|
||||||
gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL),
|
Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL),
|
||||||
gtk.RESPONSE_OK,
|
Gtk.ResponseType.OK,
|
||||||
True, # select multiple true as we can select many files to send
|
True, # select multiple true as we can select many files to send
|
||||||
gajim.config.get('last_send_dir'),
|
gajim.config.get('last_send_dir'),
|
||||||
on_response_ok=on_ok,
|
on_response_ok=on_ok,
|
||||||
on_response_cancel=lambda e:dialog.destroy()
|
on_response_cancel=lambda e:dialog.destroy()
|
||||||
)
|
)
|
||||||
|
|
||||||
btn = gtk.Button(_('_Send'))
|
btn = Gtk.Button(_('_Send'))
|
||||||
btn.set_property('can-default', True)
|
btn.set_property('can-default', True)
|
||||||
# FIXME: add send icon to this button (JUMP_TO)
|
# FIXME: add send icon to this button (JUMP_TO)
|
||||||
dialog.add_action_widget(btn, gtk.RESPONSE_OK)
|
dialog.add_action_widget(btn, Gtk.ResponseType.OK)
|
||||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
dialog.set_default_response(Gtk.ResponseType.OK)
|
||||||
|
|
||||||
desc_hbox = gtk.HBox(False, 5)
|
desc_hbox = Gtk.HBox(False, 5)
|
||||||
desc_hbox.pack_start(gtk.Label(_('Description: ')), False, False, 0)
|
desc_hbox.pack_start(Gtk.Label(_('Description: ', True, True, 0)), False, False, 0)
|
||||||
desc_hbox.pack_start(win, True, True, 0)
|
desc_hbox.pack_start(win, True, True, 0)
|
||||||
|
|
||||||
dialog.vbox.pack_start(desc_hbox, False, False, 0)
|
dialog.vbox.pack_start(desc_hbox, False, False, 0)
|
||||||
|
@ -383,7 +384,7 @@ class FileTransfersWindow:
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
# check if we have write permissions
|
# check if we have write permissions
|
||||||
if not os.access(file_path, os.W_OK):
|
if not os.access(file_path, os.W_OK):
|
||||||
file_name = gobject.markup_escape_text(os.path.basename(
|
file_name = GObject.markup_escape_text(os.path.basename(
|
||||||
file_path))
|
file_path))
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_('Cannot overwrite existing file "%s"' % file_name),
|
_('Cannot overwrite existing file "%s"' % file_name),
|
||||||
|
@ -428,10 +429,10 @@ class FileTransfersWindow:
|
||||||
|
|
||||||
dialog2 = dialogs.FileChooserDialog(
|
dialog2 = dialogs.FileChooserDialog(
|
||||||
title_text=_('Save File as...'),
|
title_text=_('Save File as...'),
|
||||||
action=gtk.FILE_CHOOSER_ACTION_SAVE,
|
action=Gtk.FileChooserAction.SAVE,
|
||||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
||||||
gtk.STOCK_SAVE, gtk.RESPONSE_OK),
|
Gtk.STOCK_SAVE, Gtk.ResponseType.OK),
|
||||||
default_response=gtk.RESPONSE_OK,
|
default_response=Gtk.ResponseType.OK,
|
||||||
current_folder=gajim.config.get('last_save_dir'),
|
current_folder=gajim.config.get('last_save_dir'),
|
||||||
on_response_ok=(on_ok, account, contact, file_props),
|
on_response_ok=(on_ok, account, contact, file_props),
|
||||||
on_response_cancel=(on_cancel, account, contact, file_props))
|
on_response_cancel=(on_cancel, account, contact, file_props))
|
||||||
|
@ -447,7 +448,7 @@ class FileTransfersWindow:
|
||||||
"""
|
"""
|
||||||
if not file_props or not file_props.name:
|
if not file_props or not file_props.name:
|
||||||
return
|
return
|
||||||
sec_text = '\t' + _('File: %s') % gobject.markup_escape_text(
|
sec_text = '\t' + _('File: %s') % GObject.markup_escape_text(
|
||||||
file_props.name)
|
file_props.name)
|
||||||
if file_props.size:
|
if file_props.size:
|
||||||
sec_text += '\n\t' + _('Size: %s') % \
|
sec_text += '\n\t' + _('Size: %s') % \
|
||||||
|
@ -474,7 +475,7 @@ class FileTransfersWindow:
|
||||||
|
|
||||||
def get_icon(self, ident):
|
def get_icon(self, ident):
|
||||||
return self.images.setdefault(ident,
|
return self.images.setdefault(ident,
|
||||||
self.window.render_icon(self.icons[ident], gtk.ICON_SIZE_MENU))
|
self.window.render_icon(self.icons[ident], Gtk.IconSize.MENU))
|
||||||
|
|
||||||
def set_status(self,file_props, status):
|
def set_status(self,file_props, status):
|
||||||
"""
|
"""
|
||||||
|
@ -494,7 +495,7 @@ class FileTransfersWindow:
|
||||||
text += helpers.convert_bytes(received_size) + '/' + \
|
text += helpers.convert_bytes(received_size) + '/' + \
|
||||||
helpers.convert_bytes(full_size)
|
helpers.convert_bytes(full_size)
|
||||||
self.model.set(iter_, C_PROGRESS, text)
|
self.model.set(iter_, C_PROGRESS, text)
|
||||||
self.model.set(iter_, C_PULSE, gobject.constants.G_MAXINT)
|
self.model.set(iter_, C_PULSE, GObject.constants.G_MAXINT)
|
||||||
elif status == 'computing':
|
elif status == 'computing':
|
||||||
self.model.set(iter_, C_PULSE, 1)
|
self.model.set(iter_, C_PULSE, 1)
|
||||||
text = _('Checking file...') + '\n'
|
text = _('Checking file...') + '\n'
|
||||||
|
@ -505,11 +506,11 @@ class FileTransfersWindow:
|
||||||
self.model.set(iter_, C_PROGRESS, text)
|
self.model.set(iter_, C_PROGRESS, text)
|
||||||
def pulse():
|
def pulse():
|
||||||
p = self.model.get(iter_, C_PULSE)[0]
|
p = self.model.get(iter_, C_PULSE)[0]
|
||||||
if p == gobject.constants.G_MAXINT:
|
if p == GObject.constants.G_MAXINT:
|
||||||
return False
|
return False
|
||||||
self.model.set(iter_, C_PULSE, p + 1)
|
self.model.set(iter_, C_PULSE, p + 1)
|
||||||
return True
|
return True
|
||||||
gobject.timeout_add(100, pulse)
|
GObject.timeout_add(100, pulse)
|
||||||
elif status == 'hash_error':
|
elif status == 'hash_error':
|
||||||
text = _('File error') + '\n'
|
text = _('File error') + '\n'
|
||||||
received_size = int(file_props.received_len)
|
received_size = int(file_props.received_len)
|
||||||
|
@ -517,7 +518,7 @@ class FileTransfersWindow:
|
||||||
text += helpers.convert_bytes(received_size) + '/' + \
|
text += helpers.convert_bytes(received_size) + '/' + \
|
||||||
helpers.convert_bytes(full_size)
|
helpers.convert_bytes(full_size)
|
||||||
self.model.set(iter_, C_PROGRESS, text)
|
self.model.set(iter_, C_PROGRESS, text)
|
||||||
self.model.set(iter_, C_PULSE, gobject.constants.G_MAXINT)
|
self.model.set(iter_, C_PULSE, GObject.constants.G_MAXINT)
|
||||||
self.model.set(iter_, C_IMAGE, self.get_icon(status))
|
self.model.set(iter_, C_IMAGE, self.get_icon(status))
|
||||||
path = self.model.get_path(iter_)
|
path = self.model.get_path(iter_)
|
||||||
self.select_func(path)
|
self.select_func(path)
|
||||||
|
@ -674,7 +675,7 @@ class FileTransfersWindow:
|
||||||
Return iter to the row, which holds file transfer, identified by the
|
Return iter to the row, which holds file transfer, identified by the
|
||||||
session id
|
session id
|
||||||
"""
|
"""
|
||||||
iter_ = self.model.get_iter_root()
|
iter_ = self.model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
if typ + sid == self.model[iter_][C_SID].decode('utf-8'):
|
if typ + sid == self.model[iter_][C_SID].decode('utf-8'):
|
||||||
return iter_
|
return iter_
|
||||||
|
@ -737,7 +738,7 @@ class FileTransfersWindow:
|
||||||
file_name = os.path.split(file_props.file_name)[1]
|
file_name = os.path.split(file_props.file_name)[1]
|
||||||
else:
|
else:
|
||||||
file_name = file_props.name
|
file_name = file_props.name
|
||||||
text_props = gobject.markup_escape_text(file_name) + '\n'
|
text_props = GObject.markup_escape_text(file_name) + '\n'
|
||||||
text_props += contact.get_shown_name()
|
text_props += contact.get_shown_name()
|
||||||
self.model.set(iter_, 1, text_labels, 2, text_props, C_PULSE, -1, C_SID,
|
self.model.set(iter_, 1, text_labels, 2, text_props, C_PULSE, -1, C_SID,
|
||||||
file_props.type_ + file_props.sid)
|
file_props.type_ + file_props.sid)
|
||||||
|
@ -756,7 +757,7 @@ class FileTransfersWindow:
|
||||||
def on_transfers_list_motion_notify_event(self, widget, event):
|
def on_transfers_list_motion_notify_event(self, widget, event):
|
||||||
pointer = self.tree.get_pointer()
|
pointer = self.tree.get_pointer()
|
||||||
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
||||||
self.height_diff = pointer[1] - int(event.y)
|
self.height_diff = pointer[2] - int(event.y)
|
||||||
if self.tooltip.timeout > 0:
|
if self.tooltip.timeout > 0:
|
||||||
if not props or self.tooltip.id != props[0]:
|
if not props or self.tooltip.id != props[0]:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
|
@ -773,7 +774,7 @@ class FileTransfersWindow:
|
||||||
if file_props is not None:
|
if file_props is not None:
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = GObject.timeout_add(500,
|
||||||
self.show_tooltip, widget)
|
self.show_tooltip, widget)
|
||||||
|
|
||||||
def on_transfers_list_leave_notify_event(self, widget=None, event=None):
|
def on_transfers_list_leave_notify_event(self, widget=None, event=None):
|
||||||
|
@ -782,7 +783,7 @@ class FileTransfersWindow:
|
||||||
elif self.height_diff is 0:
|
elif self.height_diff is 0:
|
||||||
return
|
return
|
||||||
pointer = self.tree.get_pointer()
|
pointer = self.tree.get_pointer()
|
||||||
props = self.tree.get_path_at_pos(pointer[0], pointer[1] - self.height_diff)
|
props = self.tree.get_path_at_pos(pointer[1], pointer[2] - self.height_diff)
|
||||||
if self.tooltip.timeout > 0:
|
if self.tooltip.timeout > 0:
|
||||||
if not props or self.tooltip.id == props[0]:
|
if not props or self.tooltip.id == props[0]:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
|
@ -893,8 +894,8 @@ class FileTransfersWindow:
|
||||||
if status:
|
if status:
|
||||||
label = _('Pause')
|
label = _('Pause')
|
||||||
self.pause_button.set_label(label)
|
self.pause_button.set_label(label)
|
||||||
self.pause_button.set_image(gtk.image_new_from_stock(
|
self.pause_button.set_image(Gtk.Image.new_from_stock(
|
||||||
gtk.STOCK_MEDIA_PAUSE, gtk.ICON_SIZE_MENU))
|
Gtk.STOCK_MEDIA_PAUSE, Gtk.IconSize.MENU))
|
||||||
|
|
||||||
self.pause_menuitem.set_sensitive(True)
|
self.pause_menuitem.set_sensitive(True)
|
||||||
self.pause_menuitem.set_no_show_all(False)
|
self.pause_menuitem.set_no_show_all(False)
|
||||||
|
@ -904,8 +905,8 @@ class FileTransfersWindow:
|
||||||
else:
|
else:
|
||||||
label = _('_Continue')
|
label = _('_Continue')
|
||||||
self.pause_button.set_label(label)
|
self.pause_button.set_label(label)
|
||||||
self.pause_button.set_image(gtk.image_new_from_stock(
|
self.pause_button.set_image(Gtk.Image.new_from_stock(
|
||||||
gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_MENU))
|
Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.MENU))
|
||||||
self.pause_menuitem.hide()
|
self.pause_menuitem.hide()
|
||||||
self.pause_menuitem.set_no_show_all(True)
|
self.pause_menuitem.set_no_show_all(True)
|
||||||
self.continue_menuitem.set_sensitive(True)
|
self.continue_menuitem.set_sensitive(True)
|
||||||
|
@ -951,8 +952,8 @@ class FileTransfersWindow:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
return
|
return
|
||||||
pointer = self.tree.get_pointer()
|
pointer = self.tree.get_pointer()
|
||||||
props = self.tree.get_path_at_pos(pointer[0],
|
props = self.tree.get_path_at_pos(pointer[1],
|
||||||
pointer[1] - self.height_diff)
|
pointer[2] - self.height_diff)
|
||||||
# check if the current pointer is at the same path
|
# check if the current pointer is at the same path
|
||||||
# as it was before setting the timeout
|
# as it was before setting the timeout
|
||||||
if props and self.tooltip.id == props[0]:
|
if props and self.tooltip.id == props[0]:
|
||||||
|
@ -1006,7 +1007,7 @@ class FileTransfersWindow:
|
||||||
path = self.model.get_path(iter_)
|
path = self.model.get_path(iter_)
|
||||||
self.tree.get_selection().select_path(path)
|
self.tree.get_selection().select_path(path)
|
||||||
|
|
||||||
if event.keyval == gtk.keysyms.Menu:
|
if event.keyval == Gdk.KEY_Menu:
|
||||||
self.show_context_menu(event, iter_)
|
self.show_context_menu(event, iter_)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1073,5 +1074,5 @@ class FileTransfersWindow:
|
||||||
self.set_all_insensitive()
|
self.set_all_insensitive()
|
||||||
|
|
||||||
def on_file_transfers_window_key_press_event(self, widget, event):
|
def on_file_transfers_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape: # ESCAPE
|
if event.keyval == Gdk.KEY_Escape: # ESCAPE
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
103
src/gajim.py
103
src/gajim.py
|
@ -68,12 +68,12 @@ except ImportError:
|
||||||
print 'Gajim needs python-nbxmpp to run. Quiting...'
|
print 'Gajim needs python-nbxmpp to run. Quiting...'
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
from common import demandimport
|
#from common import demandimport
|
||||||
demandimport.enable()
|
#demandimport.enable()
|
||||||
demandimport.ignore += ['gobject._gobject', 'libasyncns', 'i18n',
|
#demandimport.ignore += ['GObject._gobject', 'libasyncns', 'i18n',
|
||||||
'logging.NullHandler', 'dbus.service', 'OpenSSL.SSL', 'OpenSSL.crypto',
|
# 'logging.NullHandler', 'dbus.service', 'OpenSSL.SSL', 'OpenSSL.crypto',
|
||||||
'common.sleepy', 'DLFCN', 'dl', 'xml.sax', 'xml.sax.handler', 'ic',
|
# 'common.sleepy', 'DLFCN', 'dl', 'xml.sax', 'xml.sax.handler', 'ic',
|
||||||
'Crypto.PublicKey', 'IPython']
|
# 'Crypto.PublicKey', 'IPython']
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
import locale
|
import locale
|
||||||
|
@ -111,6 +111,12 @@ import logging
|
||||||
# gajim.gui or gajim.gtk more appropriate ?
|
# gajim.gui or gajim.gtk more appropriate ?
|
||||||
log = logging.getLogger('gajim.gajim')
|
log = logging.getLogger('gajim.gajim')
|
||||||
|
|
||||||
|
#import gi
|
||||||
|
#gi.require_version('Gtk', '3.0')
|
||||||
|
#gi.require_version('Gdk', '2.0')
|
||||||
|
#gi.require_version('GObject', '2.0')
|
||||||
|
#gi.require_version('Pango', '1.0')
|
||||||
|
|
||||||
import getopt
|
import getopt
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
|
@ -190,9 +196,10 @@ if os.name == 'nt':
|
||||||
# PyGTK2.10+ only throws a warning
|
# PyGTK2.10+ only throws a warning
|
||||||
warnings.filterwarnings('error', module='gtk')
|
warnings.filterwarnings('error', module='gtk')
|
||||||
try:
|
try:
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
gobject.set_prgname('gajim')
|
GObject.set_prgname('gajim')
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import Gdk
|
||||||
except Warning, msg2:
|
except Warning, msg2:
|
||||||
if str(msg2) == 'could not open display':
|
if str(msg2) == 'could not open display':
|
||||||
print >> sys.stderr, _('Gajim needs X server to run. Quiting...')
|
print >> sys.stderr, _('Gajim needs X server to run. Quiting...')
|
||||||
|
@ -237,12 +244,14 @@ else:
|
||||||
elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'):
|
elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'):
|
||||||
libc.setproctitle('gajim')
|
libc.setproctitle('gajim')
|
||||||
|
|
||||||
if gtk.pygtk_version < (2, 22, 0):
|
# if Gtk.pygtk_version < (2, 22, 0):
|
||||||
pritext = _('Gajim needs PyGTK 2.22 or above')
|
# pritext = _('Gajim needs PyGTK 2.22 or above')
|
||||||
sectext = _('Gajim needs PyGTK 2.22 or above to run. Quiting...')
|
# sectext = _('Gajim needs PyGTK 2.22 or above to run. Quiting...')
|
||||||
elif gtk.gtk_version < (2, 22, 0):
|
# elif Gtk.gtk_version < (2, 22, 0):
|
||||||
pritext = _('Gajim needs GTK 2.22 or above')
|
# if (Gtk.get_major_version(), Gtk.get_minor_version(),
|
||||||
sectext = _('Gajim needs GTK 2.22 or above to run. Quiting...')
|
# Gtk.get_micro_version()) < (2, 22, 0):
|
||||||
|
# pritext = _('Gajim needs GTK 2.22 or above')
|
||||||
|
# sectext = _('Gajim needs GTK 2.22 or above to run. Quiting...')
|
||||||
|
|
||||||
from common import check_paths
|
from common import check_paths
|
||||||
|
|
||||||
|
@ -257,9 +266,9 @@ else:
|
||||||
'http://sourceforge.net/project/showfiles.php?group_id=78018'
|
'http://sourceforge.net/project/showfiles.php?group_id=78018'
|
||||||
|
|
||||||
if pritext:
|
if pritext:
|
||||||
dlg = gtk.MessageDialog(None,
|
dlg = Gtk.MessageDialog(None,
|
||||||
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
|
Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL,
|
||||||
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message_format = pritext)
|
Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, message_format = pritext)
|
||||||
|
|
||||||
dlg.format_secondary_text(sectext)
|
dlg.format_secondary_text(sectext)
|
||||||
dlg.run()
|
dlg.run()
|
||||||
|
@ -385,12 +394,12 @@ if pid_alive():
|
||||||
print("Gajim is already running, bringing the roster to front...")
|
print("Gajim is already running, bringing the roster to front...")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
pix = gtkgui_helpers.get_icon_pixmap('gajim', 48)
|
pix = gtkgui_helpers.get_icon_pixmap('gajim', 48)
|
||||||
gtk.window_set_default_icon(pix) # set the icon to all newly opened wind
|
Gtk.window_set_default_icon(pix) # set the icon to all newly opened wind
|
||||||
pritext = _('Gajim is already running')
|
pritext = _('Gajim is already running')
|
||||||
sectext = _('Another instance of Gajim seems to be running\nRun anyway?')
|
sectext = _('Another instance of Gajim seems to be running\nRun anyway?')
|
||||||
dialog = dialogs.YesNoDialog(pritext, sectext)
|
dialog = dialogs.YesNoDialog(pritext, sectext)
|
||||||
dialog.popup()
|
dialog.popup()
|
||||||
if dialog.run() != gtk.RESPONSE_YES:
|
if dialog.run() != Gtk.ResponseType.YES:
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
# run anyway, delete pid and useless global vars
|
# run anyway, delete pid and useless global vars
|
||||||
|
@ -440,31 +449,31 @@ if __name__ == '__main__':
|
||||||
log.info("Encodings: d:%s, fs:%s, p:%s", sys.getdefaultencoding(), \
|
log.info("Encodings: d:%s, fs:%s, p:%s", sys.getdefaultencoding(), \
|
||||||
sys.getfilesystemencoding(), locale.getpreferredencoding())
|
sys.getfilesystemencoding(), locale.getpreferredencoding())
|
||||||
|
|
||||||
if os.name != 'nt':
|
#if os.name != 'nt':
|
||||||
# Session Management support
|
## Session Management support
|
||||||
try:
|
#try:
|
||||||
import gnome.ui
|
#import gnome.ui
|
||||||
raise ImportError
|
#raise ImportError
|
||||||
except ImportError:
|
#except ImportError:
|
||||||
pass
|
#pass
|
||||||
else:
|
#else:
|
||||||
def die_cb(dummy):
|
#def die_cb(dummy):
|
||||||
gajim.interface.roster.quit_gtkgui_interface()
|
#gajim.interface.roster.quit_gtkgui_interface()
|
||||||
gnome.program_init('gajim', gajim.version)
|
#gnome.program_init('gajim', gajim.version)
|
||||||
cli = gnome.ui.master_client()
|
#cli = gnome.ui.master_client()
|
||||||
cli.connect('die', die_cb)
|
#cli.connect('die', die_cb)
|
||||||
|
|
||||||
path_to_gajim_script = gtkgui_helpers.get_abspath_for_script(
|
#path_to_gajim_script = gtkgui_helpers.get_abspath_for_script(
|
||||||
'gajim')
|
#'gajim')
|
||||||
|
|
||||||
if path_to_gajim_script:
|
#if path_to_gajim_script:
|
||||||
argv = [path_to_gajim_script]
|
#argv = [path_to_gajim_script]
|
||||||
try:
|
#try:
|
||||||
cli.set_restart_command(argv)
|
#cli.set_restart_command(argv)
|
||||||
except TypeError:
|
#except TypeError:
|
||||||
# Fedora systems have a broken gnome-python wrapper for this
|
## Fedora systems have a broken gnome-python wrapper for this
|
||||||
# function.
|
## function.
|
||||||
cli.set_restart_command(len(argv), argv)
|
#cli.set_restart_command(len(argv), argv)
|
||||||
|
|
||||||
check_paths.check_and_possibly_create_paths()
|
check_paths.check_and_possibly_create_paths()
|
||||||
|
|
||||||
|
@ -475,10 +484,10 @@ if __name__ == '__main__':
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
# This makes Gajim unusable under windows, and threads are used only
|
# This makes Gajim unusable under windows, and threads are used only
|
||||||
# for GPG, so not under windows
|
# for GPG, so not under windows
|
||||||
gtk.gdk.threads_init()
|
Gdk.threads_init()
|
||||||
gtk.gdk.threads_enter()
|
Gdk.threads_enter()
|
||||||
gtk.main()
|
Gtk.main()
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
gtk.gdk.threads_leave()
|
Gdk.threads_leave()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print >> sys.stderr, 'KeyboardInterrupt'
|
print >> sys.stderr, 'KeyboardInterrupt'
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
import dialogs
|
import dialogs
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class GajimThemesWindow:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('gajim_themes_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('gajim_themes_window.ui')
|
||||||
self.window = self.xml.get_object('gajim_themes_window')
|
self.window = self.xml.get_object('gajim_themes_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
|
|
||||||
self.options = ['account', 'group', 'contact', 'banner']
|
self.options = ['account', 'group', 'contact', 'banner']
|
||||||
self.options_combobox = self.xml.get_object('options_combobox')
|
self.options_combobox = self.xml.get_object('options_combobox')
|
||||||
|
@ -54,12 +54,12 @@ class GajimThemesWindow:
|
||||||
'muc_msg', 'muc_directed_msg'):
|
'muc_msg', 'muc_directed_msg'):
|
||||||
self.colorbuttons[chatstate] = self.xml.get_object(chatstate + \
|
self.colorbuttons[chatstate] = self.xml.get_object(chatstate + \
|
||||||
'_colorbutton')
|
'_colorbutton')
|
||||||
model = gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
self.themes_tree.set_model(model)
|
self.themes_tree.set_model(model)
|
||||||
col = gtk.TreeViewColumn(_('Theme'))
|
col = Gtk.TreeViewColumn(_('Theme'))
|
||||||
self.themes_tree.append_column(col)
|
self.themes_tree.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer, True)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = 0)
|
col.set_attributes(renderer, text = 0)
|
||||||
renderer.connect('edited', self.on_theme_cell_edited)
|
renderer.connect('edited', self.on_theme_cell_edited)
|
||||||
renderer.set_property('editable', True)
|
renderer.set_property('editable', True)
|
||||||
|
@ -125,7 +125,7 @@ class GajimThemesWindow:
|
||||||
|
|
||||||
def select_active_theme(self):
|
def select_active_theme(self):
|
||||||
model = self.themes_tree.get_model()
|
model = self.themes_tree.get_model()
|
||||||
iter_ = model.get_iter_root()
|
iter_ = model.get_iter_first()
|
||||||
active_theme = gajim.config.get('roster_theme').replace('_', ' ')
|
active_theme = gajim.config.get('roster_theme').replace('_', ' ')
|
||||||
while iter_:
|
while iter_:
|
||||||
theme = model[iter_][0]
|
theme = model[iter_][0]
|
||||||
|
@ -198,7 +198,7 @@ class GajimThemesWindow:
|
||||||
textcolor = gajim.config.get_per('themes', theme, option + 'textcolor')
|
textcolor = gajim.config.get_per('themes', theme, option + 'textcolor')
|
||||||
if textcolor:
|
if textcolor:
|
||||||
state = True
|
state = True
|
||||||
self.text_colorbutton.set_color(gtk.gdk.color_parse(textcolor))
|
self.text_colorbutton.set_color(Gdk.color_parse(textcolor))
|
||||||
else:
|
else:
|
||||||
state = False
|
state = False
|
||||||
self.textcolor_checkbutton.set_active(state)
|
self.textcolor_checkbutton.set_active(state)
|
||||||
|
@ -206,7 +206,7 @@ class GajimThemesWindow:
|
||||||
bgcolor = gajim.config.get_per('themes', theme, option + 'bgcolor')
|
bgcolor = gajim.config.get_per('themes', theme, option + 'bgcolor')
|
||||||
if bgcolor:
|
if bgcolor:
|
||||||
state = True
|
state = True
|
||||||
self.background_colorbutton.set_color(gtk.gdk.color_parse(
|
self.background_colorbutton.set_color(Gdk.color_parse(
|
||||||
bgcolor))
|
bgcolor))
|
||||||
else:
|
else:
|
||||||
state = False
|
state = False
|
||||||
|
@ -231,7 +231,7 @@ class GajimThemesWindow:
|
||||||
'muc_msg', 'muc_directed_msg'):
|
'muc_msg', 'muc_directed_msg'):
|
||||||
color = gajim.config.get_per('themes', theme, 'state_' + chatstate + \
|
color = gajim.config.get_per('themes', theme, 'state_' + chatstate + \
|
||||||
'_color')
|
'_color')
|
||||||
self.colorbuttons[chatstate].set_color(gtk.gdk.color_parse(color))
|
self.colorbuttons[chatstate].set_color(Gdk.color_parse(color))
|
||||||
|
|
||||||
def on_textcolor_checkbutton_toggled(self, widget):
|
def on_textcolor_checkbutton_toggled(self, widget):
|
||||||
state = widget.get_active()
|
state = widget.get_active()
|
||||||
|
@ -328,11 +328,11 @@ class GajimThemesWindow:
|
||||||
"""
|
"""
|
||||||
Return a FontDescription from togglebuttons states
|
Return a FontDescription from togglebuttons states
|
||||||
"""
|
"""
|
||||||
fd = pango.FontDescription()
|
fd = Pango.FontDescription()
|
||||||
if self.bold_togglebutton.get_active():
|
if self.bold_togglebutton.get_active():
|
||||||
fd.set_weight(pango.WEIGHT_BOLD)
|
fd.set_weight(Pango.Weight.BOLD)
|
||||||
if self.italic_togglebutton.get_active():
|
if self.italic_togglebutton.get_active():
|
||||||
fd.set_style(pango.STYLE_ITALIC)
|
fd.set_style(Pango.Style.ITALIC)
|
||||||
return fd
|
return fd
|
||||||
|
|
||||||
def _set_font_widgets(self, font_attrs):
|
def _set_font_widgets(self, font_attrs):
|
||||||
|
@ -365,10 +365,10 @@ class GajimThemesWindow:
|
||||||
Get tuple of font properties: weight, style
|
Get tuple of font properties: weight, style
|
||||||
"""
|
"""
|
||||||
font_props = [False, False, False]
|
font_props = [False, False, False]
|
||||||
font_description = pango.FontDescription(font_name)
|
font_description = Pango.FontDescription(font_name)
|
||||||
if font_description.get_weight() != pango.WEIGHT_NORMAL:
|
if font_description.get_weight() != Pango.Weight.NORMAL:
|
||||||
font_props[0] = True
|
font_props[0] = True
|
||||||
if font_description.get_style() != pango.STYLE_ITALIC:
|
if font_description.get_style() != Pango.Style.ITALIC:
|
||||||
font_props[1] = True
|
font_props[1] = True
|
||||||
return font_props
|
return font_props
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,10 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import GdkPixbuf
|
||||||
import gobject
|
from gi.repository import Pango
|
||||||
|
from gi.repository import GObject
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
import gui_menu_builder
|
import gui_menu_builder
|
||||||
import message_control
|
import message_control
|
||||||
|
@ -72,10 +73,10 @@ def set_renderer_color(treeview, renderer, set_background=True):
|
||||||
Set style for group row, using PRELIGHT system color
|
Set style for group row, using PRELIGHT system color
|
||||||
"""
|
"""
|
||||||
if set_background:
|
if set_background:
|
||||||
bgcolor = treeview.style.bg[gtk.STATE_PRELIGHT]
|
bgcolor = treeview.get_style().bg[Gtk.StateType.PRELIGHT]
|
||||||
renderer.set_property('cell-background-gdk', bgcolor)
|
renderer.set_property('cell-background-gdk', bgcolor)
|
||||||
else:
|
else:
|
||||||
fgcolor = treeview.style.fg[gtk.STATE_PRELIGHT]
|
fgcolor = treeview.get_style().fg[Gtk.StateType.PRELIGHT]
|
||||||
renderer.set_property('foreground-gdk', fgcolor)
|
renderer.set_property('foreground-gdk', fgcolor)
|
||||||
|
|
||||||
def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
||||||
|
@ -84,7 +85,7 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
# allocate space for avatar only if needed
|
# allocate space for avatar only if needed
|
||||||
parent_iter = model.iter_parent(iter_)
|
parent_iter = model.iter_parent(iter_)
|
||||||
if isinstance(renderer, gtk.CellRendererPixbuf):
|
if isinstance(renderer, Gtk.CellRendererPixbuf):
|
||||||
avatar_position = gajim.config.get('avatar_position_in_roster')
|
avatar_position = gajim.config.get('avatar_position_in_roster')
|
||||||
if avatar_position == 'right':
|
if avatar_position == 'right':
|
||||||
renderer.set_property('xalign', 1) # align pixbuf to the right
|
renderer.set_property('xalign', 1) # align pixbuf to the right
|
||||||
|
@ -103,7 +104,7 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
||||||
renderer.set_property('cell-background', bgcolor)
|
renderer.set_property('cell-background', bgcolor)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('cell-background', None)
|
renderer.set_property('cell-background', None)
|
||||||
if isinstance(renderer, gtk.CellRendererText):
|
if isinstance(renderer, Gtk.CellRendererText):
|
||||||
# foreground property is only with CellRendererText
|
# foreground property is only with CellRendererText
|
||||||
color = gajim.config.get_per('themes', theme, 'contacttextcolor')
|
color = gajim.config.get_per('themes', theme, 'contacttextcolor')
|
||||||
if color:
|
if color:
|
||||||
|
@ -118,7 +119,7 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
||||||
renderer.set_property('cell-background', bgcolor)
|
renderer.set_property('cell-background', bgcolor)
|
||||||
else:
|
else:
|
||||||
set_renderer_color(tv, renderer)
|
set_renderer_color(tv, renderer)
|
||||||
if isinstance(renderer, gtk.CellRendererText):
|
if isinstance(renderer, Gtk.CellRendererText):
|
||||||
# foreground property is only with CellRendererText
|
# foreground property is only with CellRendererText
|
||||||
color = gajim.config.get_per('themes', theme, 'grouptextcolor')
|
color = gajim.config.get_per('themes', theme, 'grouptextcolor')
|
||||||
if color:
|
if color:
|
||||||
|
@ -327,7 +328,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
if gtkgui_helpers.gtk_icon_theme.has_icon('bookmark-new'):
|
if gtkgui_helpers.gtk_icon_theme.has_icon('bookmark-new'):
|
||||||
img = self.xml.get_object('image7')
|
img = self.xml.get_object('image7')
|
||||||
img.set_from_icon_name('bookmark-new', gtk.ICON_SIZE_MENU)
|
img.set_from_icon_name('bookmark-new', Gtk.IconSize.MENU)
|
||||||
widget.set_sensitive(
|
widget.set_sensitive(
|
||||||
gajim.connections[self.account].private_storage_supported or \
|
gajim.connections[self.account].private_storage_supported or \
|
||||||
(gajim.connections[self.account].pubsub_supported and \
|
(gajim.connections[self.account].pubsub_supported and \
|
||||||
|
@ -425,13 +426,13 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.hpaned.set_position(hpaned_position)
|
self.hpaned.set_position(hpaned_position)
|
||||||
|
|
||||||
#status_image, shown_nick, type, nickname, avatar
|
#status_image, shown_nick, type, nickname, avatar
|
||||||
self.columns = [gtk.Image, str, str, str, gtk.gdk.Pixbuf]
|
self.columns = [Gtk.Image, str, str, str, GdkPixbuf.Pixbuf]
|
||||||
self.model = gtk.TreeStore(*self.columns)
|
self.model = Gtk.TreeStore(*self.columns)
|
||||||
self.model.set_sort_func(C_NICK, self.tree_compare_iters)
|
self.model.set_sort_func(C_NICK, self.tree_compare_iters)
|
||||||
self.model.set_sort_column_id(C_NICK, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(C_NICK, Gtk.SortType.ASCENDING)
|
||||||
|
|
||||||
# columns
|
# columns
|
||||||
column = gtk.TreeViewColumn()
|
column = Gtk.TreeViewColumn()
|
||||||
# list of renderers with attributes / properties in the form:
|
# list of renderers with attributes / properties in the form:
|
||||||
# (name, renderer_object, expand?, attribute_name, attribute_value,
|
# (name, renderer_object, expand?, attribute_name, attribute_value,
|
||||||
# cell_data_func, func_arg)
|
# cell_data_func, func_arg)
|
||||||
|
@ -441,9 +442,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.renderers_propertys = {}
|
self.renderers_propertys = {}
|
||||||
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
|
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
|
||||||
self.renderers_propertys[renderer_image] = ('width', 26)
|
self.renderers_propertys[renderer_image] = ('width', 26)
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
self.renderers_propertys[renderer_text] = ('ellipsize',
|
self.renderers_propertys[renderer_text] = ('ellipsize',
|
||||||
pango.ELLIPSIZE_END)
|
Pango.EllipsizeMode.END)
|
||||||
|
|
||||||
self.renderers_list += (
|
self.renderers_list += (
|
||||||
# status img
|
# status img
|
||||||
|
@ -454,7 +455,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
'markup', C_TEXT, tree_cell_data_func, self.list_treeview))
|
'markup', C_TEXT, tree_cell_data_func, self.list_treeview))
|
||||||
|
|
||||||
# avatar img
|
# avatar img
|
||||||
avater_renderer = ('avatar', gtk.CellRendererPixbuf(),
|
avater_renderer = ('avatar', Gtk.CellRendererPixbuf(),
|
||||||
False, 'pixbuf', C_AVATAR,
|
False, 'pixbuf', C_AVATAR,
|
||||||
tree_cell_data_func, self.list_treeview)
|
tree_cell_data_func, self.list_treeview)
|
||||||
|
|
||||||
|
@ -467,9 +468,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.list_treeview.append_column(column)
|
self.list_treeview.append_column(column)
|
||||||
|
|
||||||
# workaround to avoid gtk arrows to be shown
|
# workaround to avoid gtk arrows to be shown
|
||||||
column = gtk.TreeViewColumn() # 2nd COLUMN
|
column = Gtk.TreeViewColumn() # 2nd COLUMN
|
||||||
renderer = gtk.CellRendererPixbuf()
|
renderer = Gtk.CellRendererPixbuf()
|
||||||
column.pack_start(renderer, expand=False)
|
column.pack_start(renderer, False, True, 0)
|
||||||
self.list_treeview.append_column(column)
|
self.list_treeview.append_column(column)
|
||||||
column.set_visible(False)
|
column.set_visible(False)
|
||||||
self.list_treeview.set_expander_column(column)
|
self.list_treeview.set_expander_column(column)
|
||||||
|
@ -507,7 +508,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
def fill_column(self, col):
|
def fill_column(self, col):
|
||||||
for rend in self.renderers_list:
|
for rend in self.renderers_list:
|
||||||
col.pack_start(rend[1], expand=rend[2])
|
col.pack_start(rend[1], rend[2], True, 0)
|
||||||
col.add_attribute(rend[1], rend[3], rend[4])
|
col.add_attribute(rend[1], rend[3], rend[4])
|
||||||
col.set_cell_data_func(rend[1], rend[5], rend[6])
|
col.set_cell_data_func(rend[1], rend[5], rend[6])
|
||||||
# set renderers propertys
|
# set renderers propertys
|
||||||
|
@ -562,17 +563,17 @@ class GroupchatControl(ChatControlBase):
|
||||||
and the ability to insert a nick
|
and the ability to insert a nick
|
||||||
"""
|
"""
|
||||||
ChatControlBase.on_msg_textview_populate_popup(self, textview, menu)
|
ChatControlBase.on_msg_textview_populate_popup(self, textview, menu)
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
|
|
||||||
item = gtk.MenuItem(_('Insert Nickname'))
|
item = Gtk.MenuItem(_('Insert Nickname'))
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
submenu = gtk.Menu()
|
submenu = Gtk.Menu()
|
||||||
item.set_submenu(submenu)
|
item.set_submenu(submenu)
|
||||||
|
|
||||||
for nick in sorted(gajim.contacts.get_nick_list(self.account,
|
for nick in sorted(gajim.contacts.get_nick_list(self.account,
|
||||||
self.room_jid)):
|
self.room_jid)):
|
||||||
item = gtk.MenuItem(nick, use_underline=False)
|
item = Gtk.MenuItem(nick, use_underline=False)
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
id_ = item.connect('activate', self.append_nick_in_msg_textview,
|
id_ = item.connect('activate', self.append_nick_in_msg_textview,
|
||||||
nick)
|
nick)
|
||||||
|
@ -587,7 +588,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.resize_from_another_muc = False
|
self.resize_from_another_muc = False
|
||||||
# Reset the flag when everything will be redrawn, and in particular when
|
# Reset the flag when everything will be redrawn, and in particular when
|
||||||
# on_treeview_size_allocate will have been called.
|
# on_treeview_size_allocate will have been called.
|
||||||
gobject.idle_add(reset_flag)
|
GObject.idle_add(reset_flag)
|
||||||
|
|
||||||
def on_hpaned_notify(self, pane, gparamspec):
|
def on_hpaned_notify(self, pane, gparamspec):
|
||||||
"""
|
"""
|
||||||
|
@ -616,7 +617,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
"""
|
"""
|
||||||
Iterate over all contact rows in the tree model
|
Iterate over all contact rows in the tree model
|
||||||
"""
|
"""
|
||||||
role_iter = self.model.get_iter_root()
|
role_iter = self.model.get_iter_first()
|
||||||
while role_iter:
|
while role_iter:
|
||||||
contact_iter = self.model.iter_children(role_iter)
|
contact_iter = self.model.iter_children(role_iter)
|
||||||
while contact_iter:
|
while contact_iter:
|
||||||
|
@ -668,13 +669,13 @@ class GroupchatControl(ChatControlBase):
|
||||||
if chatstate == 'active' or (current_tab and has_focus):
|
if chatstate == 'active' or (current_tab and has_focus):
|
||||||
self.attention_flag = False
|
self.attention_flag = False
|
||||||
# get active color from gtk
|
# get active color from gtk
|
||||||
color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
|
color = self.parent_win.notebook.get_style().fg[Gtk.StateType.ACTIVE]
|
||||||
elif chatstate == 'newmsg' and (not has_focus or not current_tab) \
|
elif chatstate == 'newmsg' and (not has_focus or not current_tab) \
|
||||||
and not self.attention_flag:
|
and not self.attention_flag:
|
||||||
color_name = gajim.config.get_per('themes', theme,
|
color_name = gajim.config.get_per('themes', theme,
|
||||||
'state_muc_msg_color')
|
'state_muc_msg_color')
|
||||||
if color_name:
|
if color_name:
|
||||||
color = gtk.gdk.colormap_get_system().alloc_color(color_name)
|
color = Gdk.colormap_get_system().alloc_color(color_name)
|
||||||
|
|
||||||
if self.is_continued:
|
if self.is_continued:
|
||||||
# if this is a continued conversation
|
# if this is a continued conversation
|
||||||
|
@ -726,14 +727,14 @@ class GroupchatControl(ChatControlBase):
|
||||||
image = 'muc_inactive'
|
image = 'muc_inactive'
|
||||||
if '32' in images and image in images['32']:
|
if '32' in images and image in images['32']:
|
||||||
muc_icon = images['32'][image]
|
muc_icon = images['32'][image]
|
||||||
if muc_icon.get_storage_type() != gtk.IMAGE_EMPTY:
|
if muc_icon.get_storage_type() != Gtk.ImageType.EMPTY:
|
||||||
pix = muc_icon.get_pixbuf()
|
pix = muc_icon.get_pixbuf()
|
||||||
banner_status_img.set_from_pixbuf(pix)
|
banner_status_img.set_from_pixbuf(pix)
|
||||||
return
|
return
|
||||||
# we need to scale 16x16 to 32x32
|
# we need to scale 16x16 to 32x32
|
||||||
muc_icon = images['16'][image]
|
muc_icon = images['16'][image]
|
||||||
pix = muc_icon.get_pixbuf()
|
pix = muc_icon.get_pixbuf()
|
||||||
scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR)
|
scaled_pix = pix.scale_simple(32, 32, GdkPixbuf.InterpType.BILINEAR)
|
||||||
banner_status_img.set_from_pixbuf(scaled_pix)
|
banner_status_img.set_from_pixbuf(scaled_pix)
|
||||||
|
|
||||||
def get_continued_conversation_name(self):
|
def get_continued_conversation_name(self):
|
||||||
|
@ -758,8 +759,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
Draw the text in the fat line at the top of the window that houses the
|
Draw the text in the fat line at the top of the window that houses the
|
||||||
room jid, subject
|
room jid, subject
|
||||||
"""
|
"""
|
||||||
self.name_label.set_ellipsize(pango.ELLIPSIZE_END)
|
self.name_label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
self.banner_status_label.set_ellipsize(pango.ELLIPSIZE_END)
|
self.banner_status_label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
font_attrs, font_attrs_small = self.get_font_attrs()
|
font_attrs, font_attrs_small = self.get_font_attrs()
|
||||||
if self.is_continued:
|
if self.is_continued:
|
||||||
name = self.get_continued_conversation_name()
|
name = self.get_continued_conversation_name()
|
||||||
|
@ -770,7 +771,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
if self.subject:
|
if self.subject:
|
||||||
subject = helpers.reduce_chars_newlines(self.subject, max_lines=2)
|
subject = helpers.reduce_chars_newlines(self.subject, max_lines=2)
|
||||||
subject = gobject.markup_escape_text(subject)
|
subject = GObject.markup_escape_text(subject)
|
||||||
subject_text = self.urlfinder.sub(self.make_href, subject)
|
subject_text = self.urlfinder.sub(self.make_href, subject)
|
||||||
subject_text = '<span %s>%s</span>' % (font_attrs_small,
|
subject_text = '<span %s>%s</span>' % (font_attrs_small,
|
||||||
subject_text)
|
subject_text)
|
||||||
|
@ -807,8 +808,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
request_voice_separator = xml.get_object('request_voice_separator')
|
request_voice_separator = xml.get_object('request_voice_separator')
|
||||||
|
|
||||||
if gtkgui_helpers.gtk_icon_theme.has_icon('bookmark-new'):
|
if gtkgui_helpers.gtk_icon_theme.has_icon('bookmark-new'):
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
img.set_from_icon_name('bookmark-new', gtk.ICON_SIZE_MENU)
|
img.set_from_icon_name('bookmark-new', Gtk.IconSize.MENU)
|
||||||
bookmark_room_menuitem.set_image(img)
|
bookmark_room_menuitem.set_image(img)
|
||||||
|
|
||||||
if hide_buttonbar_items:
|
if hide_buttonbar_items:
|
||||||
|
@ -831,15 +832,15 @@ class GroupchatControl(ChatControlBase):
|
||||||
bookmark_separator.hide()
|
bookmark_separator.hide()
|
||||||
break
|
break
|
||||||
|
|
||||||
ag = gtk.accel_groups_from_object(self.parent_win.window)[0]
|
ag = Gtk.accel_groups_from_object(self.parent_win.window)[0]
|
||||||
change_nick_menuitem.add_accelerator('activate', ag, gtk.keysyms.n,
|
change_nick_menuitem.add_accelerator('activate', ag, Gdk.KEY_n,
|
||||||
gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK, gtk.ACCEL_VISIBLE)
|
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, Gtk.AccelFlags.VISIBLE)
|
||||||
change_subject_menuitem.add_accelerator('activate', ag,
|
change_subject_menuitem.add_accelerator('activate', ag,
|
||||||
gtk.keysyms.t, gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)
|
Gdk.KEY_t, Gdk.ModifierType.MOD1_MASK, Gtk.AccelFlags.VISIBLE)
|
||||||
bookmark_room_menuitem.add_accelerator('activate', ag, gtk.keysyms.b,
|
bookmark_room_menuitem.add_accelerator('activate', ag, Gdk.KEY_b,
|
||||||
gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
|
Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
|
||||||
history_menuitem.add_accelerator('activate', ag, gtk.keysyms.h,
|
history_menuitem.add_accelerator('activate', ag, Gdk.KEY_h,
|
||||||
gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
|
Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
|
||||||
|
|
||||||
if self.contact.jid in gajim.config.get_per('accounts', self.account,
|
if self.contact.jid in gajim.config.get_per('accounts', self.account,
|
||||||
'minimized_gc').split(' '):
|
'minimized_gc').split(' '):
|
||||||
|
@ -914,15 +915,15 @@ class GroupchatControl(ChatControlBase):
|
||||||
def destroy_menu(self, menu, change_nick_menuitem, change_subject_menuitem,
|
def destroy_menu(self, menu, change_nick_menuitem, change_subject_menuitem,
|
||||||
bookmark_room_menuitem, history_menuitem):
|
bookmark_room_menuitem, history_menuitem):
|
||||||
# destroy accelerators
|
# destroy accelerators
|
||||||
ag = gtk.accel_groups_from_object(self.parent_win.window)[0]
|
ag = Gtk.accel_groups_from_object(self.parent_win.window)[0]
|
||||||
change_nick_menuitem.remove_accelerator(ag, gtk.keysyms.n,
|
change_nick_menuitem.remove_accelerator(ag, Gdk.KEY_n,
|
||||||
gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK)
|
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)
|
||||||
change_subject_menuitem.remove_accelerator(ag, gtk.keysyms.t,
|
change_subject_menuitem.remove_accelerator(ag, Gdk.KEY_t,
|
||||||
gtk.gdk.MOD1_MASK)
|
Gdk.ModifierType.MOD1_MASK)
|
||||||
bookmark_room_menuitem.remove_accelerator(ag, gtk.keysyms.b,
|
bookmark_room_menuitem.remove_accelerator(ag, Gdk.KEY_b,
|
||||||
gtk.gdk.CONTROL_MASK)
|
Gdk.ModifierType.CONTROL_MASK)
|
||||||
history_menuitem.remove_accelerator(ag, gtk.keysyms.h,
|
history_menuitem.remove_accelerator(ag, Gdk.KEY_h,
|
||||||
gtk.gdk.CONTROL_MASK)
|
Gdk.ModifierType.CONTROL_MASK)
|
||||||
# destroy menu
|
# destroy menu
|
||||||
menu.destroy()
|
menu.destroy()
|
||||||
|
|
||||||
|
@ -966,15 +967,15 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.form_widget.connect('validated', on_send_dataform_clicked)
|
self.form_widget.connect('validated', on_send_dataform_clicked)
|
||||||
self.form_widget.show_all()
|
self.form_widget.show_all()
|
||||||
vbox = self.xml.get_object('gc_textviews_vbox')
|
vbox = self.xml.get_object('gc_textviews_vbox')
|
||||||
vbox.pack_start(self.form_widget, expand=False, fill=False)
|
vbox.pack_start(self.form_widget, False, True, 0)
|
||||||
|
|
||||||
valid_button = gtk.Button(stock=gtk.STOCK_OK)
|
valid_button = Gtk.Button(stock=Gtk.STOCK_OK)
|
||||||
valid_button.connect('clicked', on_send_dataform_clicked)
|
valid_button.connect('clicked', on_send_dataform_clicked)
|
||||||
self.btn_box = gtk.HButtonBox()
|
self.btn_box = Gtk.HButtonBox()
|
||||||
self.btn_box.set_layout(gtk.BUTTONBOX_END)
|
self.btn_box.set_layout(Gtk.ButtonBoxStyle.END)
|
||||||
self.btn_box.pack_start(valid_button)
|
self.btn_box.pack_start(valid_button, True, True, 0)
|
||||||
self.btn_box.show_all()
|
self.btn_box.show_all()
|
||||||
vbox.pack_start(self.btn_box, expand=False, fill=False)
|
vbox.pack_start(self.btn_box, False, False, 0)
|
||||||
if self.parent_win:
|
if self.parent_win:
|
||||||
self.parent_win.redraw_tab(self, 'attention')
|
self.parent_win.redraw_tab(self, 'attention')
|
||||||
else:
|
else:
|
||||||
|
@ -1037,7 +1038,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
||||||
|
|
||||||
def get_contact_iter(self, nick):
|
def get_contact_iter(self, nick):
|
||||||
role_iter = self.model.get_iter_root()
|
role_iter = self.model.get_iter_first()
|
||||||
while role_iter:
|
while role_iter:
|
||||||
user_iter = self.model.iter_children(role_iter)
|
user_iter = self.model.iter_children(role_iter)
|
||||||
while user_iter:
|
while user_iter:
|
||||||
|
@ -1303,7 +1304,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
def got_connected(self):
|
def got_connected(self):
|
||||||
# Make autorejoin stop.
|
# Make autorejoin stop.
|
||||||
if self.autorejoin:
|
if self.autorejoin:
|
||||||
gobject.source_remove(self.autorejoin)
|
GObject.source_remove(self.autorejoin)
|
||||||
self.autorejoin = None
|
self.autorejoin = None
|
||||||
|
|
||||||
gajim.gc_connected[self.account][self.room_jid] = True
|
gajim.gc_connected[self.account][self.room_jid] = True
|
||||||
|
@ -1349,7 +1350,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
if self.autorejoin is None and gajim.account_is_connected(self.account):
|
if self.autorejoin is None and gajim.account_is_connected(self.account):
|
||||||
ar_to = gajim.config.get('muc_autorejoin_timeout')
|
ar_to = gajim.config.get('muc_autorejoin_timeout')
|
||||||
if ar_to:
|
if ar_to:
|
||||||
self.autorejoin = gobject.timeout_add_seconds(ar_to,
|
self.autorejoin = GObject.timeout_add_seconds(ar_to,
|
||||||
self.rejoin)
|
self.rejoin)
|
||||||
|
|
||||||
def rejoin(self):
|
def rejoin(self):
|
||||||
|
@ -1403,7 +1404,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
else:
|
else:
|
||||||
image = state_images[gc_contact.show]
|
image = state_images[gc_contact.show]
|
||||||
|
|
||||||
name = gobject.markup_escape_text(gc_contact.name)
|
name = GObject.markup_escape_text(gc_contact.name)
|
||||||
|
|
||||||
# Strike name if blocked
|
# Strike name if blocked
|
||||||
fjid = self.room_jid + '/' + nick
|
fjid = self.room_jid + '/' + nick
|
||||||
|
@ -1422,14 +1423,14 @@ class GroupchatControl(ChatControlBase):
|
||||||
colorstring = "#%04x%04x%04x" % (color.red, color.green,
|
colorstring = "#%04x%04x%04x" % (color.red, color.green,
|
||||||
color.blue)
|
color.blue)
|
||||||
name += ('\n<span size="small" style="italic" foreground="%s">'
|
name += ('\n<span size="small" style="italic" foreground="%s">'
|
||||||
'%s</span>') % (colorstring, gobject.markup_escape_text(
|
'%s</span>') % (colorstring, GObject.markup_escape_text(
|
||||||
status))
|
status))
|
||||||
|
|
||||||
if image.get_storage_type() == gtk.IMAGE_PIXBUF and \
|
if image.get_storage_type() == Gtk.ImageType.PIXBUF and \
|
||||||
gc_contact.affiliation != 'none' and gajim.config.get(
|
gc_contact.affiliation != 'none' and gajim.config.get(
|
||||||
'show_affiliation_in_groupchat'):
|
'show_affiliation_in_groupchat'):
|
||||||
pixbuf1 = image.get_pixbuf().copy()
|
pixbuf1 = image.get_pixbuf().copy()
|
||||||
pixbuf2 = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 4, 4)
|
pixbuf2 = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, 4, 4)
|
||||||
if gc_contact.affiliation == 'owner':
|
if gc_contact.affiliation == 'owner':
|
||||||
pixbuf2.fill(0xff0000ff) # Red
|
pixbuf2.fill(0xff0000ff) # Red
|
||||||
elif gc_contact.affiliation == 'admin':
|
elif gc_contact.affiliation == 'admin':
|
||||||
|
@ -1438,8 +1439,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
pixbuf2.fill(0x00ff00ff) # Green
|
pixbuf2.fill(0x00ff00ff) # Green
|
||||||
pixbuf2.composite(pixbuf1, 12, 12, pixbuf2.get_property('width'),
|
pixbuf2.composite(pixbuf1, 12, 12, pixbuf2.get_property('width'),
|
||||||
pixbuf2.get_property('height'), 0, 0, 1.0, 1.0,
|
pixbuf2.get_property('height'), 0, 0, 1.0, 1.0,
|
||||||
gtk.gdk.INTERP_HYPER, 127)
|
GdkPixbuf.InterpType.HYPER, 127)
|
||||||
image = gtk.image_new_from_pixbuf(pixbuf1)
|
image = Gtk.image_new_from_pixbuf(pixbuf1)
|
||||||
self.model[iter_][C_IMG] = image
|
self.model[iter_][C_IMG] = image
|
||||||
self.model[iter_][C_TEXT] = name
|
self.model[iter_][C_TEXT] = name
|
||||||
|
|
||||||
|
@ -1829,7 +1830,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
return iter_
|
return iter_
|
||||||
|
|
||||||
def get_role_iter(self, role):
|
def get_role_iter(self, role):
|
||||||
role_iter = self.model.get_iter_root()
|
role_iter = self.model.get_iter_first()
|
||||||
while role_iter:
|
while role_iter:
|
||||||
role_name = self.model[role_iter][C_NICK].decode('utf-8')
|
role_name = self.model[role_iter][C_NICK].decode('utf-8')
|
||||||
if role == role_name:
|
if role == role_name:
|
||||||
|
@ -2150,7 +2151,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
# Textview is not sensitive, don't handle keypress
|
# Textview is not sensitive, don't handle keypress
|
||||||
return
|
return
|
||||||
# construct event instance from binding
|
# construct event instance from binding
|
||||||
event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) # it's always a key-press here
|
event = Gdk.Event(Gdk.KEY_PRESS) # it's always a key-press here
|
||||||
event.keyval = event_keyval
|
event.keyval = event_keyval
|
||||||
event.state = event_keymod
|
event.state = event_keymod
|
||||||
event.time = 0 # assign current time
|
event.time = 0 # assign current time
|
||||||
|
@ -2158,7 +2159,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
message_buffer = widget.get_buffer()
|
message_buffer = widget.get_buffer()
|
||||||
start_iter, end_iter = message_buffer.get_bounds()
|
start_iter, end_iter = message_buffer.get_bounds()
|
||||||
|
|
||||||
if event.keyval == gtk.keysyms.Tab: # TAB
|
if event.keyval == Gdk.KEY_Tab: # TAB
|
||||||
cursor_position = message_buffer.get_insert()
|
cursor_position = message_buffer.get_insert()
|
||||||
end_iter = message_buffer.get_iter_at_mark(cursor_position)
|
end_iter = message_buffer.get_iter_at_mark(cursor_position)
|
||||||
text = message_buffer.get_text(start_iter, end_iter, False).decode(
|
text = message_buffer.get_text(start_iter, end_iter, False).decode(
|
||||||
|
@ -2271,7 +2272,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.last_key_tabs = False
|
self.last_key_tabs = False
|
||||||
|
|
||||||
def on_list_treeview_key_press_event(self, widget, event):
|
def on_list_treeview_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
selection = widget.get_selection()
|
selection = widget.get_selection()
|
||||||
iter_ = selection.get_selected()[1]
|
iter_ = selection.get_selected()[1]
|
||||||
if iter_:
|
if iter_:
|
||||||
|
@ -2438,7 +2439,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
item = xml.get_object('send_file_menuitem')
|
item = xml.get_object('send_file_menuitem')
|
||||||
# add a special img for send file menuitem
|
# add a special img for send file menuitem
|
||||||
path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload')
|
path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload')
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
img.set_from_file(path_to_upload_img)
|
img.set_from_file(path_to_upload_img)
|
||||||
item.set_image(img)
|
item.set_image(img)
|
||||||
|
|
||||||
|
@ -2515,7 +2516,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif event.button == 1: # left click
|
elif event.button == 1: # left click
|
||||||
if gajim.single_click and not event.state & gtk.gdk.SHIFT_MASK:
|
if gajim.single_click and not event.get_state() & Gdk.ModifierType.SHIFT_MASK:
|
||||||
self.on_row_activated(widget, path)
|
self.on_row_activated(widget, path)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -2529,7 +2530,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
widget.collapse_row(path)
|
widget.collapse_row(path)
|
||||||
else:
|
else:
|
||||||
widget.expand_row(path, False)
|
widget.expand_row(path, False)
|
||||||
elif event.state & gtk.gdk.SHIFT_MASK:
|
elif event.get_state() & Gdk.ModifierType.SHIFT_MASK:
|
||||||
self.append_nick_in_msg_textview(self.msg_textview, nick)
|
self.append_nick_in_msg_textview(self.msg_textview, nick)
|
||||||
self.msg_textview.grab_focus()
|
self.msg_textview.grab_focus()
|
||||||
return True
|
return True
|
||||||
|
@ -2570,7 +2571,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
nick = self.model[iter_][C_NICK].decode('utf-8')
|
nick = self.model[iter_][C_NICK].decode('utf-8')
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = GObject.timeout_add(500,
|
||||||
self.show_tooltip, gajim.contacts.get_gc_contact(
|
self.show_tooltip, gajim.contacts.get_gc_contact(
|
||||||
account, self.room_jid, nick))
|
account, self.room_jid, nick))
|
||||||
|
|
||||||
|
@ -2585,7 +2586,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
# control has been destroyed since tooltip was requested
|
# control has been destroyed since tooltip was requested
|
||||||
return
|
return
|
||||||
pointer = self.list_treeview.get_pointer()
|
pointer = self.list_treeview.get_pointer()
|
||||||
props = self.list_treeview.get_path_at_pos(pointer[0], pointer[1])
|
props = self.list_treeview.get_path_at_pos(pointer[1], pointer[2])
|
||||||
# check if the current pointer is at the same path
|
# check if the current pointer is at the same path
|
||||||
# as it was before setting the timeout
|
# as it was before setting the timeout
|
||||||
if props and self.tooltip.id == props[0]:
|
if props and self.tooltip.id == props[0]:
|
||||||
|
|
|
@ -64,7 +64,7 @@ class GroupsPostWindow:
|
||||||
item.addChild('title', {}, [self.subject_entry.get_text()])
|
item.addChild('title', {}, [self.subject_entry.get_text()])
|
||||||
|
|
||||||
buf = self.contents_textview.get_buffer()
|
buf = self.contents_textview.get_buffer()
|
||||||
item.addChild('content', {}, [buf.get_text(buf.get_start_iter(), buf.get_end_iter())])
|
item.addChild('content', {}, [buf.get_text(buf.get_start_iter(), buf.get_end_iter(), True)])
|
||||||
|
|
||||||
# publish it to node
|
# publish it to node
|
||||||
gajim.connections[self.account].send_pb_publish(self.servicejid, self.groupid, item, '0')
|
gajim.connections[self.account].send_pb_publish(self.servicejid, self.groupid, item, '0')
|
||||||
|
|
|
@ -25,8 +25,8 @@ import os
|
||||||
import traceback
|
import traceback
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
from common import i18n # installs _() function
|
from common import i18n # installs _() function
|
||||||
import dialogs
|
import dialogs
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def _info(type_, value, tb):
|
||||||
_excepthook_save(type_, value, tb)
|
_excepthook_save(type_, value, tb)
|
||||||
return
|
return
|
||||||
|
|
||||||
dialog = dialogs.HigDialog(None, gtk.MESSAGE_WARNING, gtk.BUTTONS_NONE,
|
dialog = dialogs.HigDialog(None, Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
|
||||||
_('A programming error has been detected'),
|
_('A programming error has been detected'),
|
||||||
_('It probably is not fatal, but should be reported '
|
_('It probably is not fatal, but should be reported '
|
||||||
'to the developers nonetheless.'))
|
'to the developers nonetheless.'))
|
||||||
|
@ -50,20 +50,20 @@ def _info(type_, value, tb):
|
||||||
dialog.set_modal(False)
|
dialog.set_modal(False)
|
||||||
#FIXME: add icon to this button
|
#FIXME: add icon to this button
|
||||||
RESPONSE_REPORT_BUG = 42
|
RESPONSE_REPORT_BUG = 42
|
||||||
dialog.add_buttons(gtk.STOCK_CLOSE, gtk.BUTTONS_CLOSE,
|
dialog.add_buttons(Gtk.STOCK_CLOSE, Gtk.ButtonsType.CLOSE,
|
||||||
_('_Report Bug'), RESPONSE_REPORT_BUG)
|
_('_Report Bug'), RESPONSE_REPORT_BUG)
|
||||||
report_button = dialog.action_area.get_children()[0] # right to left
|
report_button = dialog.action_area.get_children()[0] # right to left
|
||||||
report_button.grab_focus()
|
report_button.grab_focus()
|
||||||
|
|
||||||
# Details
|
# Details
|
||||||
textview = gtk.TextView()
|
textview = Gtk.TextView()
|
||||||
textview.set_editable(False)
|
textview.set_editable(False)
|
||||||
textview.modify_font(pango.FontDescription('Monospace'))
|
textview.modify_font(Pango.FontDescription('Monospace'))
|
||||||
sw = gtk.ScrolledWindow()
|
sw = Gtk.ScrolledWindow()
|
||||||
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
sw.add(textview)
|
sw.add(textview)
|
||||||
frame = gtk.Frame()
|
frame = Gtk.Frame()
|
||||||
frame.set_shadow_type(gtk.SHADOW_IN)
|
frame.set_shadow_type(Gtk.ShadowType.IN)
|
||||||
frame.add(sw)
|
frame.add(sw)
|
||||||
frame.set_border_width(6)
|
frame.set_border_width(6)
|
||||||
textbuffer = textview.get_buffer()
|
textbuffer = textview.get_buffer()
|
||||||
|
@ -71,15 +71,15 @@ def _info(type_, value, tb):
|
||||||
traceback.print_exception(type_, value, tb, None, trace)
|
traceback.print_exception(type_, value, tb, None, trace)
|
||||||
textbuffer.set_text(trace.getvalue())
|
textbuffer.set_text(trace.getvalue())
|
||||||
textview.set_size_request(
|
textview.set_size_request(
|
||||||
gtk.gdk.screen_width() / 3,
|
Gdk.Screen.width() / 3,
|
||||||
gtk.gdk.screen_height() / 4)
|
Gdk.Screen.height() / 4)
|
||||||
expander = gtk.Expander(_('Details'))
|
expander = Gtk.Expander(_('Details'))
|
||||||
expander.add(frame)
|
expander.add(frame)
|
||||||
dialog.vbox.add(expander)
|
dialog.vbox.add(expander)
|
||||||
|
|
||||||
dialog.set_resizable(True)
|
dialog.set_resizable(True)
|
||||||
# on expand the details the dialog remains centered on screen
|
# on expand the details the dialog remains centered on screen
|
||||||
dialog.set_position(gtk.WIN_POS_CENTER_ALWAYS)
|
dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
|
||||||
|
|
||||||
def on_dialog_response(dialog, response):
|
def on_dialog_response(dialog, response):
|
||||||
if response == RESPONSE_REPORT_BUG:
|
if response == RESPONSE_REPORT_BUG:
|
||||||
|
|
|
@ -28,10 +28,12 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
import xml.sax.saxutils
|
import xml.sax.saxutils
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import GdkPixbuf
|
||||||
import glib
|
import glib
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -41,13 +43,13 @@ log = logging.getLogger('gajim.gtkgui_helpers')
|
||||||
from common import i18n
|
from common import i18n
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
|
||||||
gtk_icon_theme = gtk.icon_theme_get_default()
|
gtk_icon_theme = Gtk.IconTheme.get_default()
|
||||||
gtk_icon_theme.append_search_path(gajim.ICONS_DIR)
|
gtk_icon_theme.append_search_path(gajim.ICONS_DIR)
|
||||||
|
|
||||||
def get_icon_pixmap(icon_name, size=16):
|
def get_icon_pixmap(icon_name, size=16):
|
||||||
try:
|
try:
|
||||||
return gtk_icon_theme.load_icon(icon_name, size, 0)
|
return gtk_icon_theme.load_icon(icon_name, size, 0)
|
||||||
except gobject.GError, e:
|
except GObject.GError, e:
|
||||||
log.error('Unable to load icon %s: %s' % (icon_name, str(e)))
|
log.error('Unable to load icon %s: %s' % (icon_name, str(e)))
|
||||||
|
|
||||||
def get_icon_path(icon_name, size=16):
|
def get_icon_path(icon_name, size=16):
|
||||||
|
@ -58,7 +60,7 @@ def get_icon_path(icon_name, size=16):
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
return icon_info.get_filename()
|
return icon_info.get_filename()
|
||||||
except gobject.GError, e:
|
except GObject.GError, e:
|
||||||
log.error("Unable to find icon %s: %s" % (icon_name, str(e)))
|
log.error("Unable to find icon %s: %s" % (icon_name, str(e)))
|
||||||
|
|
||||||
import vcard
|
import vcard
|
||||||
|
@ -76,11 +78,11 @@ if os.name == 'nt':
|
||||||
|
|
||||||
from common import helpers
|
from common import helpers
|
||||||
|
|
||||||
screen_w = gtk.gdk.screen_width()
|
screen_w = Gdk.Screen.width()
|
||||||
screen_h = gtk.gdk.screen_height()
|
screen_h = Gdk.Screen.height()
|
||||||
|
|
||||||
def add_image_to_menuitem(menuitem, icon_name):
|
def add_image_to_menuitem(menuitem, icon_name):
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
path_img = get_icon_path(icon_name)
|
path_img = get_icon_path(icon_name)
|
||||||
img.set_from_file(path_img)
|
img.set_from_file(path_img)
|
||||||
menuitem.set_image(img)
|
menuitem.set_image(img)
|
||||||
|
@ -91,7 +93,7 @@ def add_image_to_button(button, icon_name):
|
||||||
GUI_DIR = os.path.join(gajim.DATA_DIR, 'gui')
|
GUI_DIR = os.path.join(gajim.DATA_DIR, 'gui')
|
||||||
def get_gtk_builder(file_name, widget=None):
|
def get_gtk_builder(file_name, widget=None):
|
||||||
file_path = os.path.join(GUI_DIR, file_name)
|
file_path = os.path.join(GUI_DIR, file_name)
|
||||||
builder = gtk.Builder()
|
builder = Gtk.Builder()
|
||||||
builder.set_translation_domain(i18n.APP)
|
builder.set_translation_domain(i18n.APP)
|
||||||
if widget:
|
if widget:
|
||||||
builder.add_objects_from_file(file_path, [widget])
|
builder.add_objects_from_file(file_path, [widget])
|
||||||
|
@ -104,15 +106,15 @@ def get_completion_liststore(entry):
|
||||||
Create a completion model for entry widget completion list consists of
|
Create a completion model for entry widget completion list consists of
|
||||||
(Pixbuf, Text) rows
|
(Pixbuf, Text) rows
|
||||||
"""
|
"""
|
||||||
completion = gtk.EntryCompletion()
|
completion = Gtk.EntryCompletion()
|
||||||
liststore = gtk.ListStore(gtk.gdk.Pixbuf, str)
|
liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
|
||||||
|
|
||||||
render_pixbuf = gtk.CellRendererPixbuf()
|
render_pixbuf = Gtk.CellRendererPixbuf()
|
||||||
completion.pack_start(render_pixbuf, expand = False)
|
completion.pack_start(render_pixbuf, False, True, 0)
|
||||||
completion.add_attribute(render_pixbuf, 'pixbuf', 0)
|
completion.add_attribute(render_pixbuf, 'pixbuf', 0)
|
||||||
|
|
||||||
render_text = gtk.CellRendererText()
|
render_text = Gtk.CellRendererText()
|
||||||
completion.pack_start(render_text, expand = True)
|
completion.pack_start(render_text, True, True, 0)
|
||||||
completion.add_attribute(render_text, 'text', 1)
|
completion.add_attribute(render_text, 'text', 1)
|
||||||
completion.set_property('text_column', 1)
|
completion.set_property('text_column', 1)
|
||||||
completion.set_model(liststore)
|
completion.set_model(liststore)
|
||||||
|
@ -138,7 +140,7 @@ def popup_emoticons_under_button(menu, button, parent_win):
|
||||||
|
|
||||||
## should we pop down or up?
|
## should we pop down or up?
|
||||||
if (y + button.allocation.height + menu_height
|
if (y + button.allocation.height + menu_height
|
||||||
< gtk.gdk.screen_height()):
|
< Gdk.Screen.height()):
|
||||||
# now move the menu below the button
|
# now move the menu below the button
|
||||||
y += button.allocation.height
|
y += button.allocation.height
|
||||||
else:
|
else:
|
||||||
|
@ -156,14 +158,14 @@ def get_theme_font_for_option(theme, option):
|
||||||
Return string description of the font, stored in theme preferences
|
Return string description of the font, stored in theme preferences
|
||||||
"""
|
"""
|
||||||
font_name = gajim.config.get_per('themes', theme, option)
|
font_name = gajim.config.get_per('themes', theme, option)
|
||||||
font_desc = pango.FontDescription()
|
font_desc = Pango.FontDescription()
|
||||||
font_prop_str = gajim.config.get_per('themes', theme, option + 'attrs')
|
font_prop_str = gajim.config.get_per('themes', theme, option + 'attrs')
|
||||||
if font_prop_str:
|
if font_prop_str:
|
||||||
if font_prop_str.find('B') != -1:
|
if font_prop_str.find('B') != -1:
|
||||||
font_desc.set_weight(pango.WEIGHT_BOLD)
|
font_desc.set_weight(Pango.Weight.BOLD)
|
||||||
if font_prop_str.find('I') != -1:
|
if font_prop_str.find('I') != -1:
|
||||||
font_desc.set_style(pango.STYLE_ITALIC)
|
font_desc.set_style(Pango.Style.ITALIC)
|
||||||
fd = pango.FontDescription(font_name)
|
fd = Pango.FontDescription(font_name)
|
||||||
fd.merge(font_desc, True)
|
fd.merge(font_desc, True)
|
||||||
return fd.to_string()
|
return fd.to_string()
|
||||||
|
|
||||||
|
@ -188,7 +190,7 @@ def get_default_font():
|
||||||
if xdg_config_home == '':
|
if xdg_config_home == '':
|
||||||
xdg_config_home = os.path.expanduser('~/.config') # default
|
xdg_config_home = os.path.expanduser('~/.config') # default
|
||||||
xfce_config_file = os.path.join(xdg_config_home,
|
xfce_config_file = os.path.join(xdg_config_home,
|
||||||
'xfce4/mcs_settings/gtk.xml')
|
'xfce4/mcs_settings/Gtk.xml')
|
||||||
|
|
||||||
kde_config_file = os.path.expanduser('~/.kde/share/config/kdeglobals')
|
kde_config_file = os.path.expanduser('~/.kde/share/config/kdeglobals')
|
||||||
|
|
||||||
|
@ -406,15 +408,15 @@ def get_abspath_for_script(scriptname, want_type = False):
|
||||||
|
|
||||||
def get_pixbuf_from_data(file_data, want_type = False):
|
def get_pixbuf_from_data(file_data, want_type = False):
|
||||||
"""
|
"""
|
||||||
Get image data and returns gtk.gdk.Pixbuf if want_type is True it also
|
Get image data and returns GdkPixbuf.Pixbuf if want_type is True it also
|
||||||
returns 'jpeg', 'png' etc
|
returns 'jpeg', 'png' etc
|
||||||
"""
|
"""
|
||||||
pixbufloader = gtk.gdk.PixbufLoader()
|
pixbufloader = GdkPixbuf.PixbufLoader()
|
||||||
try:
|
try:
|
||||||
pixbufloader.write(file_data)
|
pixbufloader.write(file_data)
|
||||||
pixbufloader.close()
|
pixbufloader.close()
|
||||||
pixbuf = pixbufloader.get_pixbuf()
|
pixbuf = pixbufloader.get_pixbuf()
|
||||||
except gobject.GError: # 'unknown image format'
|
except GObject.GError: # 'unknown image format'
|
||||||
pixbufloader.close()
|
pixbufloader.close()
|
||||||
pixbuf = None
|
pixbuf = None
|
||||||
if want_type:
|
if want_type:
|
||||||
|
@ -429,9 +431,9 @@ def get_pixbuf_from_data(file_data, want_type = False):
|
||||||
return pixbuf
|
return pixbuf
|
||||||
|
|
||||||
def get_invisible_cursor():
|
def get_invisible_cursor():
|
||||||
pixmap = gtk.gdk.Pixmap(None, 1, 1, 1)
|
pixmap = Gdk.Pixmap(None, 1, 1, 1)
|
||||||
color = gtk.gdk.Color()
|
color = Gdk.Color()
|
||||||
cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0)
|
cursor = Gdk.Cursor.new(pixmap, pixmap, color, color, 0, 0)
|
||||||
return cursor
|
return cursor
|
||||||
|
|
||||||
def get_current_desktop(window):
|
def get_current_desktop(window):
|
||||||
|
@ -457,10 +459,16 @@ def possibly_move_window_in_current_desktop(window):
|
||||||
|
|
||||||
NOTE: Window is a GDK window.
|
NOTE: Window is a GDK window.
|
||||||
"""
|
"""
|
||||||
|
#TODO: property_get doesn't work:
|
||||||
|
#prop_atom = Gdk.Atom.intern('_NET_CURRENT_DESKTOP', False)
|
||||||
|
#type_atom = Gdk.Atom.intern("CARDINAL", False)
|
||||||
|
#w = Gdk.Screen.get_default().get_root_window()
|
||||||
|
#Gdk.property_get(w, prop_atom, type_atom, 0, 9999, False)
|
||||||
|
return False
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
return False
|
return False
|
||||||
|
|
||||||
root_window = gtk.gdk.screen_get_default().get_root_window()
|
root_window = Gdk.Screen.get_default().get_root_window()
|
||||||
# current user's vd
|
# current user's vd
|
||||||
current_virtual_desktop_no = get_current_desktop(root_window)
|
current_virtual_desktop_no = get_current_desktop(root_window)
|
||||||
|
|
||||||
|
@ -514,20 +522,20 @@ def get_fade_color(treeview, selected, focused):
|
||||||
Get a gdk color that is between foreground and background in 0.3
|
Get a gdk color that is between foreground and background in 0.3
|
||||||
0.7 respectively colors of the cell for the given treeview
|
0.7 respectively colors of the cell for the given treeview
|
||||||
"""
|
"""
|
||||||
style = treeview.style
|
style = treeview.get_style()
|
||||||
if selected:
|
if selected:
|
||||||
if focused: # is the window focused?
|
if focused: # is the window focused?
|
||||||
state = gtk.STATE_SELECTED
|
state = Gtk.StateType.SELECTED
|
||||||
else: # is it not? NOTE: many gtk themes change bg on this
|
else: # is it not? NOTE: many gtk themes change bg on this
|
||||||
state = gtk.STATE_ACTIVE
|
state = Gtk.StateType.ACTIVE
|
||||||
else:
|
else:
|
||||||
state = gtk.STATE_NORMAL
|
state = Gtk.StateType.NORMAL
|
||||||
bg = style.base[state]
|
bg = style.base[state]
|
||||||
fg = style.text[state]
|
fg = style.text[state]
|
||||||
|
|
||||||
p = 0.3 # background
|
p = 0.3 # background
|
||||||
q = 0.7 # foreground # p + q should do 1.0
|
q = 0.7 # foreground # p + q should do 1.0
|
||||||
return gtk.gdk.Color(int(bg.red*p + fg.red*q),
|
return Gdk.Color(int(bg.red*p + fg.red*q),
|
||||||
int(bg.green*p + fg.green*q),
|
int(bg.green*p + fg.green*q),
|
||||||
int(bg.blue*p + fg.blue*q))
|
int(bg.blue*p + fg.blue*q))
|
||||||
|
|
||||||
|
@ -557,7 +565,7 @@ def get_scaled_pixbuf(pixbuf, kind):
|
||||||
else:
|
else:
|
||||||
h = height
|
h = height
|
||||||
w = int(h * ratio)
|
w = int(h * ratio)
|
||||||
scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER)
|
scaled_buf = pixbuf.scale_simple(w, h, GdkPixbuf.InterpType.HYPER)
|
||||||
return scaled_buf
|
return scaled_buf
|
||||||
|
|
||||||
def get_avatar_pixbuf_from_cache(fjid, use_local=True):
|
def get_avatar_pixbuf_from_cache(fjid, use_local=True):
|
||||||
|
@ -743,9 +751,9 @@ Description=xmpp
|
||||||
gajim.config.set('check_if_gajim_is_default', False)
|
gajim.config.set('check_if_gajim_is_default', False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gconf
|
from gi.repository import GConf
|
||||||
# in try because daemon may not be there
|
# in try because daemon may not be there
|
||||||
client = gconf.client_get_default()
|
client = GConf.Client.get_default()
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -786,7 +794,7 @@ def get_state_image_from_file_path_show(file_path, show):
|
||||||
files = []
|
files = []
|
||||||
files.append(os.path.join(file_path, state_file + '.png'))
|
files.append(os.path.join(file_path, state_file + '.png'))
|
||||||
files.append(os.path.join(file_path, state_file + '.gif'))
|
files.append(os.path.join(file_path, state_file + '.gif'))
|
||||||
image = gtk.Image()
|
image = Gtk.Image()
|
||||||
image.set_from_pixbuf(None)
|
image.set_from_pixbuf(None)
|
||||||
for file_ in files:
|
for file_ in files:
|
||||||
if os.path.exists(file_):
|
if os.path.exists(file_):
|
||||||
|
@ -799,7 +807,7 @@ def get_possible_button_event(event):
|
||||||
"""
|
"""
|
||||||
Mouse or keyboard caused the event?
|
Mouse or keyboard caused the event?
|
||||||
"""
|
"""
|
||||||
if event.type == gtk.gdk.KEY_PRESS:
|
if event.type == Gdk.KEY_PRESS:
|
||||||
return 0 # no event.button so pass 0
|
return 0 # no event.button so pass 0
|
||||||
# BUTTON_PRESS event, so pass event.button
|
# BUTTON_PRESS event, so pass event.button
|
||||||
return event.button
|
return event.button
|
||||||
|
@ -870,9 +878,9 @@ def on_avatar_save_as_menuitem_activate(widget, jid, default_name=''):
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
dialog = dialogs.FileChooserDialog(title_text=_('Save Image as...'),
|
dialog = dialogs.FileChooserDialog(title_text=_('Save Image as...'),
|
||||||
action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL,
|
action=Gtk.FileChooserAction.SAVE, buttons=(Gtk.STOCK_CANCEL,
|
||||||
gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK),
|
Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK),
|
||||||
default_response=gtk.RESPONSE_OK,
|
default_response=Gtk.ResponseType.OK,
|
||||||
current_folder=gajim.config.get('last_save_dir'), on_response_ok=on_ok,
|
current_folder=gajim.config.get('last_save_dir'), on_response_ok=on_ok,
|
||||||
on_response_cancel=on_cancel)
|
on_response_cancel=on_cancel)
|
||||||
|
|
||||||
|
@ -881,16 +889,16 @@ def on_avatar_save_as_menuitem_activate(widget, jid, default_name=''):
|
||||||
on_cancel(widget))
|
on_cancel(widget))
|
||||||
|
|
||||||
def on_bm_header_changed_state(widget, event):
|
def on_bm_header_changed_state(widget, event):
|
||||||
widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state
|
widget.set_state(Gtk.StateType.NORMAL) #do not allow selected_state
|
||||||
|
|
||||||
def create_combobox(value_list, selected_value = None):
|
def create_combobox(value_list, selected_value = None):
|
||||||
"""
|
"""
|
||||||
Value_list is [(label1, value1)]
|
Value_list is [(label1, value1)]
|
||||||
"""
|
"""
|
||||||
liststore = gtk.ListStore(str, str)
|
liststore = Gtk.ListStore(str, str)
|
||||||
combobox = gtk.ComboBox(liststore)
|
combobox = Gtk.ComboBox(liststore)
|
||||||
cell = gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
combobox.pack_start(cell, True)
|
combobox.pack_start(cell, True, True, 0)
|
||||||
combobox.add_attribute(cell, 'text', 0)
|
combobox.add_attribute(cell, 'text', 0)
|
||||||
i = -1
|
i = -1
|
||||||
for value in value_list:
|
for value in value_list:
|
||||||
|
@ -906,14 +914,14 @@ def create_list_multi(value_list, selected_values=None):
|
||||||
"""
|
"""
|
||||||
Value_list is [(label1, value1)]
|
Value_list is [(label1, value1)]
|
||||||
"""
|
"""
|
||||||
liststore = gtk.ListStore(str, str)
|
liststore = Gtk.ListStore(str, str)
|
||||||
treeview = gtk.TreeView(liststore)
|
treeview = Gtk.TreeView(liststore)
|
||||||
treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
|
||||||
treeview.set_headers_visible(False)
|
treeview.set_headers_visible(False)
|
||||||
col = gtk.TreeViewColumn()
|
col = Gtk.TreeViewColumn()
|
||||||
treeview.append_column(col)
|
treeview.append_column(col)
|
||||||
cell = gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
col.pack_start(cell, True)
|
col.pack_start(cell, True, True, 0)
|
||||||
col.set_attributes(cell, text=0)
|
col.set_attributes(cell, text=0)
|
||||||
for value in value_list:
|
for value in value_list:
|
||||||
iter = liststore.append(value)
|
iter = liststore.append(value)
|
||||||
|
@ -982,7 +990,7 @@ def load_icons_meta():
|
||||||
if not os.path.isfile(path_opened):
|
if not os.path.isfile(path_opened):
|
||||||
path_opened = os.path.join(path, 'opened.png')
|
path_opened = os.path.join(path, 'opened.png')
|
||||||
if os.path.isfile(path_opened):
|
if os.path.isfile(path_opened):
|
||||||
pixo = gtk.gdk.pixbuf_new_from_file(path_opened)
|
pixo = GdkPixbuf.Pixbuf.new_from_file(path_opened)
|
||||||
else:
|
else:
|
||||||
pixo = None
|
pixo = None
|
||||||
# Same thing for closed
|
# Same thing for closed
|
||||||
|
@ -990,7 +998,7 @@ def load_icons_meta():
|
||||||
if not os.path.isfile(path_closed):
|
if not os.path.isfile(path_closed):
|
||||||
path_closed = os.path.join(path, 'closed.png')
|
path_closed = os.path.join(path, 'closed.png')
|
||||||
if os.path.isfile(path_closed):
|
if os.path.isfile(path_closed):
|
||||||
pixc = gtk.gdk.pixbuf_new_from_file(path_closed)
|
pixc = GdkPixbuf.Pixbuf.new_from_file(path_closed)
|
||||||
else:
|
else:
|
||||||
pixc = None
|
pixc = None
|
||||||
return pixo, pixc
|
return pixo, pixc
|
||||||
|
@ -1007,19 +1015,19 @@ def _load_icon_list(icons_list, path, pixbuf2 = None):
|
||||||
files = []
|
files = []
|
||||||
files.append(path + icon_file + '.gif')
|
files.append(path + icon_file + '.gif')
|
||||||
files.append(path + icon_file + '.png')
|
files.append(path + icon_file + '.png')
|
||||||
image = gtk.Image()
|
image = Gtk.Image()
|
||||||
image.show()
|
image.show()
|
||||||
imgs[icon] = image
|
imgs[icon] = image
|
||||||
for file_ in files: # loop seeking for either gif or png
|
for file_ in files: # loop seeking for either gif or png
|
||||||
if os.path.exists(file_):
|
if os.path.exists(file_):
|
||||||
image.set_from_file(file_)
|
image.set_from_file(file_)
|
||||||
if pixbuf2 and image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
if pixbuf2 and image.get_storage_type() == Gtk.ImageType.PIXBUF:
|
||||||
# add pixbuf2 on top-left corner of image
|
# add pixbuf2 on top-left corner of image
|
||||||
pixbuf1 = image.get_pixbuf()
|
pixbuf1 = image.get_pixbuf()
|
||||||
pixbuf2.composite(pixbuf1, 0, 0,
|
pixbuf2.composite(pixbuf1, 0, 0,
|
||||||
pixbuf2.get_property('width'),
|
pixbuf2.get_property('width'),
|
||||||
pixbuf2.get_property('height'), 0, 0, 1.0, 1.0,
|
pixbuf2.get_property('height'), 0, 0, 1.0, 1.0,
|
||||||
gtk.gdk.INTERP_NEAREST, 255)
|
GdkPixbuf.InterpType.NEAREST, 255)
|
||||||
image.set_from_pixbuf(pixbuf1)
|
image.set_from_pixbuf(pixbuf1)
|
||||||
break
|
break
|
||||||
return imgs
|
return imgs
|
||||||
|
@ -1058,21 +1066,21 @@ def make_jabber_state_images():
|
||||||
else:
|
else:
|
||||||
# Resize 32x32 icons to 24x24
|
# Resize 32x32 icons to 24x24
|
||||||
for each in gajim.interface.jabber_state_images['32']:
|
for each in gajim.interface.jabber_state_images['32']:
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
pix = gajim.interface.jabber_state_images['32'][each]
|
pix = gajim.interface.jabber_state_images['32'][each]
|
||||||
pix_type = pix.get_storage_type()
|
pix_type = pix.get_storage_type()
|
||||||
if pix_type == gtk.IMAGE_ANIMATION:
|
if pix_type == Gtk.ImageType.ANIMATION:
|
||||||
animation = pix.get_animation()
|
animation = pix.get_animation()
|
||||||
pixbuf = animation.get_static_image()
|
pixbuf = animation.get_static_image()
|
||||||
elif pix_type == gtk.IMAGE_EMPTY:
|
elif pix_type == Gtk.ImageType.EMPTY:
|
||||||
pix = gajim.interface.jabber_state_images['16'][each]
|
pix = gajim.interface.jabber_state_images['16'][each]
|
||||||
pix_16_type = pix.get_storage_type()
|
pix_16_type = pix.get_storage_type()
|
||||||
if pix_16_type == gtk.IMAGE_ANIMATION:
|
if pix_16_type == Gtk.ImageType.ANIMATION:
|
||||||
animation = pix.get_animation()
|
animation = pix.get_animation()
|
||||||
pixbuf = animation.get_static_image()
|
pixbuf = animation.get_static_image()
|
||||||
else:
|
else:
|
||||||
pixbuf = pix.get_pixbuf()
|
pixbuf = pix.get_pixbuf()
|
||||||
scaled_pix = pixbuf.scale_simple(24, 24, gtk.gdk.INTERP_BILINEAR)
|
scaled_pix = pixbuf.scale_simple(24, 24, GdkPixbuf.InterpType.BILINEAR)
|
||||||
img.set_from_pixbuf(scaled_pix)
|
img.set_from_pixbuf(scaled_pix)
|
||||||
gajim.interface.jabber_state_images['24'][each] = img
|
gajim.interface.jabber_state_images['24'][each] = img
|
||||||
|
|
||||||
|
@ -1085,11 +1093,11 @@ def label_set_autowrap(widget):
|
||||||
Make labels automatically re-wrap if their containers are resized.
|
Make labels automatically re-wrap if their containers are resized.
|
||||||
Accepts label or container widgets
|
Accepts label or container widgets
|
||||||
"""
|
"""
|
||||||
if isinstance (widget, gtk.Container):
|
if isinstance (widget, Gtk.Container):
|
||||||
children = widget.get_children()
|
children = widget.get_children()
|
||||||
for i in xrange (len (children)):
|
for i in xrange (len (children)):
|
||||||
label_set_autowrap(children[i])
|
label_set_autowrap(children[i])
|
||||||
elif isinstance(widget, gtk.Label):
|
elif isinstance(widget, Gtk.Label):
|
||||||
widget.set_line_wrap(True)
|
widget.set_line_wrap(True)
|
||||||
widget.connect_after('size-allocate', __label_size_allocate)
|
widget.connect_after('size-allocate', __label_size_allocate)
|
||||||
|
|
||||||
|
@ -1101,13 +1109,13 @@ def __label_size_allocate(widget, allocation):
|
||||||
|
|
||||||
lw_old, lh_old = layout.get_size()
|
lw_old, lh_old = layout.get_size()
|
||||||
# fixed width labels
|
# fixed width labels
|
||||||
if lw_old/pango.SCALE == allocation.width:
|
if lw_old/Pango.SCALE == allocation.width:
|
||||||
return
|
return
|
||||||
|
|
||||||
# set wrap width to the pango.Layout of the labels ###
|
# set wrap width to the Pango.Layout of the labels ###
|
||||||
widget.set_alignment(0.0, 0.0)
|
widget.set_alignment(0.0, 0.0)
|
||||||
layout.set_width (allocation.width * pango.SCALE)
|
layout.set_width (allocation.width * Pango.SCALE)
|
||||||
lh = layout.get_size()[1]
|
lh = layout.get_size()[1]
|
||||||
|
|
||||||
if lh_old != lh:
|
if lh_old != lh:
|
||||||
widget.set_size_request (-1, lh / pango.SCALE)
|
widget.set_size_request (-1, lh / Pango.SCALE)
|
||||||
|
|
|
@ -41,8 +41,9 @@ import time
|
||||||
import math
|
import math
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GdkPixbuf
|
||||||
|
from gi.repository import GObject
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
@ -228,7 +229,7 @@ class Interface:
|
||||||
# we stop blocking notifications of any kind
|
# we stop blocking notifications of any kind
|
||||||
# this prevents from getting the roster items as 'just signed in'
|
# this prevents from getting the roster items as 'just signed in'
|
||||||
# contacts. 30 seconds should be enough time
|
# contacts. 30 seconds should be enough time
|
||||||
gobject.timeout_add_seconds(30,
|
GObject.timeout_add_seconds(30,
|
||||||
self.unblock_signed_in_notifications, account)
|
self.unblock_signed_in_notifications, account)
|
||||||
|
|
||||||
if account in self.show_vcard_when_connect and obj.show not in (
|
if account in self.show_vcard_when_connect and obj.show not in (
|
||||||
|
@ -369,7 +370,7 @@ class Interface:
|
||||||
# popup notifications for 30s
|
# popup notifications for 30s
|
||||||
account_jid = account + '/' + jid
|
account_jid = account + '/' + jid
|
||||||
gajim.block_signed_in_notifications[account_jid] = True
|
gajim.block_signed_in_notifications[account_jid] = True
|
||||||
gobject.timeout_add_seconds(30,
|
GObject.timeout_add_seconds(30,
|
||||||
self.unblock_signed_in_notifications, account_jid)
|
self.unblock_signed_in_notifications, account_jid)
|
||||||
|
|
||||||
highest = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
highest = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
|
@ -964,13 +965,13 @@ class Interface:
|
||||||
# then the file is not corrupt
|
# then the file is not corrupt
|
||||||
jid = unicode(file_props.sender)
|
jid = unicode(file_props.sender)
|
||||||
if file_props.hash_ == hash_:
|
if file_props.hash_ == hash_:
|
||||||
gobject.idle_add(self.popup_ft_result, account, jid, file_props)
|
GObject.idle_add(self.popup_ft_result, account, jid, file_props)
|
||||||
gobject.idle_add(ft_win.set_status, file_props, 'ok')
|
GObject.idle_add(ft_win.set_status, file_props, 'ok')
|
||||||
else:
|
else:
|
||||||
# wrong hash, we need to get the file again!
|
# wrong hash, we need to get the file again!
|
||||||
file_props.error = -10
|
file_props.error = -10
|
||||||
gobject.idle_add(self.popup_ft_result, account, jid, file_props)
|
GObject.idle_add(self.popup_ft_result, account, jid, file_props)
|
||||||
gobject.idle_add(ft_win.set_status, file_props, 'hash_error')
|
GObject.idle_add(ft_win.set_status, file_props, 'hash_error')
|
||||||
# End jingle session
|
# End jingle session
|
||||||
if session:
|
if session:
|
||||||
session.end_session()
|
session.end_session()
|
||||||
|
@ -1109,7 +1110,7 @@ class Interface:
|
||||||
if gajim.config.get('ask_offline_status_on_connection'):
|
if gajim.config.get('ask_offline_status_on_connection'):
|
||||||
# Ask offline status in 1 minute so w'are sure we got all online
|
# Ask offline status in 1 minute so w'are sure we got all online
|
||||||
# presences
|
# presences
|
||||||
gobject.timeout_add_seconds(60, self.ask_offline_status, account)
|
GObject.timeout_add_seconds(60, self.ask_offline_status, account)
|
||||||
if state != common.sleepy.STATE_UNKNOWN and connected in (2, 3):
|
if state != common.sleepy.STATE_UNKNOWN and connected in (2, 3):
|
||||||
# we go online or free for chat, so we activate auto status
|
# we go online or free for chat, so we activate auto status
|
||||||
gajim.sleeper_state[account] = 'online'
|
gajim.sleeper_state[account] = 'online'
|
||||||
|
@ -1757,7 +1758,7 @@ class Interface:
|
||||||
self.roster.draw_contact(jid, account)
|
self.roster.draw_contact(jid, account)
|
||||||
if w:
|
if w:
|
||||||
w.set_active_tab(ctrl)
|
w.set_active_tab(ctrl)
|
||||||
w.window.window.focus(gtk.get_current_event_time())
|
w.window.window.focus(Gtk.get_current_event_time())
|
||||||
# Using isinstance here because we want to catch all derived types
|
# Using isinstance here because we want to catch all derived types
|
||||||
if isinstance(ctrl, ChatControlBase):
|
if isinstance(ctrl, ChatControlBase):
|
||||||
tv = ctrl.conv_textview
|
tv = ctrl.conv_textview
|
||||||
|
@ -1770,13 +1771,13 @@ class Interface:
|
||||||
def image_is_ok(self, image):
|
def image_is_ok(self, image):
|
||||||
if not os.path.exists(image):
|
if not os.path.exists(image):
|
||||||
return False
|
return False
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
try:
|
try:
|
||||||
img.set_from_file(image)
|
img.set_from_file(image)
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
t = img.get_storage_type()
|
t = img.get_storage_type()
|
||||||
if t != gtk.IMAGE_PIXBUF and t != gtk.IMAGE_ANIMATION:
|
if t != Gtk.ImageType.PIXBUF and t != Gtk.ImageType.ANIMATION:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1874,7 +1875,6 @@ class Interface:
|
||||||
emoticons_pattern_postmatch = ''
|
emoticons_pattern_postmatch = ''
|
||||||
emoticon_length = 0
|
emoticon_length = 0
|
||||||
for emoticon in keys: # travel thru emoticons list
|
for emoticon in keys: # travel thru emoticons list
|
||||||
emoticon = emoticon.decode('utf-8')
|
|
||||||
emoticon_escaped = re.escape(emoticon) # espace regexp metachars
|
emoticon_escaped = re.escape(emoticon) # espace regexp metachars
|
||||||
# | means or in regexp
|
# | means or in regexp
|
||||||
emoticons_pattern += emoticon_escaped + '|'
|
emoticons_pattern += emoticon_escaped + '|'
|
||||||
|
@ -1917,7 +1917,7 @@ class Interface:
|
||||||
button, parent_win)
|
button, parent_win)
|
||||||
|
|
||||||
def prepare_emoticons_menu(self):
|
def prepare_emoticons_menu(self):
|
||||||
menu = gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
def emoticon_clicked(w, str_):
|
def emoticon_clicked(w, str_):
|
||||||
if self.emoticon_menuitem_clicked:
|
if self.emoticon_menuitem_clicked:
|
||||||
self.emoticon_menuitem_clicked(str_)
|
self.emoticon_menuitem_clicked(str_)
|
||||||
|
@ -1932,12 +1932,14 @@ class Interface:
|
||||||
# Calculate the side lenght of the popup to make it a square
|
# Calculate the side lenght of the popup to make it a square
|
||||||
size = int(round(math.sqrt(len(self.emoticons_images))))
|
size = int(round(math.sqrt(len(self.emoticons_images))))
|
||||||
for image in self.emoticons_images:
|
for image in self.emoticons_images:
|
||||||
item = gtk.MenuItem()
|
item = Gtk.MenuItem()
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
if isinstance(image[1], gtk.gdk.PixbufAnimation):
|
if isinstance(image[1], GdkPixbuf.PixbufAnimation):
|
||||||
img.set_from_animation(image[1])
|
img.set_from_animation(image[1])
|
||||||
else:
|
else:
|
||||||
img.set_from_pixbuf(image[1])
|
img.set_from_pixbuf(image[1])
|
||||||
|
c = item.get_child()
|
||||||
|
item.remove(c)
|
||||||
item.add(img)
|
item.add(img)
|
||||||
item.connect('activate', emoticon_clicked, image[0])
|
item.connect('activate', emoticon_clicked, image[0])
|
||||||
# add tooltip with ascii
|
# add tooltip with ascii
|
||||||
|
@ -1972,9 +1974,9 @@ class Interface:
|
||||||
# and :-)
|
# and :-)
|
||||||
if not emot_file in self.emoticons.values():
|
if not emot_file in self.emoticons.values():
|
||||||
if emot_file.endswith('.gif'):
|
if emot_file.endswith('.gif'):
|
||||||
pix = gtk.gdk.PixbufAnimation(emot_file)
|
pix = GdkPixbuf.PixbufAnimation.new_from_file(emot_file)
|
||||||
else:
|
else:
|
||||||
pix = gtk.gdk.pixbuf_new_from_file_at_size(emot_file,
|
pix = GdkPixbuf.Pixbuf.new_from_file_at_size(emot_file,
|
||||||
16, 16)
|
16, 16)
|
||||||
self.emoticons_images.append((emot, pix))
|
self.emoticons_images.append((emot, pix))
|
||||||
self.emoticons[emot.upper()] = emot_file
|
self.emoticons[emot.upper()] = emot_file
|
||||||
|
@ -2187,7 +2189,7 @@ class Interface:
|
||||||
# For JEP-0172
|
# For JEP-0172
|
||||||
if added_to_roster:
|
if added_to_roster:
|
||||||
ctrl.user_nick = gajim.nicks[account]
|
ctrl.user_nick = gajim.nicks[account]
|
||||||
gobject.idle_add(mw.window.grab_focus)
|
GObject.idle_add(mw.window.grab_focus)
|
||||||
|
|
||||||
return ctrl
|
return ctrl
|
||||||
|
|
||||||
|
@ -2307,11 +2309,11 @@ class Interface:
|
||||||
return format_rgb (*gdkcolor_to_rgb (gdkcolor))
|
return format_rgb (*gdkcolor_to_rgb (gdkcolor))
|
||||||
|
|
||||||
# get style colors and create string for dvipng
|
# get style colors and create string for dvipng
|
||||||
dummy = gtk.Invisible()
|
dummy = Gtk.Invisible()
|
||||||
dummy.ensure_style()
|
dummy.ensure_style()
|
||||||
style = dummy.get_style()
|
style = dummy.get_style()
|
||||||
bg_str = format_gdkcolor(style.base[gtk.STATE_NORMAL])
|
bg_str = format_gdkcolor(style.base[Gtk.StateType.NORMAL])
|
||||||
fg_str = format_gdkcolor(style.text[gtk.STATE_NORMAL])
|
fg_str = format_gdkcolor(style.text[Gtk.StateType.NORMAL])
|
||||||
return (bg_str, fg_str)
|
return (bg_str, fg_str)
|
||||||
|
|
||||||
def get_fg_color(self, fmt='hex'):
|
def get_fg_color(self, fmt='hex'):
|
||||||
|
@ -2323,9 +2325,9 @@ class Interface:
|
||||||
return str(c)
|
return str(c)
|
||||||
|
|
||||||
# get foreground style color and create string
|
# get foreground style color and create string
|
||||||
dummy = gtk.Invisible()
|
dummy = Gtk.Invisible()
|
||||||
dummy.ensure_style()
|
dummy.ensure_style()
|
||||||
return format_gdkcolor(dummy.get_style().text[gtk.STATE_NORMAL])
|
return format_gdkcolor(dummy.get_style().text[Gtk.StateType.NORMAL])
|
||||||
|
|
||||||
def read_sleepy(self):
|
def read_sleepy(self):
|
||||||
"""
|
"""
|
||||||
|
@ -2435,9 +2437,9 @@ class Interface:
|
||||||
# Otherwise, an exception will stop our loop
|
# Otherwise, an exception will stop our loop
|
||||||
timeout, in_seconds = gajim.idlequeue.PROCESS_TIMEOUT
|
timeout, in_seconds = gajim.idlequeue.PROCESS_TIMEOUT
|
||||||
if in_seconds:
|
if in_seconds:
|
||||||
gobject.timeout_add_seconds(timeout, self.process_connections)
|
GObject.timeout_add_seconds(timeout, self.process_connections)
|
||||||
else:
|
else:
|
||||||
gobject.timeout_add(timeout, self.process_connections)
|
GObject.timeout_add(timeout, self.process_connections)
|
||||||
raise
|
raise
|
||||||
return True # renew timeout (loop for ever)
|
return True # renew timeout (loop for ever)
|
||||||
|
|
||||||
|
@ -2608,21 +2610,21 @@ class Interface:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print 'ipython_view not found'
|
print 'ipython_view not found'
|
||||||
return
|
return
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
font = 'Lucida Console 9'
|
font = 'Lucida Console 9'
|
||||||
else:
|
else:
|
||||||
font = 'Luxi Mono 10'
|
font = 'Luxi Mono 10'
|
||||||
|
|
||||||
window = gtk.Window()
|
window = Gtk.Window()
|
||||||
window.set_size_request(750, 550)
|
window.set_size_request(750, 550)
|
||||||
window.set_resizable(True)
|
window.set_resizable(True)
|
||||||
sw = gtk.ScrolledWindow()
|
sw = Gtk.ScrolledWindow()
|
||||||
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
view = IPythonView()
|
view = IPythonView()
|
||||||
view.modify_font(pango.FontDescription(font))
|
view.modify_font(Pango.FontDescription(font))
|
||||||
view.set_wrap_mode(gtk.WRAP_CHAR)
|
view.set_wrap_mode(Gtk.WrapMode.CHAR)
|
||||||
sw.add(view)
|
sw.add(view)
|
||||||
window.add(sw)
|
window.add(sw)
|
||||||
window.show_all()
|
window.show_all()
|
||||||
|
@ -2650,18 +2652,18 @@ class Interface:
|
||||||
# get instances for windows/dialogs that will show_all()/hide()
|
# get instances for windows/dialogs that will show_all()/hide()
|
||||||
self.instances['file_transfers'] = dialogs.FileTransfersWindow()
|
self.instances['file_transfers'] = dialogs.FileTransfersWindow()
|
||||||
|
|
||||||
gobject.timeout_add(100, self.autoconnect)
|
GObject.timeout_add(100, self.autoconnect)
|
||||||
timeout, in_seconds = gajim.idlequeue.PROCESS_TIMEOUT
|
timeout, in_seconds = gajim.idlequeue.PROCESS_TIMEOUT
|
||||||
if in_seconds:
|
if in_seconds:
|
||||||
gobject.timeout_add_seconds(timeout, self.process_connections)
|
GObject.timeout_add_seconds(timeout, self.process_connections)
|
||||||
else:
|
else:
|
||||||
gobject.timeout_add(timeout, self.process_connections)
|
GObject.timeout_add(timeout, self.process_connections)
|
||||||
gobject.timeout_add_seconds(gajim.config.get(
|
GObject.timeout_add_seconds(gajim.config.get(
|
||||||
'check_idle_every_foo_seconds'), self.read_sleepy)
|
'check_idle_every_foo_seconds'), self.read_sleepy)
|
||||||
|
|
||||||
# when using libasyncns we need to process resolver in regular intervals
|
# when using libasyncns we need to process resolver in regular intervals
|
||||||
if resolver.USE_LIBASYNCNS:
|
if resolver.USE_LIBASYNCNS:
|
||||||
gobject.timeout_add(200, gajim.resolver.process)
|
GObject.timeout_add(200, gajim.resolver.process)
|
||||||
|
|
||||||
def remote_init():
|
def remote_init():
|
||||||
if gajim.config.get('remote_control'):
|
if gajim.config.get('remote_control'):
|
||||||
|
@ -2670,7 +2672,7 @@ class Interface:
|
||||||
self.remote_ctrl = remote_control.Remote()
|
self.remote_ctrl = remote_control.Remote()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
gobject.timeout_add_seconds(5, remote_init)
|
GObject.timeout_add_seconds(5, remote_init)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gajim.interface = self
|
gajim.interface = self
|
||||||
|
@ -2730,8 +2732,8 @@ class Interface:
|
||||||
break
|
break
|
||||||
# Is gnome configured to activate row on single click ?
|
# Is gnome configured to activate row on single click ?
|
||||||
try:
|
try:
|
||||||
import gconf
|
from gi.repository import GConf
|
||||||
client = gconf.client_get_default()
|
client = GConf.Client.get_default()
|
||||||
click_policy = client.get_string(
|
click_policy = client.get_string(
|
||||||
'/apps/nautilus/preferences/click_policy')
|
'/apps/nautilus/preferences/click_policy')
|
||||||
if click_policy == 'single':
|
if click_policy == 'single':
|
||||||
|
@ -2814,9 +2816,9 @@ class Interface:
|
||||||
gajim.connections[account] = Connection(account)
|
gajim.connections[account] = Connection(account)
|
||||||
|
|
||||||
# gtk hooks
|
# gtk hooks
|
||||||
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
|
# Gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
|
||||||
gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
|
# Gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
|
||||||
gtk.link_button_set_uri_hook(self.on_launch_browser_mailer, 'url')
|
# Gtk.link_button_set_uri_hook(self.on_launch_browser_mailer, 'url')
|
||||||
|
|
||||||
self.instances = {}
|
self.instances = {}
|
||||||
|
|
||||||
|
@ -2928,7 +2930,7 @@ class Interface:
|
||||||
pixs.append(pix)
|
pixs.append(pix)
|
||||||
if pixs:
|
if pixs:
|
||||||
# set the icon to all windows
|
# set the icon to all windows
|
||||||
gtk.window_set_default_icon_list(*pixs)
|
Gtk.Window.set_default_icon_list(pixs)
|
||||||
|
|
||||||
self.init_emoticons()
|
self.init_emoticons()
|
||||||
self.make_regexps()
|
self.make_regexps()
|
||||||
|
@ -2941,7 +2943,7 @@ class Interface:
|
||||||
lang = gajim.config.get('speller_language')
|
lang = gajim.config.get('speller_language')
|
||||||
if not lang:
|
if not lang:
|
||||||
lang = gajim.LANG
|
lang = gajim.LANG
|
||||||
tv = gtk.TextView()
|
tv = Gtk.TextView()
|
||||||
try:
|
try:
|
||||||
import gtkspell
|
import gtkspell
|
||||||
spell = gtkspell.Spell(tv, lang)
|
spell = gtkspell.Spell(tv, lang)
|
||||||
|
@ -2998,7 +3000,7 @@ class PassphraseRequest:
|
||||||
self.passphrase = passphrase
|
self.passphrase = passphrase
|
||||||
self.completed = True
|
self.completed = True
|
||||||
if passphrase is not None:
|
if passphrase is not None:
|
||||||
gobject.timeout_add_seconds(30,
|
GObject.timeout_add_seconds(30,
|
||||||
gajim.interface.forget_gpg_passphrase, self.keyid)
|
gajim.interface.forget_gpg_passphrase, self.keyid)
|
||||||
for (account, cb) in self.callbacks:
|
for (account, cb) in self.callbacks:
|
||||||
self.run_callback(account, cb)
|
self.run_callback(account, cb)
|
||||||
|
@ -3050,7 +3052,7 @@ class ThreadInterface:
|
||||||
def thread_function(func, func_args, callback, callback_args):
|
def thread_function(func, func_args, callback, callback_args):
|
||||||
output = func(*func_args)
|
output = func(*func_args)
|
||||||
if callback:
|
if callback:
|
||||||
gobject.idle_add(callback, output, *callback_args)
|
GObject.idle_add(callback, output, *callback_args)
|
||||||
|
|
||||||
Thread(target=thread_function, args=(func, func_args, callback,
|
Thread(target=thread_function, args=(func, func_args, callback,
|
||||||
callback_args)).start()
|
callback_args)).start()
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import os
|
import os
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
import message_control
|
import message_control
|
||||||
|
@ -35,7 +35,7 @@ def build_resources_submenu(contacts, account, action, room_jid=None,
|
||||||
action self.on_invite_to_room
|
action self.on_invite_to_room
|
||||||
"""
|
"""
|
||||||
roster = gajim.interface.roster
|
roster = gajim.interface.roster
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = Gtk.Menu()
|
||||||
|
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
|
@ -44,7 +44,7 @@ def build_resources_submenu(contacts, account, action, room_jid=None,
|
||||||
for c in contacts:
|
for c in contacts:
|
||||||
# icon MUST be different instance for every item
|
# icon MUST be different instance for every item
|
||||||
state_images = gtkgui_helpers.load_iconset(path)
|
state_images = gtkgui_helpers.load_iconset(path)
|
||||||
item = gtk.ImageMenuItem('%s (%s)' % (c.resource, str(c.priority)))
|
item = Gtk.ImageMenuItem('%s (%s)' % (c.resource, str(c.priority)))
|
||||||
icon_name = helpers.get_icon_name_to_show(c, account)
|
icon_name = helpers.get_icon_name_to_show(c, account)
|
||||||
icon = state_images[icon_name]
|
icon = state_images[icon_name]
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
|
@ -89,10 +89,10 @@ def build_invite_submenu(invite_menuitem, list_, ignore_rooms=[]):
|
||||||
# they are not all from the same transport
|
# they are not all from the same transport
|
||||||
invite_menuitem.set_sensitive(False)
|
invite_menuitem.set_sensitive(False)
|
||||||
return
|
return
|
||||||
invite_to_submenu = gtk.Menu()
|
invite_to_submenu = Gtk.Menu()
|
||||||
invite_menuitem.set_submenu(invite_to_submenu)
|
invite_menuitem.set_submenu(invite_to_submenu)
|
||||||
invite_to_new_room_menuitem = gtk.ImageMenuItem(_('_New Group Chat'))
|
invite_to_new_room_menuitem = Gtk.ImageMenuItem(_('_New Group Chat'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_MENU)
|
icon = Gtk.Image.new_from_stock(Gtk.STOCK_NEW, Gtk.IconSize.MENU)
|
||||||
invite_to_new_room_menuitem.set_image(icon)
|
invite_to_new_room_menuitem.set_image(icon)
|
||||||
if len(contact_list) > 1: # several resources
|
if len(contact_list) > 1: # several resources
|
||||||
invite_to_new_room_menuitem.set_submenu(build_resources_submenu(
|
invite_to_new_room_menuitem.set_submenu(build_resources_submenu(
|
||||||
|
@ -136,10 +136,10 @@ def build_invite_submenu(invite_menuitem, list_, ignore_rooms=[]):
|
||||||
contacts_transport == gajim.get_transport_name_from_jid(room_jid):
|
contacts_transport == gajim.get_transport_name_from_jid(room_jid):
|
||||||
rooms.append((room_jid, acct))
|
rooms.append((room_jid, acct))
|
||||||
if len(rooms):
|
if len(rooms):
|
||||||
item = gtk.SeparatorMenuItem() # separator
|
item = Gtk.SeparatorMenuItem() # separator
|
||||||
invite_to_submenu.append(item)
|
invite_to_submenu.append(item)
|
||||||
for (room_jid, account) in rooms:
|
for (room_jid, account) in rooms:
|
||||||
menuitem = gtk.MenuItem(room_jid.split('@')[0])
|
menuitem = Gtk.MenuItem(room_jid.split('@')[0])
|
||||||
if len(contact_list) > 1: # several resources
|
if len(contact_list) > 1: # several resources
|
||||||
menuitem.set_submenu(build_resources_submenu(
|
menuitem.set_submenu(build_resources_submenu(
|
||||||
contact_list, account, roster.on_invite_to_room, room_jid,
|
contact_list, account, roster.on_invite_to_room, room_jid,
|
||||||
|
@ -207,7 +207,7 @@ control=None, gc_contact=None, is_anonymous=True):
|
||||||
|
|
||||||
# add a special img for send file menuitem
|
# add a special img for send file menuitem
|
||||||
path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload')
|
path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload')
|
||||||
img = gtk.Image()
|
img = Gtk.Image()
|
||||||
img.set_from_file(path_to_upload_img)
|
img.set_from_file(path_to_upload_img)
|
||||||
send_file_menuitem.set_image(img)
|
send_file_menuitem.set_image(img)
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ control=None, gc_contact=None, is_anonymous=True):
|
||||||
send_custom_status_menuitem.set_image(gtkgui_helpers.load_icon(
|
send_custom_status_menuitem.set_image(gtkgui_helpers.load_icon(
|
||||||
gajim.interface.status_sent_to_users[account][jid]))
|
gajim.interface.status_sent_to_users[account][jid]))
|
||||||
else:
|
else:
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_MENU)
|
icon = Gtk.Image.new_from_stock(Gtk.STOCK_NETWORK, Gtk.IconSize.MENU)
|
||||||
send_custom_status_menuitem.set_image(icon)
|
send_custom_status_menuitem.set_image(icon)
|
||||||
|
|
||||||
muc_icon = gtkgui_helpers.load_icon('muc_active')
|
muc_icon = gtkgui_helpers.load_icon('muc_active')
|
||||||
|
@ -393,14 +393,14 @@ control=None, gc_contact=None, is_anonymous=True):
|
||||||
invite_menuitem.set_sensitive(False)
|
invite_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
# One or several resource, we do the same for send_custom_status
|
# One or several resource, we do the same for send_custom_status
|
||||||
status_menuitems = gtk.Menu()
|
status_menuitems = Gtk.Menu()
|
||||||
send_custom_status_menuitem.set_submenu(status_menuitems)
|
send_custom_status_menuitem.set_submenu(status_menuitems)
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||||
for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
|
for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
|
||||||
# icon MUST be different instance for every item
|
# icon MUST be different instance for every item
|
||||||
state_images = gtkgui_helpers.load_iconset(path)
|
state_images = gtkgui_helpers.load_iconset(path)
|
||||||
status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s))
|
status_menuitem = Gtk.ImageMenuItem(helpers.get_uf_show(s))
|
||||||
status_menuitem.connect('activate', roster.on_send_custom_status,
|
status_menuitem.connect('activate', roster.on_send_custom_status,
|
||||||
[(contact, account)], s)
|
[(contact, account)], s)
|
||||||
icon = state_images[s]
|
icon = state_images[s]
|
||||||
|
|
|
@ -49,8 +49,8 @@ if os.name == 'nt':
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class HistoryManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pix = gtkgui_helpers.get_icon_pixmap('gajim')
|
pix = gtkgui_helpers.get_icon_pixmap('gajim')
|
||||||
# set the icon to all newly opened windows
|
# set the icon to all newly opened windows
|
||||||
gtk.window_set_default_icon(pix)
|
Gtk.window_set_default_icon(pix)
|
||||||
|
|
||||||
if not os.path.exists(LOG_DB_PATH):
|
if not os.path.exists(LOG_DB_PATH):
|
||||||
dialogs.ErrorDialog(_('Cannot find history logs database'),
|
dialogs.ErrorDialog(_('Cannot find history logs database'),
|
||||||
|
@ -148,12 +148,12 @@ class HistoryManager:
|
||||||
xml.connect_signals(self)
|
xml.connect_signals(self)
|
||||||
|
|
||||||
def _init_jids_listview(self):
|
def _init_jids_listview(self):
|
||||||
self.jids_liststore = gtk.ListStore(str, str) # jid, jid_id
|
self.jids_liststore = Gtk.ListStore(str, str) # jid, jid_id
|
||||||
self.jids_listview.set_model(self.jids_liststore)
|
self.jids_listview.set_model(self.jids_liststore)
|
||||||
self.jids_listview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
self.jids_listview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds jid
|
renderer_text = Gtk.CellRendererText() # holds jid
|
||||||
col = gtk.TreeViewColumn(_('Jabber ID'), renderer_text, text=0)
|
col = Gtk.TreeViewColumn(_('Jabber ID'), renderer_text, text=0)
|
||||||
self.jids_listview.append_column(col)
|
self.jids_listview.append_column(col)
|
||||||
|
|
||||||
self.jids_listview.get_selection().connect('changed',
|
self.jids_listview.get_selection().connect('changed',
|
||||||
|
@ -161,19 +161,19 @@ class HistoryManager:
|
||||||
|
|
||||||
def _init_logs_listview(self):
|
def _init_logs_listview(self):
|
||||||
# log_line_id(HIDDEN), jid_id(HIDDEN), time, message, subject, nickname
|
# log_line_id(HIDDEN), jid_id(HIDDEN), time, message, subject, nickname
|
||||||
self.logs_liststore = gtk.ListStore(str, str, str, str, str, str)
|
self.logs_liststore = Gtk.ListStore(str, str, str, str, str, str)
|
||||||
self.logs_listview.set_model(self.logs_liststore)
|
self.logs_listview.set_model(self.logs_liststore)
|
||||||
self.logs_listview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
self.logs_listview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds time
|
renderer_text = Gtk.CellRendererText() # holds time
|
||||||
col = gtk.TreeViewColumn(_('Date'), renderer_text, text=C_UNIXTIME)
|
col = Gtk.TreeViewColumn(_('Date'), renderer_text, text=C_UNIXTIME)
|
||||||
# user can click this header and sort
|
# user can click this header and sort
|
||||||
col.set_sort_column_id(C_UNIXTIME)
|
col.set_sort_column_id(C_UNIXTIME)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.logs_listview.append_column(col)
|
self.logs_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds nickname
|
renderer_text = Gtk.CellRendererText() # holds nickname
|
||||||
col = gtk.TreeViewColumn(_('Nickname'), renderer_text, text=C_NICKNAME)
|
col = Gtk.TreeViewColumn(_('Nickname'), renderer_text, text=C_NICKNAME)
|
||||||
# user can click this header and sort
|
# user can click this header and sort
|
||||||
col.set_sort_column_id(C_NICKNAME)
|
col.set_sort_column_id(C_NICKNAME)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
@ -181,16 +181,16 @@ class HistoryManager:
|
||||||
self.nickname_col_for_logs = col
|
self.nickname_col_for_logs = col
|
||||||
self.logs_listview.append_column(col)
|
self.logs_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds message
|
renderer_text = Gtk.CellRendererText() # holds message
|
||||||
col = gtk.TreeViewColumn(_('Message'), renderer_text, markup=C_MESSAGE)
|
col = Gtk.TreeViewColumn(_('Message'), renderer_text, markup=C_MESSAGE)
|
||||||
# user can click this header and sort
|
# user can click this header and sort
|
||||||
col.set_sort_column_id(C_MESSAGE)
|
col.set_sort_column_id(C_MESSAGE)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.message_col_for_logs = col
|
self.message_col_for_logs = col
|
||||||
self.logs_listview.append_column(col)
|
self.logs_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds subject
|
renderer_text = Gtk.CellRendererText() # holds subject
|
||||||
col = gtk.TreeViewColumn(_('Subject'), renderer_text, text=C_SUBJECT)
|
col = Gtk.TreeViewColumn(_('Subject'), renderer_text, text=C_SUBJECT)
|
||||||
col.set_sort_column_id(C_SUBJECT) # user can click this header and sort
|
col.set_sort_column_id(C_SUBJECT) # user can click this header and sort
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
col.set_visible(False)
|
col.set_visible(False)
|
||||||
|
@ -199,37 +199,37 @@ class HistoryManager:
|
||||||
|
|
||||||
def _init_search_results_listview(self):
|
def _init_search_results_listview(self):
|
||||||
# log_line_id (HIDDEN), jid, time, message, subject, nickname
|
# log_line_id (HIDDEN), jid, time, message, subject, nickname
|
||||||
self.search_results_liststore = gtk.ListStore(str, str, str, str, str,
|
self.search_results_liststore = Gtk.ListStore(str, str, str, str, str,
|
||||||
str)
|
str)
|
||||||
self.search_results_listview.set_model(self.search_results_liststore)
|
self.search_results_listview.set_model(self.search_results_liststore)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds JID (who said this)
|
renderer_text = Gtk.CellRendererText() # holds JID (who said this)
|
||||||
col = gtk.TreeViewColumn(_('JID'), renderer_text, text=1)
|
col = Gtk.TreeViewColumn(_('JID'), renderer_text, text=1)
|
||||||
col.set_sort_column_id(1) # user can click this header and sort
|
col.set_sort_column_id(1) # user can click this header and sort
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.search_results_listview.append_column(col)
|
self.search_results_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds time
|
renderer_text = Gtk.CellRendererText() # holds time
|
||||||
col = gtk.TreeViewColumn(_('Date'), renderer_text, text=C_UNIXTIME)
|
col = Gtk.TreeViewColumn(_('Date'), renderer_text, text=C_UNIXTIME)
|
||||||
# user can click this header and sort
|
# user can click this header and sort
|
||||||
col.set_sort_column_id(C_UNIXTIME)
|
col.set_sort_column_id(C_UNIXTIME)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.search_results_listview.append_column(col)
|
self.search_results_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds message
|
renderer_text = Gtk.CellRendererText() # holds message
|
||||||
col = gtk.TreeViewColumn(_('Message'), renderer_text, text=C_MESSAGE)
|
col = Gtk.TreeViewColumn(_('Message'), renderer_text, text=C_MESSAGE)
|
||||||
col.set_sort_column_id(C_MESSAGE) # user can click this header and sort
|
col.set_sort_column_id(C_MESSAGE) # user can click this header and sort
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.search_results_listview.append_column(col)
|
self.search_results_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds subject
|
renderer_text = Gtk.CellRendererText() # holds subject
|
||||||
col = gtk.TreeViewColumn(_('Subject'), renderer_text, text=C_SUBJECT)
|
col = Gtk.TreeViewColumn(_('Subject'), renderer_text, text=C_SUBJECT)
|
||||||
col.set_sort_column_id(C_SUBJECT) # user can click this header and sort
|
col.set_sort_column_id(C_SUBJECT) # user can click this header and sort
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.search_results_listview.append_column(col)
|
self.search_results_listview.append_column(col)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText() # holds nickname
|
renderer_text = Gtk.CellRendererText() # holds nickname
|
||||||
col = gtk.TreeViewColumn(_('Nickname'), renderer_text, text=C_NICKNAME)
|
col = Gtk.TreeViewColumn(_('Nickname'), renderer_text, text=C_NICKNAME)
|
||||||
# user can click this header and sort
|
# user can click this header and sort
|
||||||
col.set_sort_column_id(C_NICKNAME)
|
col.set_sort_column_id(C_NICKNAME)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
@ -237,16 +237,16 @@ class HistoryManager:
|
||||||
|
|
||||||
def on_history_manager_window_delete_event(self, widget, event):
|
def on_history_manager_window_delete_event(self, widget, event):
|
||||||
if not self.AT_LEAST_ONE_DELETION_DONE:
|
if not self.AT_LEAST_ONE_DELETION_DONE:
|
||||||
gtk.main_quit()
|
Gtk.main_quit()
|
||||||
return
|
return
|
||||||
|
|
||||||
def on_yes(clicked):
|
def on_yes(clicked):
|
||||||
self.cur.execute('VACUUM')
|
self.cur.execute('VACUUM')
|
||||||
self.con.commit()
|
self.con.commit()
|
||||||
gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
def on_no():
|
def on_no():
|
||||||
gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
dialog = dialogs.YesNoDialog(
|
dialog = dialogs.YesNoDialog(
|
||||||
_('Do you want to clean up the database? '
|
_('Do you want to clean up the database? '
|
||||||
|
@ -285,7 +285,7 @@ class HistoryManager:
|
||||||
|
|
||||||
list_of_rowrefs = []
|
list_of_rowrefs = []
|
||||||
for path in list_of_paths: # make them treerowrefs (it's needed)
|
for path in list_of_paths: # make them treerowrefs (it's needed)
|
||||||
list_of_rowrefs.append(gtk.TreeRowReference(liststore, path))
|
list_of_rowrefs.append(Gtk.TreeRowReference(liststore, path))
|
||||||
|
|
||||||
for rowref in list_of_rowrefs: # FILL THE STORE, for all rows selected
|
for rowref in list_of_rowrefs: # FILL THE STORE, for all rows selected
|
||||||
path = rowref.get_path()
|
path = rowref.get_path()
|
||||||
|
@ -413,7 +413,7 @@ class HistoryManager:
|
||||||
if color:
|
if color:
|
||||||
message_ += ' foreground="%s"' % color
|
message_ += ' foreground="%s"' % color
|
||||||
message_ += '>%s</span>' % \
|
message_ += '>%s</span>' % \
|
||||||
gobject.markup_escape_text(message)
|
GObject.markup_escape_text(message)
|
||||||
self.logs_liststore.append((log_line_id, jid_id, time_,
|
self.logs_liststore.append((log_line_id, jid_id, time_,
|
||||||
message_, subject, nickname))
|
message_, subject, nickname))
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ class HistoryManager:
|
||||||
def on_logs_listview_key_press_event(self, widget, event):
|
def on_logs_listview_key_press_event(self, widget, event):
|
||||||
liststore, list_of_paths = self.logs_listview.get_selection()\
|
liststore, list_of_paths = self.logs_listview.get_selection()\
|
||||||
.get_selected_rows()
|
.get_selected_rows()
|
||||||
if event.keyval == gtk.keysyms.Delete:
|
if event.keyval == Gdk.KEY_Delete:
|
||||||
self._delete_logs(liststore, list_of_paths)
|
self._delete_logs(liststore, list_of_paths)
|
||||||
|
|
||||||
def on_listview_button_press_event(self, widget, event):
|
def on_listview_button_press_event(self, widget, event):
|
||||||
|
@ -479,7 +479,7 @@ class HistoryManager:
|
||||||
dlg.props.do_overwrite_confirmation = True
|
dlg.props.do_overwrite_confirmation = True
|
||||||
response = dlg.run()
|
response = dlg.run()
|
||||||
|
|
||||||
if response == gtk.RESPONSE_OK: # user want us to export ;)
|
if response == Gtk.ResponseType.OK: # user want us to export ;)
|
||||||
liststore, list_of_paths = self.jids_listview.get_selection()\
|
liststore, list_of_paths = self.jids_listview.get_selection()\
|
||||||
.get_selected_rows()
|
.get_selected_rows()
|
||||||
path_to_file = dlg.get_filename()
|
path_to_file = dlg.get_filename()
|
||||||
|
@ -489,7 +489,7 @@ class HistoryManager:
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
|
|
||||||
def on_delete_menuitem_activate(self, widget, listview):
|
def on_delete_menuitem_activate(self, widget, listview):
|
||||||
widget_name = gtk.Buildable.get_name(listview)
|
widget_name = Gtk.Buildable.get_name(listview)
|
||||||
liststore, list_of_paths = listview.get_selection().get_selected_rows()
|
liststore, list_of_paths = listview.get_selection().get_selected_rows()
|
||||||
if widget_name == 'jids_listview':
|
if widget_name == 'jids_listview':
|
||||||
self._delete_jid_logs(liststore, list_of_paths)
|
self._delete_jid_logs(liststore, list_of_paths)
|
||||||
|
@ -501,7 +501,7 @@ class HistoryManager:
|
||||||
def on_jids_listview_key_press_event(self, widget, event):
|
def on_jids_listview_key_press_event(self, widget, event):
|
||||||
liststore, list_of_paths = self.jids_listview.get_selection()\
|
liststore, list_of_paths = self.jids_listview.get_selection()\
|
||||||
.get_selected_rows()
|
.get_selected_rows()
|
||||||
if event.keyval == gtk.keysyms.Delete:
|
if event.keyval == Gdk.KEY_Delete:
|
||||||
self._delete_jid_logs(liststore, list_of_paths)
|
self._delete_jid_logs(liststore, list_of_paths)
|
||||||
|
|
||||||
def _export_jids_logs_to_file(self, liststore, list_of_paths, path_to_file):
|
def _export_jids_logs_to_file(self, liststore, list_of_paths, path_to_file):
|
||||||
|
@ -511,7 +511,7 @@ class HistoryManager:
|
||||||
|
|
||||||
list_of_rowrefs = []
|
list_of_rowrefs = []
|
||||||
for path in list_of_paths: # make them treerowrefs (it's needed)
|
for path in list_of_paths: # make them treerowrefs (it's needed)
|
||||||
list_of_rowrefs.append(gtk.TreeRowReference(liststore, path))
|
list_of_rowrefs.append(Gtk.TreeRowReference(liststore, path))
|
||||||
|
|
||||||
for rowref in list_of_rowrefs:
|
for rowref in list_of_rowrefs:
|
||||||
path = rowref.get_path()
|
path = rowref.get_path()
|
||||||
|
@ -563,7 +563,7 @@ class HistoryManager:
|
||||||
# delete all rows from db that match jid_id
|
# delete all rows from db that match jid_id
|
||||||
list_of_rowrefs = []
|
list_of_rowrefs = []
|
||||||
for path in list_of_paths: # make them treerowrefs (it's needed)
|
for path in list_of_paths: # make them treerowrefs (it's needed)
|
||||||
list_of_rowrefs.append(gtk.TreeRowReference(liststore, path))
|
list_of_rowrefs.append(Gtk.TreeRowReference(liststore, path))
|
||||||
|
|
||||||
for rowref in list_of_rowrefs:
|
for rowref in list_of_rowrefs:
|
||||||
path = rowref.get_path()
|
path = rowref.get_path()
|
||||||
|
@ -612,7 +612,7 @@ class HistoryManager:
|
||||||
# delete rows from db that match log_line_id
|
# delete rows from db that match log_line_id
|
||||||
list_of_rowrefs = []
|
list_of_rowrefs = []
|
||||||
for path in list_of_paths: # make them treerowrefs (it's needed)
|
for path in list_of_paths: # make them treerowrefs (it's needed)
|
||||||
list_of_rowrefs.append(gtk.TreeRowReference(liststore, path))
|
list_of_rowrefs.append(Gtk.TreeRowReference(liststore, path))
|
||||||
|
|
||||||
for rowref in list_of_rowrefs:
|
for rowref in list_of_rowrefs:
|
||||||
path = rowref.get_path()
|
path = rowref.get_path()
|
||||||
|
@ -660,7 +660,7 @@ class HistoryManager:
|
||||||
# as this is what db returns so I don't have to fight with types
|
# as this is what db returns so I don't have to fight with types
|
||||||
jid_id = self._get_jid_id(jid)
|
jid_id = self._get_jid_id(jid)
|
||||||
|
|
||||||
iter_ = self.jids_liststore.get_iter_root()
|
iter_ = self.jids_liststore.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
# self.jids_liststore[iter_][1] holds jid_ids
|
# self.jids_liststore[iter_][1] holds jid_ids
|
||||||
if self.jids_liststore[iter_][1] == jid_id:
|
if self.jids_liststore[iter_][1] == jid_id:
|
||||||
|
@ -673,7 +673,7 @@ class HistoryManager:
|
||||||
path = self.jids_liststore.get_path(iter_)
|
path = self.jids_liststore.get_path(iter_)
|
||||||
self.jids_listview.set_cursor(path)
|
self.jids_listview.set_cursor(path)
|
||||||
|
|
||||||
iter_ = self.logs_liststore.get_iter_root()
|
iter_ = self.logs_liststore.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
# self.logs_liststore[iter_][0] holds lon_line_ids
|
# self.logs_liststore[iter_][0] holds lon_line_ids
|
||||||
if self.logs_liststore[iter_][0] == log_line_id:
|
if self.logs_liststore[iter_][0] == log_line_id:
|
||||||
|
@ -686,4 +686,4 @@ class HistoryManager:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C exits the application
|
signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C exits the application
|
||||||
HistoryManager()
|
HistoryManager()
|
||||||
gtk.main()
|
Gtk.main()
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import time
|
import time
|
||||||
import calendar
|
import calendar
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class HistoryWindow:
|
||||||
self.on_log_history_checkbutton_toggled)
|
self.on_log_history_checkbutton_toggled)
|
||||||
self.query_entry = xml.get_object('query_entry')
|
self.query_entry = xml.get_object('query_entry')
|
||||||
self.query_combobox = xml.get_object('query_combobox')
|
self.query_combobox = xml.get_object('query_combobox')
|
||||||
self.jid_entry = self.query_combobox.child
|
self.jid_entry = self.query_combobox.get_child()
|
||||||
self.jid_entry.connect('activate', self.on_jid_entry_activate)
|
self.jid_entry.connect('activate', self.on_jid_entry_activate)
|
||||||
self.query_combobox.set_active(0)
|
self.query_combobox.set_active(0)
|
||||||
self.results_treeview = xml.get_object('results_treeview')
|
self.results_treeview = xml.get_object('results_treeview')
|
||||||
|
@ -86,28 +86,28 @@ class HistoryWindow:
|
||||||
self.search_in_date = xml.get_object('search_in_date')
|
self.search_in_date = xml.get_object('search_in_date')
|
||||||
|
|
||||||
# contact_name, date, message, time
|
# contact_name, date, message, time
|
||||||
model = gtk.ListStore(str, str, str, str, str)
|
model = Gtk.ListStore(str, str, str, str, str)
|
||||||
self.results_treeview.set_model(model)
|
self.results_treeview.set_model(model)
|
||||||
col = gtk.TreeViewColumn(_('Name'))
|
col = Gtk.TreeViewColumn(_('Name'))
|
||||||
self.results_treeview.append_column(col)
|
self.results_treeview.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = C_CONTACT_NAME)
|
col.set_attributes(renderer, text = C_CONTACT_NAME)
|
||||||
col.set_sort_column_id(C_CONTACT_NAME) # user can click this header and sort
|
col.set_sort_column_id(C_CONTACT_NAME) # user can click this header and sort
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Date'))
|
col = Gtk.TreeViewColumn(_('Date'))
|
||||||
self.results_treeview.append_column(col)
|
self.results_treeview.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = C_UNIXTIME)
|
col.set_attributes(renderer, text = C_UNIXTIME)
|
||||||
col.set_sort_column_id(C_UNIXTIME) # user can click this header and sort
|
col.set_sort_column_id(C_UNIXTIME) # user can click this header and sort
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Message'))
|
col = Gtk.TreeViewColumn(_('Message'))
|
||||||
self.results_treeview.append_column(col)
|
self.results_treeview.append_column(col)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col.pack_start(renderer)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.set_attributes(renderer, text = C_MESSAGE)
|
col.set_attributes(renderer, text = C_MESSAGE)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class HistoryWindow:
|
||||||
self.jids_to_search = []
|
self.jids_to_search = []
|
||||||
|
|
||||||
# This will load history too
|
# This will load history too
|
||||||
gobject.idle_add(self._fill_completion_dict().next)
|
GObject.idle_add(self._fill_completion_dict().next)
|
||||||
|
|
||||||
if jid:
|
if jid:
|
||||||
self.jid_entry.set_text(jid)
|
self.jid_entry.set_text(jid)
|
||||||
|
@ -231,7 +231,7 @@ class HistoryWindow:
|
||||||
del gajim.interface.instances['logs']
|
del gajim.interface.instances['logs']
|
||||||
|
|
||||||
def on_history_window_key_press_event(self, widget, event):
|
def on_history_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.save_state()
|
self.save_state()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ class HistoryWindow:
|
||||||
timestamp_str = gajim.config.get('time_stamp')
|
timestamp_str = gajim.config.get('time_stamp')
|
||||||
timestamp_str = helpers.from_one_line(timestamp_str)
|
timestamp_str = helpers.from_one_line(timestamp_str)
|
||||||
tim = time.strftime(timestamp_str, local_time)
|
tim = time.strftime(timestamp_str, local_time)
|
||||||
result = start_iter.forward_search(tim, gtk.TEXT_SEARCH_VISIBLE_ONLY,
|
result = start_iter.forward_search(tim, Gtk.TextSearchFlags.VISIBLE_ONLY,
|
||||||
None)
|
None)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
match_start_iter, match_end_iter = result
|
match_start_iter, match_end_iter = result
|
||||||
|
@ -641,7 +641,7 @@ class HistoryWindow:
|
||||||
self.jid_entry.set_text(jid)
|
self.jid_entry.set_text(jid)
|
||||||
if account and account not in self.accounts_seen_online:
|
if account and account not in self.accounts_seen_online:
|
||||||
# Update dict to not only show bare jid
|
# Update dict to not only show bare jid
|
||||||
gobject.idle_add(self._fill_completion_dict().next)
|
GObject.idle_add(self._fill_completion_dict().next)
|
||||||
else:
|
else:
|
||||||
# Only in that case because it's called by self._fill_completion_dict()
|
# Only in that case because it's called by self._fill_completion_dict()
|
||||||
# otherwise
|
# otherwise
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A gtk.TextView-based renderer for XHTML-IM, as described in:
|
A Gtk.TextView-based renderer for XHTML-IM, as described in:
|
||||||
http://xmpp.org/extensions/xep-0071.html
|
http://xmpp.org/extensions/xep-0071.html
|
||||||
|
|
||||||
Starting with the version posted by Gustavo Carneiro,
|
Starting with the version posted by Gustavo Carneiro,
|
||||||
|
@ -35,9 +35,11 @@ with the markup that docutils generate, and also more
|
||||||
modular.
|
modular.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import GdkPixbuf
|
||||||
import xml.sax, xml.sax.handler
|
import xml.sax, xml.sax.handler
|
||||||
import re
|
import re
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
@ -64,8 +66,8 @@ whitespace_rx = re.compile('\\s+')
|
||||||
allwhitespace_rx = re.compile('^\\s*$')
|
allwhitespace_rx = re.compile('^\\s*$')
|
||||||
|
|
||||||
# pixels = points * display_resolution
|
# pixels = points * display_resolution
|
||||||
display_resolution = 0.3514598*(gtk.gdk.screen_height() /
|
display_resolution = 0.3514598*(Gdk.Screen.height() /
|
||||||
float(gtk.gdk.screen_height_mm()))
|
float(Gdk.Screen.height_mm()))
|
||||||
|
|
||||||
# embryo of CSS classes
|
# embryo of CSS classes
|
||||||
classes = {
|
classes = {
|
||||||
|
@ -194,9 +196,9 @@ for name in BLOCK_HEAD:
|
||||||
def _parse_css_color(color):
|
def _parse_css_color(color):
|
||||||
if color.startswith('rgb(') and color.endswith(')'):
|
if color.startswith('rgb(') and color.endswith(')'):
|
||||||
r, g, b = [int(c)*257 for c in color[4:-1].split(',')]
|
r, g, b = [int(c)*257 for c in color[4:-1].split(',')]
|
||||||
return gtk.gdk.Color(r, g, b)
|
return Gdk.Color(r, g, b)
|
||||||
else:
|
else:
|
||||||
return gtk.gdk.color_parse(color)
|
return Gdk.color_parse(color)
|
||||||
|
|
||||||
def style_iter(style):
|
def style_iter(style):
|
||||||
return ([x.strip() for x in item.split(':', 1)] for item in style.split(';')\
|
return ([x.strip() for x in item.split(':', 1)] for item in style.split(';')\
|
||||||
|
@ -219,7 +221,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
self.text = ''
|
self.text = ''
|
||||||
self.starting=True
|
self.starting=True
|
||||||
self.preserve = False
|
self.preserve = False
|
||||||
self.styles = [] # a gtk.TextTag or None, for each span level
|
self.styles = [] # a Gtk.TextTag or None, for each span level
|
||||||
self.list_counters = [] # stack (top at head) of list
|
self.list_counters = [] # stack (top at head) of list
|
||||||
# counters, or None for unordered list
|
# counters, or None for unordered list
|
||||||
|
|
||||||
|
@ -258,7 +260,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
frac = val/100
|
frac = val/100
|
||||||
if font_relative:
|
if font_relative:
|
||||||
attrs = self._get_current_attributes()
|
attrs = self._get_current_attributes()
|
||||||
font_size = attrs.font.get_size() / pango.SCALE
|
font_size = attrs.font.get_size() / Pango.SCALE
|
||||||
callback(frac*display_resolution*font_size, *args)
|
callback(frac*display_resolution*font_size, *args)
|
||||||
elif block_relative:
|
elif block_relative:
|
||||||
# CSS says 'Percentage values: refer to width of the closest
|
# CSS says 'Percentage values: refer to width of the closest
|
||||||
|
@ -285,14 +287,14 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
|
|
||||||
elif value.endswith('em'): # ems, the width of the element's font
|
elif value.endswith('em'): # ems, the width of the element's font
|
||||||
attrs = self._get_current_attributes()
|
attrs = self._get_current_attributes()
|
||||||
font_size = attrs.font.get_size() / pango.SCALE
|
font_size = attrs.font.get_size() / Pango.SCALE
|
||||||
callback(get_val()*display_resolution*font_size, *args)
|
callback(get_val()*display_resolution*font_size, *args)
|
||||||
|
|
||||||
elif value.endswith('ex'): # x-height, ~ the height of the letter 'x'
|
elif value.endswith('ex'): # x-height, ~ the height of the letter 'x'
|
||||||
# FIXME: figure out how to calculate this correctly
|
# FIXME: figure out how to calculate this correctly
|
||||||
# for now 'em' size is used as approximation
|
# for now 'em' size is used as approximation
|
||||||
attrs = self._get_current_attributes()
|
attrs = self._get_current_attributes()
|
||||||
font_size = attrs.font.get_size() / pango.SCALE
|
font_size = attrs.font.get_size() / Pango.SCALE
|
||||||
callback(get_val()*display_resolution*font_size, *args)
|
callback(get_val()*display_resolution*font_size, *args)
|
||||||
|
|
||||||
elif value.endswith('px'): # pixels
|
elif value.endswith('px'): # pixels
|
||||||
|
@ -321,13 +323,13 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
def _parse_style_font_size(self, tag, value):
|
def _parse_style_font_size(self, tag, value):
|
||||||
try:
|
try:
|
||||||
scale = {
|
scale = {
|
||||||
'xx-small': pango.SCALE_XX_SMALL,
|
'xx-small': Pango.SCALE_XX_SMALL,
|
||||||
'x-small': pango.SCALE_X_SMALL,
|
'x-small': Pango.SCALE_X_SMALL,
|
||||||
'small': pango.SCALE_SMALL,
|
'small': Pango.SCALE_SMALL,
|
||||||
'medium': pango.SCALE_MEDIUM,
|
'medium': Pango.SCALE_MEDIUM,
|
||||||
'large': pango.SCALE_LARGE,
|
'large': Pango.SCALE_LARGE,
|
||||||
'x-large': pango.SCALE_X_LARGE,
|
'x-large': Pango.SCALE_X_LARGE,
|
||||||
'xx-large': pango.SCALE_XX_LARGE,
|
'xx-large': Pango.SCALE_XX_LARGE,
|
||||||
} [value]
|
} [value]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
@ -336,10 +338,10 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
tag.set_property('scale', scale / attrs.font_scale)
|
tag.set_property('scale', scale / attrs.font_scale)
|
||||||
return
|
return
|
||||||
if value == 'smaller':
|
if value == 'smaller':
|
||||||
tag.set_property('scale', pango.SCALE_SMALL)
|
tag.set_property('scale', Pango.SCALE_SMALL)
|
||||||
return
|
return
|
||||||
if value == 'larger':
|
if value == 'larger':
|
||||||
tag.set_property('scale', pango.SCALE_LARGE)
|
tag.set_property('scale', Pango.SCALE_LARGE)
|
||||||
return
|
return
|
||||||
# font relative (5 ~ 4pt, 110 ~ 72pt)
|
# font relative (5 ~ 4pt, 110 ~ 72pt)
|
||||||
self._parse_length(value, True, False, 5, 110,self.__parse_font_size_cb,
|
self._parse_length(value, True, False, 5, 110,self.__parse_font_size_cb,
|
||||||
|
@ -348,9 +350,9 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
def _parse_style_font_style(self, tag, value):
|
def _parse_style_font_style(self, tag, value):
|
||||||
try:
|
try:
|
||||||
style = {
|
style = {
|
||||||
'normal': pango.STYLE_NORMAL,
|
'normal': Pango.Style.NORMAL,
|
||||||
'italic': pango.STYLE_ITALIC,
|
'italic': Pango.Style.ITALIC,
|
||||||
'oblique': pango.STYLE_OBLIQUE,
|
'oblique': Pango.Style.OBLIQUE,
|
||||||
} [value]
|
} [value]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.warning('unknown font-style %s' % value)
|
log.warning('unknown font-style %s' % value)
|
||||||
|
@ -378,17 +380,17 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
# TODO: missing 'bolder' and 'lighter'
|
# TODO: missing 'bolder' and 'lighter'
|
||||||
try:
|
try:
|
||||||
weight = {
|
weight = {
|
||||||
'100': pango.WEIGHT_ULTRALIGHT,
|
'100': Pango.Weight.ULTRALIGHT,
|
||||||
'200': pango.WEIGHT_ULTRALIGHT,
|
'200': Pango.Weight.ULTRALIGHT,
|
||||||
'300': pango.WEIGHT_LIGHT,
|
'300': Pango.Weight.LIGHT,
|
||||||
'400': pango.WEIGHT_NORMAL,
|
'400': Pango.Weight.NORMAL,
|
||||||
'500': pango.WEIGHT_NORMAL,
|
'500': Pango.Weight.NORMAL,
|
||||||
'600': pango.WEIGHT_BOLD,
|
'600': Pango.Weight.BOLD,
|
||||||
'700': pango.WEIGHT_BOLD,
|
'700': Pango.Weight.BOLD,
|
||||||
'800': pango.WEIGHT_ULTRABOLD,
|
'800': Pango.Weight.ULTRABOLD,
|
||||||
'900': pango.WEIGHT_HEAVY,
|
'900': Pango.Weight.HEAVY,
|
||||||
'normal': pango.WEIGHT_NORMAL,
|
'normal': Pango.Weight.NORMAL,
|
||||||
'bold': pango.WEIGHT_BOLD,
|
'bold': Pango.Weight.BOLD,
|
||||||
} [value]
|
} [value]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.warning('unknown font-style %s' % value)
|
log.warning('unknown font-style %s' % value)
|
||||||
|
@ -401,10 +403,10 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
def _parse_style_text_align(self, tag, value):
|
def _parse_style_text_align(self, tag, value):
|
||||||
try:
|
try:
|
||||||
align = {
|
align = {
|
||||||
'left': gtk.JUSTIFY_LEFT,
|
'left': Gtk.Justification.LEFT,
|
||||||
'right': gtk.JUSTIFY_RIGHT,
|
'right': Gtk.Justification.RIGHT,
|
||||||
'center': gtk.JUSTIFY_CENTER,
|
'center': Gtk.Justification.CENTER,
|
||||||
'justify': gtk.JUSTIFY_FILL,
|
'justify': Gtk.Justification.FILL,
|
||||||
} [value]
|
} [value]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.warning('Invalid text-align:%s requested' % value)
|
log.warning('Invalid text-align:%s requested' % value)
|
||||||
|
@ -414,12 +416,12 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
def _parse_style_text_decoration(self, tag, value):
|
def _parse_style_text_decoration(self, tag, value):
|
||||||
values = value.split(' ')
|
values = value.split(' ')
|
||||||
if 'none' in values:
|
if 'none' in values:
|
||||||
tag.set_property('underline', pango.UNDERLINE_NONE)
|
tag.set_property('underline', Pango.Underline.NONE)
|
||||||
tag.set_property('strikethrough', False)
|
tag.set_property('strikethrough', False)
|
||||||
if 'underline' in values:
|
if 'underline' in values:
|
||||||
tag.set_property('underline', pango.UNDERLINE_SINGLE)
|
tag.set_property('underline', Pango.Underline.SINGLE)
|
||||||
else:
|
else:
|
||||||
tag.set_property('underline', pango.UNDERLINE_NONE)
|
tag.set_property('underline', Pango.Underline.NONE)
|
||||||
if 'line-through' in values:
|
if 'line-through' in values:
|
||||||
tag.set_property('strikethrough', True)
|
tag.set_property('strikethrough', True)
|
||||||
else:
|
else:
|
||||||
|
@ -431,11 +433,11 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
|
|
||||||
def _parse_style_white_space(self, tag, value):
|
def _parse_style_white_space(self, tag, value):
|
||||||
if value == 'pre':
|
if value == 'pre':
|
||||||
tag.set_property('wrap_mode', gtk.WRAP_NONE)
|
tag.set_property('wrap_mode', Gtk.WrapMode.NONE)
|
||||||
elif value == 'normal':
|
elif value == 'normal':
|
||||||
tag.set_property('wrap_mode', gtk.WRAP_WORD)
|
tag.set_property('wrap_mode', Gtk.WrapMode.WORD)
|
||||||
elif value == 'nowrap':
|
elif value == 'nowrap':
|
||||||
tag.set_property('wrap_mode', gtk.WRAP_NONE)
|
tag.set_property('wrap_mode', Gtk.WrapMode.NONE)
|
||||||
|
|
||||||
def __length_tag_cb(self, value, tag, propname):
|
def __length_tag_cb(self, value, tag, propname):
|
||||||
try:
|
try:
|
||||||
|
@ -483,7 +485,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
tag.type_ = type_ # to be used by the URL handler
|
tag.type_ = type_ # to be used by the URL handler
|
||||||
tag.connect('event', self.textview.hyperlink_handler, 'url')
|
tag.connect('event', self.textview.hyperlink_handler, 'url')
|
||||||
tag.set_property('foreground', gajim.config.get('urlmsgcolor'))
|
tag.set_property('foreground', gajim.config.get('urlmsgcolor'))
|
||||||
tag.set_property('underline', pango.UNDERLINE_SINGLE)
|
tag.set_property('underline', Pango.Underline.SINGLE)
|
||||||
tag.is_anchor = True
|
tag.is_anchor = True
|
||||||
if title:
|
if title:
|
||||||
tag.title = title
|
tag.title = title
|
||||||
|
@ -525,7 +527,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
# Caveat: GdkPixbuf is known not to be safe to load
|
# Caveat: GdkPixbuf is known not to be safe to load
|
||||||
# images from network... this program is now potentially
|
# images from network... this program is now potentially
|
||||||
# hackable ;)
|
# hackable ;)
|
||||||
loader = gtk.gdk.PixbufLoader()
|
loader = GdkPixbuf.PixbufLoader()
|
||||||
dims = [0, 0]
|
dims = [0, 0]
|
||||||
def height_cb(length):
|
def height_cb(length):
|
||||||
dims[1] = length
|
dims[1] = length
|
||||||
|
@ -548,7 +550,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
"""
|
"""
|
||||||
FIXME: Floats should be relative to the whole textview, and
|
FIXME: Floats should be relative to the whole textview, and
|
||||||
resize with it. This needs new pifbufs for every resize,
|
resize with it. This needs new pifbufs for every resize,
|
||||||
gtk.gdk.Pixbuf.scale_simple or similar.
|
GdkPixbuf.Pixbuf.scale_simple or similar.
|
||||||
"""
|
"""
|
||||||
if isinstance(dims[0], float):
|
if isinstance(dims[0], float):
|
||||||
dims[0] = int(dims[0]*w)
|
dims[0] = int(dims[0]*w)
|
||||||
|
@ -647,7 +649,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
self._insert_text(text.strip('\n'))
|
self._insert_text(text.strip('\n'))
|
||||||
|
|
||||||
def _anchor_event(self, tag, textview, event, iter_, href, type_):
|
def _anchor_event(self, tag, textview, event, iter_, href, type_):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.textview.emit('url-clicked', href, type_)
|
self.textview.emit('url-clicked', href, type_)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -792,11 +794,11 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
self._jump_line()
|
self._jump_line()
|
||||||
self._end_span()
|
self._end_span()
|
||||||
|
|
||||||
class HtmlTextView(gtk.TextView):
|
class HtmlTextView(Gtk.TextView):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gobject.GObject.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self.set_wrap_mode(gtk.WRAP_CHAR)
|
self.set_wrap_mode(Gtk.WrapMode.CHAR)
|
||||||
self.set_editable(False)
|
self.set_editable(False)
|
||||||
self._changed_cursor = False
|
self._changed_cursor = False
|
||||||
self.connect('destroy', self.__destroy_event)
|
self.connect('destroy', self.__destroy_event)
|
||||||
|
@ -808,7 +810,8 @@ class HtmlTextView(gtk.TextView):
|
||||||
self.connect('copy-clipboard', self.on_html_text_view_copy_clipboard)
|
self.connect('copy-clipboard', self.on_html_text_view_copy_clipboard)
|
||||||
self.id_ = self.connect('button-release-event',
|
self.id_ = self.connect('button-release-event',
|
||||||
self.on_left_mouse_button_release)
|
self.on_left_mouse_button_release)
|
||||||
self.get_buffer().create_tag('eol', scale = pango.SCALE_XX_SMALL)
|
#Pango.SCALE_XX_SMALL)
|
||||||
|
self.get_buffer().create_tag('eol', scale=0.5787037037037)
|
||||||
self.tooltip = tooltips.BaseTooltip()
|
self.tooltip = tooltips.BaseTooltip()
|
||||||
self.config = gajim.config
|
self.config = gajim.config
|
||||||
self.interface = gajim.interface
|
self.interface = gajim.interface
|
||||||
|
@ -820,15 +823,15 @@ class HtmlTextView(gtk.TextView):
|
||||||
|
|
||||||
def __leave_event(self, widget, event):
|
def __leave_event(self, widget, event):
|
||||||
if self._changed_cursor:
|
if self._changed_cursor:
|
||||||
window = widget.get_window(gtk.TEXT_WINDOW_TEXT)
|
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
||||||
window.set_cursor(gtk.gdk.Cursor(gtk.gdk.XTERM))
|
window.set_cursor(Gdk.Cursor.new(Gdk.XTERM))
|
||||||
self._changed_cursor = False
|
self._changed_cursor = False
|
||||||
|
|
||||||
def show_tooltip(self, tag):
|
def show_tooltip(self, tag):
|
||||||
if not self.tooltip.win:
|
if not self.tooltip.win:
|
||||||
# check if the current pointer is still over the line
|
# check if the current pointer is still over the line
|
||||||
x, y, _ = self.window.get_pointer()
|
x, y = self.get_window(Gtk.TextWindowType.TEXT).get_pointer()[1:3]
|
||||||
x, y = self.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, x, y)
|
x, y = self.window_to_buffer_coords(Gtk.TextWindowType.TEXT, x, y)
|
||||||
tags = self.get_iter_at_location(x, y).get_tags()
|
tags = self.get_iter_at_location(x, y).get_tags()
|
||||||
is_over_anchor = False
|
is_over_anchor = False
|
||||||
for tag_ in tags:
|
for tag_ in tags:
|
||||||
|
@ -840,12 +843,12 @@ class HtmlTextView(gtk.TextView):
|
||||||
text = getattr(tag, 'title', False)
|
text = getattr(tag, 'title', False)
|
||||||
if text:
|
if text:
|
||||||
pointer = self.get_pointer()
|
pointer = self.get_pointer()
|
||||||
position = self.window.get_origin()
|
position = self.get_window(Gtk.TextWindowType.TEXT).get_origin()
|
||||||
self.tooltip.show_tooltip(text, 8, position[1] + pointer[1])
|
self.tooltip.show_tooltip(text, 8, position[1] + pointer[2])
|
||||||
|
|
||||||
def __motion_notify_event(self, widget, event):
|
def __motion_notify_event(self, widget, event):
|
||||||
x, y, _ = widget.window.get_pointer()
|
x, y = widget.get_window(Gtk.TextWindowType.TEXT).get_pointer()[1:3]
|
||||||
x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, x, y)
|
x, y = widget.window_to_buffer_coords(Gtk.TextWindowType.TEXT, x, y)
|
||||||
tags = widget.get_iter_at_location(x, y).get_tags()
|
tags = widget.get_iter_at_location(x, y).get_tags()
|
||||||
anchor_tags = [tag for tag in tags if getattr(tag, 'is_anchor', False)]
|
anchor_tags = [tag for tag in tags if getattr(tag, 'is_anchor', False)]
|
||||||
if self.tooltip.timeout != 0:
|
if self.tooltip.timeout != 0:
|
||||||
|
@ -853,14 +856,14 @@ class HtmlTextView(gtk.TextView):
|
||||||
if not anchor_tags:
|
if not anchor_tags:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
if not self._changed_cursor and anchor_tags:
|
if not self._changed_cursor and anchor_tags:
|
||||||
window = widget.get_window(gtk.TEXT_WINDOW_TEXT)
|
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
||||||
window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2))
|
window.set_cursor(Gdk.Cursor.new(Gdk.HAND2))
|
||||||
self._changed_cursor = True
|
self._changed_cursor = True
|
||||||
self.tooltip.timeout = gobject.timeout_add(500, self.show_tooltip,
|
self.tooltip.timeout = GObject.timeout_add(500, self.show_tooltip,
|
||||||
anchor_tags[0])
|
anchor_tags[0])
|
||||||
elif self._changed_cursor and not anchor_tags:
|
elif self._changed_cursor and not anchor_tags:
|
||||||
window = widget.get_window(gtk.TEXT_WINDOW_TEXT)
|
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
||||||
window.set_cursor(gtk.gdk.Cursor(gtk.gdk.XTERM))
|
window.set_cursor(Gdk.Cursor.new(Gdk.XTERM))
|
||||||
self._changed_cursor = False
|
self._changed_cursor = False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -879,17 +882,17 @@ class HtmlTextView(gtk.TextView):
|
||||||
# buffer_.insert(eob, '\n')
|
# buffer_.insert(eob, '\n')
|
||||||
|
|
||||||
def on_html_text_view_copy_clipboard(self, unused_data):
|
def on_html_text_view_copy_clipboard(self, unused_data):
|
||||||
clipboard = self.get_clipboard(gtk.gdk.SELECTION_CLIPBOARD)
|
clipboard = self.get_clipboard(Gdk.SELECTION_CLIPBOARD)
|
||||||
clipboard.set_text(self.get_selected_text())
|
clipboard.set_text(self.get_selected_text())
|
||||||
self.emit_stop_by_name('copy-clipboard')
|
self.emit_stop_by_name('copy-clipboard')
|
||||||
|
|
||||||
def on_html_text_view_realized(self, unused_data):
|
def on_html_text_view_realized(self, unused_data):
|
||||||
self.get_buffer().remove_selection_clipboard(self.get_clipboard(
|
self.get_buffer().remove_selection_clipboard(self.get_clipboard(
|
||||||
gtk.gdk.SELECTION_PRIMARY))
|
Gdk.SELECTION_PRIMARY))
|
||||||
|
|
||||||
def on_html_text_view_unrealized(self, unused_data):
|
def on_html_text_view_unrealized(self, unused_data):
|
||||||
self.get_buffer().add_selection_clipboard(self.get_clipboard(
|
self.get_buffer().add_selection_clipboard(self.get_clipboard(
|
||||||
gtk.gdk.SELECTION_PRIMARY))
|
Gdk.SELECTION_PRIMARY))
|
||||||
|
|
||||||
def on_left_mouse_button_release(self, widget, event):
|
def on_left_mouse_button_release(self, widget, event):
|
||||||
if event.button != 1:
|
if event.button != 1:
|
||||||
|
@ -899,7 +902,7 @@ class HtmlTextView(gtk.TextView):
|
||||||
if bounds:
|
if bounds:
|
||||||
# textview can be hidden while we add a new line in it.
|
# textview can be hidden while we add a new line in it.
|
||||||
if self.has_screen():
|
if self.has_screen():
|
||||||
clipboard = self.get_clipboard(gtk.gdk.SELECTION_PRIMARY)
|
clipboard = self.get_clipboard(Gdk.SELECTION_PRIMARY)
|
||||||
clipboard.set_text(self.get_selected_text())
|
clipboard.set_text(self.get_selected_text())
|
||||||
|
|
||||||
def get_selected_text(self):
|
def get_selected_text(self):
|
||||||
|
@ -944,7 +947,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
path = gtkgui_helpers.get_icon_path('gajim-muc_separator')
|
path = gtkgui_helpers.get_icon_path('gajim-muc_separator')
|
||||||
# use this for hr
|
# use this for hr
|
||||||
htmlview.tv.focus_out_line_pixbuf = gtk.gdk.pixbuf_new_from_file(path)
|
htmlview.tv.focus_out_line_pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
|
||||||
|
|
||||||
tooltip = tooltips.BaseTooltip()
|
tooltip = tooltips.BaseTooltip()
|
||||||
|
|
||||||
|
@ -953,20 +956,21 @@ if __name__ == '__main__':
|
||||||
Change the cursor to a hand when we are over a mail or an url
|
Change the cursor to a hand when we are over a mail or an url
|
||||||
"""
|
"""
|
||||||
global change_cursor
|
global change_cursor
|
||||||
pointer_x, pointer_y = htmlview.tv.window.get_pointer()[0:2]
|
pointer_x, pointer_y = htmlview.tv.get_window(Gtk.TextWindowType.TEXT).\
|
||||||
x, y = htmlview.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
|
get_pointer()[1:3]
|
||||||
|
x, y = htmlview.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
|
||||||
pointer_x, pointer_y)
|
pointer_x, pointer_y)
|
||||||
tags = htmlview.tv.get_iter_at_location(x, y).get_tags()
|
tags = htmlview.tv.get_iter_at_location(x, y).get_tags()
|
||||||
if change_cursor:
|
if change_cursor:
|
||||||
htmlview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.XTERM))
|
Gdk.Cursor.new(Gdk.XTERM))
|
||||||
change_cursor = None
|
change_cursor = None
|
||||||
tag_table = htmlview.tv.get_buffer().get_tag_table()
|
tag_table = htmlview.tv.get_buffer().get_tag_table()
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
try:
|
try:
|
||||||
if tag.is_anchor:
|
if tag.is_anchor:
|
||||||
htmlview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.HAND2))
|
Gdk.Cursor.new(Gdk.HAND2))
|
||||||
change_cursor = tag
|
change_cursor = tag
|
||||||
elif tag == tag_table.lookup('focus-out-line'):
|
elif tag == tag_table.lookup('focus-out-line'):
|
||||||
over_line = True
|
over_line = True
|
||||||
|
@ -978,16 +982,16 @@ if __name__ == '__main__':
|
||||||
# if not over_line:
|
# if not over_line:
|
||||||
# line_tooltip.hide_tooltip()
|
# line_tooltip.hide_tooltip()
|
||||||
#if over_line and not line_tooltip.win:
|
#if over_line and not line_tooltip.win:
|
||||||
# line_tooltip.timeout = gobject.timeout_add(500,
|
# line_tooltip.timeout = GObject.timeout_add(500,
|
||||||
# show_line_tooltip)
|
# show_line_tooltip)
|
||||||
# htmlview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
# htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
# gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
|
# Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
|
||||||
# change_cursor = tag
|
# change_cursor = tag
|
||||||
|
|
||||||
htmlview.tv.connect('motion_notify_event', on_textview_motion_notify_event)
|
htmlview.tv.connect('motion_notify_event', on_textview_motion_notify_event)
|
||||||
|
|
||||||
def handler(texttag, widget, event, iter_, kind):
|
def handler(texttag, widget, event, iter_, kind):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
htmlview.tv.hyperlink_handler = htmlview.hyperlink_handler
|
htmlview.tv.hyperlink_handler = htmlview.hyperlink_handler
|
||||||
|
@ -1108,19 +1112,19 @@ hhx4dbgYKAAA7' alt='Larry'/>
|
||||||
</body>
|
</body>
|
||||||
''')
|
''')
|
||||||
htmlview.tv.show()
|
htmlview.tv.show()
|
||||||
sw = gtk.ScrolledWindow()
|
sw = Gtk.ScrolledWindow()
|
||||||
sw.set_property('hscrollbar-policy', gtk.POLICY_AUTOMATIC)
|
sw.set_property('hscrollbar-policy', Gtk.PolicyType.AUTOMATIC)
|
||||||
sw.set_property('vscrollbar-policy', gtk.POLICY_AUTOMATIC)
|
sw.set_property('vscrollbar-policy', Gtk.PolicyType.AUTOMATIC)
|
||||||
sw.set_property('border-width', 0)
|
sw.set_property('border-width', 0)
|
||||||
sw.add(htmlview.tv)
|
sw.add(htmlview.tv)
|
||||||
sw.show()
|
sw.show()
|
||||||
frame = gtk.Frame()
|
frame = Gtk.Frame()
|
||||||
frame.set_shadow_type(gtk.SHADOW_IN)
|
frame.set_shadow_type(Gtk.ShadowType.IN)
|
||||||
frame.show()
|
frame.show()
|
||||||
frame.add(sw)
|
frame.add(sw)
|
||||||
w = gtk.Window()
|
w = Gtk.Window()
|
||||||
w.add(frame)
|
w.add(frame)
|
||||||
w.set_default_size(400, 300)
|
w.set_default_size(400, 300)
|
||||||
w.show_all()
|
w.show_all()
|
||||||
w.connect('destroy', lambda w: gtk.main_quit())
|
w.connect('destroy', lambda w: Gtk.main_quit())
|
||||||
gtk.main()
|
Gtk.main()
|
||||||
|
|
|
@ -42,11 +42,12 @@ available under the terms of the BSD which accompanies this distribution, and
|
||||||
is available at U{http://www.opensource.org/licenses/bsd-license.php}
|
is available at U{http://www.opensource.org/licenses/bsd-license.php}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import gtk, gobject
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GObject
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -128,7 +129,7 @@ class IterableIPShell:
|
||||||
# Workaround for updating namespace with sys.modules
|
# Workaround for updating namespace with sys.modules
|
||||||
#
|
#
|
||||||
self.__update_namespace()
|
self.__update_namespace()
|
||||||
|
|
||||||
def __update_namespace(self):
|
def __update_namespace(self):
|
||||||
'''
|
'''
|
||||||
Update self.IP namespace for autocompletion with sys.modules
|
Update self.IP namespace for autocompletion with sys.modules
|
||||||
|
@ -187,7 +188,7 @@ class IterableIPShell:
|
||||||
Generate prompt depending on is_continuation value
|
Generate prompt depending on is_continuation value
|
||||||
|
|
||||||
@param is_continuation
|
@param is_continuation
|
||||||
@type is_continuation: boolean
|
@type is_continuation: boolean
|
||||||
|
|
||||||
@return: The prompt string representation
|
@return: The prompt string representation
|
||||||
@rtype: string
|
@rtype: string
|
||||||
|
@ -316,7 +317,7 @@ class IterableIPShell:
|
||||||
output.close()
|
output.close()
|
||||||
input_.close()
|
input_.close()
|
||||||
|
|
||||||
class ConsoleView(gtk.TextView):
|
class ConsoleView(Gtk.TextView):
|
||||||
"""
|
"""
|
||||||
Specialized text view for console-like workflow
|
Specialized text view for console-like workflow
|
||||||
|
|
||||||
|
@ -324,13 +325,13 @@ class ConsoleView(gtk.TextView):
|
||||||
@type ANSI_COLORS: dictionary
|
@type ANSI_COLORS: dictionary
|
||||||
|
|
||||||
@ivar text_buffer: Widget's text buffer.
|
@ivar text_buffer: Widget's text buffer.
|
||||||
@type text_buffer: gtk.TextBuffer
|
@type text_buffer: Gtk.TextBuffer
|
||||||
@ivar color_pat: Regex of terminal color pattern
|
@ivar color_pat: Regex of terminal color pattern
|
||||||
@type color_pat: _sre.SRE_Pattern
|
@type color_pat: _sre.SRE_Pattern
|
||||||
@ivar mark: Scroll mark for automatic scrolling on input.
|
@ivar mark: Scroll mark for automatic scrolling on input.
|
||||||
@type mark: gtk.TextMark
|
@type mark: Gtk.TextMark
|
||||||
@ivar line_start: Start of command line mark.
|
@ivar line_start: Start of command line mark.
|
||||||
@type line_start: gtk.TextMark
|
@type line_start: Gtk.TextMark
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ANSI_COLORS = {'0;30': 'Black', '0;31': 'Red',
|
ANSI_COLORS = {'0;30': 'Black', '0;31': 'Red',
|
||||||
|
@ -346,8 +347,8 @@ class ConsoleView(gtk.TextView):
|
||||||
"""
|
"""
|
||||||
Initialize console view
|
Initialize console view
|
||||||
"""
|
"""
|
||||||
gtk.TextView.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self.modify_font(pango.FontDescription('Mono'))
|
self.modify_font(Pango.FontDescription('Mono'))
|
||||||
self.set_cursor_visible(True)
|
self.set_cursor_visible(True)
|
||||||
self.text_buffer = self.get_buffer()
|
self.text_buffer = self.get_buffer()
|
||||||
self.mark = self.text_buffer.create_mark('scroll_mark',
|
self.mark = self.text_buffer.create_mark('scroll_mark',
|
||||||
|
@ -366,7 +367,7 @@ class ConsoleView(gtk.TextView):
|
||||||
self.connect('key-press-event', self.onKeyPress)
|
self.connect('key-press-event', self.onKeyPress)
|
||||||
|
|
||||||
def write(self, text, editable=False):
|
def write(self, text, editable=False):
|
||||||
gobject.idle_add(self._write, text, editable)
|
GObject.idle_add(self._write, text, editable)
|
||||||
|
|
||||||
def _write(self, text, editable=False):
|
def _write(self, text, editable=False):
|
||||||
"""
|
"""
|
||||||
|
@ -400,7 +401,7 @@ class ConsoleView(gtk.TextView):
|
||||||
|
|
||||||
|
|
||||||
def showPrompt(self, prompt):
|
def showPrompt(self, prompt):
|
||||||
gobject.idle_add(self._showPrompt, prompt)
|
GObject.idle_add(self._showPrompt, prompt)
|
||||||
|
|
||||||
def _showPrompt(self, prompt):
|
def _showPrompt(self, prompt):
|
||||||
"""
|
"""
|
||||||
|
@ -414,7 +415,7 @@ class ConsoleView(gtk.TextView):
|
||||||
self.text_buffer.get_end_iter())
|
self.text_buffer.get_end_iter())
|
||||||
|
|
||||||
def changeLine(self, text):
|
def changeLine(self, text):
|
||||||
gobject.idle_add(self._changeLine, text)
|
GObject.idle_add(self._changeLine, text)
|
||||||
|
|
||||||
def _changeLine(self, text):
|
def _changeLine(self, text):
|
||||||
"""
|
"""
|
||||||
|
@ -441,7 +442,7 @@ class ConsoleView(gtk.TextView):
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def showReturned(self, text):
|
def showReturned(self, text):
|
||||||
gobject.idle_add(self._showReturned, text)
|
GObject.idle_add(self._showReturned, text)
|
||||||
|
|
||||||
def _showReturned(self, text):
|
def _showReturned(self, text):
|
||||||
"""
|
"""
|
||||||
|
@ -470,9 +471,9 @@ class ConsoleView(gtk.TextView):
|
||||||
line
|
line
|
||||||
|
|
||||||
@param widget: Widget that key press accored in.
|
@param widget: Widget that key press accored in.
|
||||||
@type widget: gtk.Widget
|
@type widget: Gtk.Widget
|
||||||
@param event: Event object
|
@param event: Event object
|
||||||
@type event: gtk.gdk.Event
|
@type event: Gdk.Event
|
||||||
|
|
||||||
@return: Return True if event should not trickle.
|
@return: Return True if event should not trickle.
|
||||||
@rtype: boolean
|
@rtype: boolean
|
||||||
|
@ -482,14 +483,14 @@ class ConsoleView(gtk.TextView):
|
||||||
selection_mark = self.text_buffer.get_selection_bound()
|
selection_mark = self.text_buffer.get_selection_bound()
|
||||||
selection_iter = self.text_buffer.get_iter_at_mark(selection_mark)
|
selection_iter = self.text_buffer.get_iter_at_mark(selection_mark)
|
||||||
start_iter = self.text_buffer.get_iter_at_mark(self.line_start)
|
start_iter = self.text_buffer.get_iter_at_mark(self.line_start)
|
||||||
if event.keyval == gtk.keysyms.Home:
|
if event.keyval == Gdk.KEY_Home:
|
||||||
if event.state == 0:
|
if event.get_state() == 0:
|
||||||
self.text_buffer.place_cursor(start_iter)
|
self.text_buffer.place_cursor(start_iter)
|
||||||
return True
|
return True
|
||||||
elif event.state == gtk.gdk.SHIFT_MASK:
|
elif event.get_state() == Gdk.ModifierType.SHIFT_MASK:
|
||||||
self.text_buffer.move_mark(insert_mark, start_iter)
|
self.text_buffer.move_mark(insert_mark, start_iter)
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Left:
|
elif event.keyval == Gdk.KEY_Left:
|
||||||
insert_iter.backward_cursor_position()
|
insert_iter.backward_cursor_position()
|
||||||
if not insert_iter.editable(True):
|
if not insert_iter.editable(True):
|
||||||
return True
|
return True
|
||||||
|
@ -555,27 +556,27 @@ class IPythonView(ConsoleView, IterableIPShell):
|
||||||
autocompletions, etc
|
autocompletions, etc
|
||||||
|
|
||||||
@param widget: Widget that key press occured in.
|
@param widget: Widget that key press occured in.
|
||||||
@type widget: gtk.Widget
|
@type widget: Gtk.Widget
|
||||||
@param event: Event object.
|
@param event: Event object.
|
||||||
@type event: gtk.gdk.Event
|
@type event: Gdk.Event
|
||||||
|
|
||||||
@return: True if event should not trickle.
|
@return: True if event should not trickle.
|
||||||
@rtype: boolean
|
@rtype: boolean
|
||||||
"""
|
"""
|
||||||
if event.state & gtk.gdk.CONTROL_MASK and event.keyval == 99:
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == 99:
|
||||||
self.interrupt = True
|
self.interrupt = True
|
||||||
self._processLine()
|
self._processLine()
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Return:
|
elif event.keyval == Gdk.KEY_Return:
|
||||||
self._processLine()
|
self._processLine()
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Up:
|
elif event.keyval == Gdk.KEY_Up:
|
||||||
self.changeLine(self.historyBack())
|
self.changeLine(self.historyBack())
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Down:
|
elif event.keyval == Gdk.KEY_Down:
|
||||||
self.changeLine(self.historyForward())
|
self.changeLine(self.historyForward())
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Tab:
|
elif event.keyval == Gdk.KEY_Tab:
|
||||||
if not self.getCurrentLine().strip():
|
if not self.getCurrentLine().strip():
|
||||||
return False
|
return False
|
||||||
completed, possibilities = self.complete(self.getCurrentLine())
|
completed, possibilities = self.complete(self.getCurrentLine())
|
||||||
|
|
|
@ -42,7 +42,7 @@ TYPE_PM = 'pm'
|
||||||
|
|
||||||
class MessageControl(object):
|
class MessageControl(object):
|
||||||
"""
|
"""
|
||||||
An abstract base widget that can embed in the gtk.Notebook of a
|
An abstract base widget that can embed in the Gtk.Notebook of a
|
||||||
MessageWindow
|
MessageWindow
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ class MessageControl(object):
|
||||||
|
|
||||||
Derivded classes MUST implement this.
|
Derivded classes MUST implement this.
|
||||||
"""
|
"""
|
||||||
# Return a markup'd label and optional gtk.Color in a tupple like:
|
# Return a markup'd label and optional Gtk.Color in a tupple like:
|
||||||
# return (label_str, None)
|
# return (label_str, None)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -23,35 +23,36 @@
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import Gdk
|
||||||
import pango
|
from gi.repository import GObject
|
||||||
|
from gi.repository import Pango
|
||||||
|
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
|
||||||
class MessageTextView(gtk.TextView):
|
class MessageTextView(Gtk.TextView):
|
||||||
"""
|
"""
|
||||||
Class for the message textview (where user writes new messages) for
|
Class for the message textview (where user writes new messages) for
|
||||||
chat/groupchat windows
|
chat/groupchat windows
|
||||||
"""
|
"""
|
||||||
UNDO_LIMIT = 20
|
UNDO_LIMIT = 20
|
||||||
__gsignals__ = dict(
|
__gsignals__ = dict(
|
||||||
mykeypress = (gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION,
|
mykeypress = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION,
|
||||||
None, # return value
|
None, # return value
|
||||||
(int, gtk.gdk.ModifierType ) # arguments
|
(int, Gdk.ModifierType ) # arguments
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gtk.TextView.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
|
|
||||||
# set properties
|
# set properties
|
||||||
self.set_border_width(1)
|
self.set_border_width(1)
|
||||||
self.set_accepts_tab(True)
|
self.set_accepts_tab(True)
|
||||||
self.set_editable(True)
|
self.set_editable(True)
|
||||||
self.set_cursor_visible(True)
|
self.set_cursor_visible(True)
|
||||||
self.set_wrap_mode(gtk.WRAP_WORD_CHAR)
|
self.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
|
||||||
self.set_left_margin(2)
|
self.set_left_margin(2)
|
||||||
self.set_right_margin(2)
|
self.set_right_margin(2)
|
||||||
self.set_pixels_above_lines(2)
|
self.set_pixels_above_lines(2)
|
||||||
|
@ -69,15 +70,15 @@ class MessageTextView(gtk.TextView):
|
||||||
self.fonts_tags = []
|
self.fonts_tags = []
|
||||||
self.other_tags = {}
|
self.other_tags = {}
|
||||||
self.other_tags['bold'] = _buffer.create_tag('bold')
|
self.other_tags['bold'] = _buffer.create_tag('bold')
|
||||||
self.other_tags['bold'].set_property('weight', pango.WEIGHT_BOLD)
|
self.other_tags['bold'].set_property('weight', Pango.Weight.BOLD)
|
||||||
self.begin_tags['bold'] = '<strong>'
|
self.begin_tags['bold'] = '<strong>'
|
||||||
self.end_tags['bold'] = '</strong>'
|
self.end_tags['bold'] = '</strong>'
|
||||||
self.other_tags['italic'] = _buffer.create_tag('italic')
|
self.other_tags['italic'] = _buffer.create_tag('italic')
|
||||||
self.other_tags['italic'].set_property('style', pango.STYLE_ITALIC)
|
self.other_tags['italic'].set_property('style', Pango.Style.ITALIC)
|
||||||
self.begin_tags['italic'] = '<em>'
|
self.begin_tags['italic'] = '<em>'
|
||||||
self.end_tags['italic'] = '</em>'
|
self.end_tags['italic'] = '</em>'
|
||||||
self.other_tags['underline'] = _buffer.create_tag('underline')
|
self.other_tags['underline'] = _buffer.create_tag('underline')
|
||||||
self.other_tags['underline'].set_property('underline', pango.UNDERLINE_SINGLE)
|
self.other_tags['underline'].set_property('underline', Pango.Underline.SINGLE)
|
||||||
self.begin_tags['underline'] = '<span style="text-decoration: underline;">'
|
self.begin_tags['underline'] = '<span style="text-decoration: underline;">'
|
||||||
self.end_tags['underline'] = '</span>'
|
self.end_tags['underline'] = '</span>'
|
||||||
self.other_tags['strike'] = _buffer.create_tag('strike')
|
self.other_tags['strike'] = _buffer.create_tag('strike')
|
||||||
|
@ -176,10 +177,10 @@ class MessageTextView(gtk.TextView):
|
||||||
_buffer = self.get_buffer()
|
_buffer = self.get_buffer()
|
||||||
|
|
||||||
font = font.get_font_name()
|
font = font.get_font_name()
|
||||||
font_desc = pango.FontDescription(font)
|
font_desc = Pango.FontDescription(font)
|
||||||
family = font_desc.get_family()
|
family = font_desc.get_family()
|
||||||
size = font_desc.get_size()
|
size = font_desc.get_size()
|
||||||
size = size / pango.SCALE
|
size = size / Pango.SCALE
|
||||||
weight = font_desc.get_weight()
|
weight = font_desc.get_weight()
|
||||||
style = font_desc.get_style()
|
style = font_desc.get_style()
|
||||||
|
|
||||||
|
@ -202,12 +203,12 @@ class MessageTextView(gtk.TextView):
|
||||||
|
|
||||||
_buffer.apply_tag_by_name(tag_name, start, finish)
|
_buffer.apply_tag_by_name(tag_name, start, finish)
|
||||||
|
|
||||||
if weight == pango.WEIGHT_BOLD:
|
if weight == Pango.Weight.BOLD:
|
||||||
_buffer.apply_tag_by_name('bold', start, finish)
|
_buffer.apply_tag_by_name('bold', start, finish)
|
||||||
else:
|
else:
|
||||||
_buffer.remove_tag_by_name('bold', start, finish)
|
_buffer.remove_tag_by_name('bold', start, finish)
|
||||||
|
|
||||||
if style == pango.STYLE_ITALIC:
|
if style == Pango.Style.ITALIC:
|
||||||
_buffer.apply_tag_by_name('italic', start, finish)
|
_buffer.apply_tag_by_name('italic', start, finish)
|
||||||
else:
|
else:
|
||||||
_buffer.remove_tag_by_name('italic', start, finish)
|
_buffer.remove_tag_by_name('italic', start, finish)
|
||||||
|
@ -217,7 +218,7 @@ class MessageTextView(gtk.TextView):
|
||||||
old = _buffer.get_start_iter()
|
old = _buffer.get_start_iter()
|
||||||
tags = {}
|
tags = {}
|
||||||
tags['bold'] = False
|
tags['bold'] = False
|
||||||
iter = _buffer.get_start_iter()
|
iter_ = _buffer.get_start_iter()
|
||||||
old = _buffer.get_start_iter()
|
old = _buffer.get_start_iter()
|
||||||
text = ''
|
text = ''
|
||||||
modified = False
|
modified = False
|
||||||
|
@ -229,31 +230,31 @@ class MessageTextView(gtk.TextView):
|
||||||
text = text.replace('\n', '<br />')
|
text = text.replace('\n', '<br />')
|
||||||
return text
|
return text
|
||||||
|
|
||||||
for tag in iter.get_toggled_tags(True):
|
for tag in iter_.get_toggled_tags(True):
|
||||||
tag_name = tag.get_property('name')
|
tag_name = tag.get_property('name')
|
||||||
if tag_name not in self.begin_tags:
|
if tag_name not in self.begin_tags:
|
||||||
continue
|
continue
|
||||||
text += self.begin_tags[tag_name]
|
text += self.begin_tags[tag_name]
|
||||||
modified = True
|
modified = True
|
||||||
while (iter.forward_to_tag_toggle(None) and not iter.is_end()):
|
while (iter_.forward_to_tag_toggle(None) and not iter_.is_end()):
|
||||||
text += xhtml_special(_buffer.get_text(old, iter))
|
text += xhtml_special(_buffer.get_text(old, iter_, True))
|
||||||
old.forward_to_tag_toggle(None)
|
old.forward_to_tag_toggle(None)
|
||||||
new_tags, old_tags, end_tags = [], [], []
|
new_tags, old_tags, end_tags = [], [], []
|
||||||
for tag in iter.get_toggled_tags(True):
|
for tag in iter_.get_toggled_tags(True):
|
||||||
tag_name = tag.get_property('name')
|
tag_name = tag.get_property('name')
|
||||||
if tag_name not in self.begin_tags:
|
if tag_name not in self.begin_tags:
|
||||||
continue
|
continue
|
||||||
new_tags.append(tag_name)
|
new_tags.append(tag_name)
|
||||||
modified = True
|
modified = True
|
||||||
|
|
||||||
for tag in iter.get_tags():
|
for tag in iter_.get_tags():
|
||||||
tag_name = tag.get_property('name')
|
tag_name = tag.get_property('name')
|
||||||
if tag_name not in self.begin_tags or tag_name not in self.end_tags:
|
if tag_name not in self.begin_tags or tag_name not in self.end_tags:
|
||||||
continue
|
continue
|
||||||
if tag_name not in new_tags:
|
if tag_name not in new_tags:
|
||||||
old_tags.append(tag_name)
|
old_tags.append(tag_name)
|
||||||
|
|
||||||
for tag in iter.get_toggled_tags(False):
|
for tag in iter_.get_toggled_tags(False):
|
||||||
tag_name = tag.get_property('name')
|
tag_name = tag.get_property('name')
|
||||||
if tag_name not in self.end_tags:
|
if tag_name not in self.end_tags:
|
||||||
continue
|
continue
|
||||||
|
@ -268,8 +269,8 @@ class MessageTextView(gtk.TextView):
|
||||||
for tag in old_tags:
|
for tag in old_tags:
|
||||||
text += self.begin_tags[tag]
|
text += self.begin_tags[tag]
|
||||||
|
|
||||||
text += xhtml_special(_buffer.get_text(old, _buffer.get_end_iter()))
|
text += xhtml_special(_buffer.get_text(old, _buffer.get_end_iter(), True))
|
||||||
for tag in iter.get_toggled_tags(False):
|
for tag in iter_.get_toggled_tags(False):
|
||||||
tag_name = tag.get_property('name')
|
tag_name = tag.get_property('name')
|
||||||
if tag_name not in self.end_tags:
|
if tag_name not in self.end_tags:
|
||||||
continue
|
continue
|
||||||
|
@ -281,7 +282,7 @@ class MessageTextView(gtk.TextView):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
gobject.idle_add(gc.collect)
|
GObject.idle_add(gc.collect)
|
||||||
|
|
||||||
def clear(self, widget = None):
|
def clear(self, widget = None):
|
||||||
"""
|
"""
|
||||||
|
@ -322,62 +323,62 @@ class MessageTextView(gtk.TextView):
|
||||||
# and we also return True there to stop the default action from running
|
# and we also return True there to stop the default action from running
|
||||||
|
|
||||||
# CTRL + SHIFT + TAB
|
# CTRL + SHIFT + TAB
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.ISO_Left_Tab,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_ISO_Left_Tab,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.ISO_Left_Tab,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_ISO_Left_Tab,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
||||||
# CTRL + TAB
|
## CTRL + TAB
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Tab,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Tab,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.Tab,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_Tab,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
||||||
# TAB
|
## TAB
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Tab,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Tab,
|
||||||
0, 'mykeypress', int, gtk.keysyms.Tab, gtk.gdk.ModifierType, 0)
|
#0, 'mykeypress', int, Gdk.KEY_Tab, Gdk.ModifierType, 0)
|
||||||
|
|
||||||
# CTRL + UP
|
## CTRL + UP
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Up,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Up,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.Up,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_Up,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
||||||
# CTRL + DOWN
|
## CTRL + DOWN
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Down,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Down,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.Down,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_Down,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
||||||
# CTRL + SHIFT + UP
|
## CTRL + SHIFT + UP
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Up,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Up,
|
||||||
gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK, 'mykeypress', int,
|
#Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, 'mykeypress', int,
|
||||||
gtk.keysyms.Up, gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK |
|
#Gdk.KEY_Up, Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK |
|
||||||
gtk.gdk.SHIFT_MASK)
|
#Gdk.ModifierType.SHIFT_MASK)
|
||||||
|
|
||||||
# CTRL + SHIFT + DOWN
|
## CTRL + SHIFT + DOWN
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Down,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Down,
|
||||||
gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK, 'mykeypress', int,
|
#Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, 'mykeypress', int,
|
||||||
gtk.keysyms.Down, gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK |
|
#Gdk.KEY_Down, Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK |
|
||||||
gtk.gdk.SHIFT_MASK)
|
#Gdk.ModifierType.SHIFT_MASK)
|
||||||
|
|
||||||
# ENTER
|
## ENTER
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Return,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Return,
|
||||||
0, 'mykeypress', int, gtk.keysyms.Return,
|
#0, 'mykeypress', int, Gdk.KEY_Return,
|
||||||
gtk.gdk.ModifierType, 0)
|
#Gdk.ModifierType, 0)
|
||||||
|
|
||||||
# Ctrl + Enter
|
## Ctrl + Enter
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.Return,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_Return,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.Return,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_Return,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
||||||
# Keypad Enter
|
## Keypad Enter
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.KP_Enter,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_KP_Enter,
|
||||||
0, 'mykeypress', int, gtk.keysyms.KP_Enter,
|
#0, 'mykeypress', int, Gdk.KEY_KP_Enter,
|
||||||
gtk.gdk.ModifierType, 0)
|
#Gdk.ModifierType, 0)
|
||||||
|
|
||||||
# Ctrl + Keypad Enter
|
## Ctrl + Keypad Enter
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.KP_Enter,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_KP_Enter,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.KP_Enter,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_KP_Enter,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
||||||
# Ctrl + z
|
## Ctrl + z
|
||||||
gtk.binding_entry_add_signal(MessageTextView, gtk.keysyms.z,
|
#Gtk.binding_entry_add_signal(MessageTextView, Gdk.KEY_z,
|
||||||
gtk.gdk.CONTROL_MASK, 'mykeypress', int, gtk.keysyms.z,
|
#Gdk.ModifierType.CONTROL_MASK, 'mykeypress', int, Gdk.KEY_z,
|
||||||
gtk.gdk.ModifierType, gtk.gdk.CONTROL_MASK)
|
#Gdk.ModifierType, Gdk.ModifierType.CONTROL_MASK)
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import GObject
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import common
|
import common
|
||||||
|
@ -106,16 +107,16 @@ class MessageWindow(object):
|
||||||
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
|
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
|
||||||
'<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \
|
'<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \
|
||||||
['<Alt>'+str(i) for i in xrange(10)]
|
['<Alt>'+str(i) for i in xrange(10)]
|
||||||
accel_group = gtk.AccelGroup()
|
accel_group = Gtk.AccelGroup()
|
||||||
for key in keys:
|
for key in keys:
|
||||||
keyval, mod = gtk.accelerator_parse(key)
|
keyval, mod = Gtk.accelerator_parse(key)
|
||||||
accel_group.connect_group(keyval, mod, gtk.ACCEL_VISIBLE,
|
accel_group.connect(keyval, mod, Gtk.AccelFlags.VISIBLE,
|
||||||
self.accel_group_func)
|
self.accel_group_func)
|
||||||
self.window.add_accel_group(accel_group)
|
self.window.add_accel_group(accel_group)
|
||||||
|
|
||||||
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
||||||
# so this line adds that
|
# so this line adds that
|
||||||
self.window.add_events(gtk.gdk.POINTER_MOTION_MASK)
|
self.window.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
|
||||||
|
|
||||||
id_ = self.notebook.connect('switch-page',
|
id_ = self.notebook.connect('switch-page',
|
||||||
self._on_notebook_switch_page)
|
self._on_notebook_switch_page)
|
||||||
|
@ -127,13 +128,13 @@ class MessageWindow(object):
|
||||||
# Tab customizations
|
# Tab customizations
|
||||||
pref_pos = gajim.config.get('tabs_position')
|
pref_pos = gajim.config.get('tabs_position')
|
||||||
if pref_pos == 'bottom':
|
if pref_pos == 'bottom':
|
||||||
nb_pos = gtk.POS_BOTTOM
|
nb_pos = Gtk.PositionType.BOTTOM
|
||||||
elif pref_pos == 'left':
|
elif pref_pos == 'left':
|
||||||
nb_pos = gtk.POS_LEFT
|
nb_pos = Gtk.PositionType.LEFT
|
||||||
elif pref_pos == 'right':
|
elif pref_pos == 'right':
|
||||||
nb_pos = gtk.POS_RIGHT
|
nb_pos = Gtk.PositionType.RIGHT
|
||||||
else:
|
else:
|
||||||
nb_pos = gtk.POS_TOP
|
nb_pos = Gtk.PositionType.TOP
|
||||||
self.notebook.set_tab_pos(nb_pos)
|
self.notebook.set_tab_pos(nb_pos)
|
||||||
window_mode = gajim.interface.msg_win_mgr.mode
|
window_mode = gajim.interface.msg_win_mgr.mode
|
||||||
if gajim.config.get('tabs_always_visible') or \
|
if gajim.config.get('tabs_always_visible') or \
|
||||||
|
@ -275,17 +276,17 @@ class MessageWindow(object):
|
||||||
scrolled = True
|
scrolled = True
|
||||||
self.notebook.set_show_tabs(True)
|
self.notebook.set_show_tabs(True)
|
||||||
if scrolled:
|
if scrolled:
|
||||||
gobject.idle_add(conv_textview.scroll_to_end_iter)
|
GObject.idle_add(conv_textview.scroll_to_end_iter)
|
||||||
|
|
||||||
# Add notebook page and connect up to the tab's close button
|
# Add notebook page and connect up to the tab's close button
|
||||||
xml = gtkgui_helpers.get_gtk_builder('message_window.ui', 'chat_tab_ebox')
|
xml = gtkgui_helpers.get_gtk_builder('message_window.ui', 'chat_tab_ebox')
|
||||||
tab_label_box = xml.get_object('chat_tab_ebox')
|
tab_label_box = xml.get_object('chat_tab_ebox')
|
||||||
widget = xml.get_object('tab_close_button')
|
widget = xml.get_object('tab_close_button')
|
||||||
#this reduces the size of the button
|
# this reduces the size of the button
|
||||||
style = gtk.RcStyle()
|
# style = Gtk.RcStyle()
|
||||||
style.xthickness = 0
|
# style.xthickness = 0
|
||||||
style.ythickness = 0
|
# style.ythickness = 0
|
||||||
widget.modify_style(style)
|
# widget.modify_style(style)
|
||||||
|
|
||||||
id_ = widget.connect('clicked', self._on_close_button_clicked, control)
|
id_ = widget.connect('clicked', self._on_close_button_clicked, control)
|
||||||
control.handlers[id_] = widget
|
control.handlers[id_] = widget
|
||||||
|
@ -305,7 +306,7 @@ class MessageWindow(object):
|
||||||
# NOTE: we do not call set_control_active(True) since we don't know
|
# NOTE: we do not call set_control_active(True) since we don't know
|
||||||
# whether the tab is the active one.
|
# whether the tab is the active one.
|
||||||
self.show_title()
|
self.show_title()
|
||||||
gobject.timeout_add(500, control.msg_textview.grab_focus)
|
GObject.timeout_add(500, control.msg_textview.grab_focus)
|
||||||
|
|
||||||
def on_tab_eventbox_button_press_event(self, widget, event, child):
|
def on_tab_eventbox_button_press_event(self, widget, event, child):
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
|
@ -317,27 +318,27 @@ class MessageWindow(object):
|
||||||
self.remove_tab(ctrl, self.CLOSE_TAB_MIDDLE_CLICK)
|
self.remove_tab(ctrl, self.CLOSE_TAB_MIDDLE_CLICK)
|
||||||
else:
|
else:
|
||||||
ctrl = self._widget_to_control(child)
|
ctrl = self._widget_to_control(child)
|
||||||
gobject.idle_add(ctrl.msg_textview.grab_focus)
|
GObject.idle_add(ctrl.msg_textview.grab_focus)
|
||||||
|
|
||||||
def _on_message_textview_mykeypress_event(self, widget, event_keyval,
|
def _on_message_textview_mykeypress_event(self, widget, event_keyval,
|
||||||
event_keymod):
|
event_keymod):
|
||||||
# NOTE: handles mykeypress which is custom signal; see message_textview.py
|
# NOTE: handles mykeypress which is custom signal; see message_textview.py
|
||||||
|
|
||||||
# construct event instance from binding
|
# construct event instance from binding
|
||||||
event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) # it's always a key-press here
|
event = Gdk.Event(Gdk.KEY_PRESS) # it's always a key-press here
|
||||||
event.keyval = event_keyval
|
event.keyval = event_keyval
|
||||||
event.state = event_keymod
|
event.state = event_keymod
|
||||||
event.time = 0 # assign current time
|
event.time = 0 # assign current time
|
||||||
|
|
||||||
if event.state & gtk.gdk.CONTROL_MASK:
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
|
||||||
# Tab switch bindings
|
# Tab switch bindings
|
||||||
if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
|
if event.keyval == Gdk.KEY_Tab: # CTRL + TAB
|
||||||
self.move_to_next_unread_tab(True)
|
self.move_to_next_unread_tab(True)
|
||||||
elif event.keyval == gtk.keysyms.ISO_Left_Tab: # CTRL + SHIFT + TAB
|
elif event.keyval == Gdk.KEY_ISO_Left_Tab: # CTRL + SHIFT + TAB
|
||||||
self.move_to_next_unread_tab(False)
|
self.move_to_next_unread_tab(False)
|
||||||
elif event.keyval == gtk.keysyms.Page_Down: # CTRL + PAGE DOWN
|
elif event.keyval == Gdk.KEY_Page_Down: # CTRL + PAGE DOWN
|
||||||
self.notebook.emit('key_press_event', event)
|
self.notebook.emit('key_press_event', event)
|
||||||
elif event.keyval == gtk.keysyms.Page_Up: # CTRL + PAGE UP
|
elif event.keyval == Gdk.KEY_Page_Up: # CTRL + PAGE UP
|
||||||
self.notebook.emit('key_press_event', event)
|
self.notebook.emit('key_press_event', event)
|
||||||
|
|
||||||
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
||||||
|
@ -348,76 +349,76 @@ class MessageWindow(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
# CTRL mask
|
# CTRL mask
|
||||||
if modifier & gtk.gdk.CONTROL_MASK:
|
if modifier & Gdk.ModifierType.CONTROL_MASK:
|
||||||
if keyval == gtk.keysyms.h: # CTRL + h
|
if keyval == Gdk.KEY_h: # CTRL + h
|
||||||
if gtk.settings_get_default().get_property(
|
if Gtk.Settings.get_default().get_property(
|
||||||
'gtk-key-theme-name') != 'Emacs':
|
'gtk-key-theme-name') != 'Emacs':
|
||||||
control._on_history_menuitem_activate()
|
control._on_history_menuitem_activate()
|
||||||
return True
|
return True
|
||||||
elif control.type_id == message_control.TYPE_CHAT and \
|
elif control.type_id == message_control.TYPE_CHAT and \
|
||||||
keyval == gtk.keysyms.f: # CTRL + f
|
keyval == Gdk.KEY_f: # CTRL + f
|
||||||
# CTRL + f moves cursor one char forward when user uses Emacs
|
# CTRL + f moves cursor one char forward when user uses Emacs
|
||||||
# theme
|
# theme
|
||||||
if not gtk.settings_get_default().get_property(
|
if not Gtk.Settings.get_default().get_property(
|
||||||
'gtk-key-theme-name') == 'Emacs':
|
'gtk-key-theme-name') == 'Emacs':
|
||||||
control._on_send_file_menuitem_activate(None)
|
control._on_send_file_menuitem_activate(None)
|
||||||
return True
|
return True
|
||||||
elif control.type_id == message_control.TYPE_CHAT and \
|
elif control.type_id == message_control.TYPE_CHAT and \
|
||||||
keyval == gtk.keysyms.g: # CTRL + g
|
keyval == Gdk.KEY_g: # CTRL + g
|
||||||
control._on_convert_to_gc_menuitem_activate(None)
|
control._on_convert_to_gc_menuitem_activate(None)
|
||||||
return True
|
return True
|
||||||
elif control.type_id in (message_control.TYPE_CHAT,
|
elif control.type_id in (message_control.TYPE_CHAT,
|
||||||
message_control.TYPE_PM) and keyval == gtk.keysyms.i: # CTRL + i
|
message_control.TYPE_PM) and keyval == Gdk.KEY_i: # CTRL + i
|
||||||
control._on_contact_information_menuitem_activate(None)
|
control._on_contact_information_menuitem_activate(None)
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.l or keyval == gtk.keysyms.L: # CTRL + l|L
|
elif keyval == Gdk.KEY_l or keyval == Gdk.KEY_L: # CTRL + l|L
|
||||||
control.conv_textview.clear()
|
control.conv_textview.clear()
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.u: # CTRL + u: emacs style clear line
|
elif keyval == Gdk.KEY_u: # CTRL + u: emacs style clear line
|
||||||
control.clear(control.msg_textview)
|
control.clear(control.msg_textview)
|
||||||
return True
|
return True
|
||||||
elif control.type_id == message_control.TYPE_GC and \
|
elif control.type_id == message_control.TYPE_GC and \
|
||||||
keyval == gtk.keysyms.b: # CTRL + b
|
keyval == Gdk.KEY_b: # CTRL + b
|
||||||
control._on_bookmark_room_menuitem_activate(None)
|
control._on_bookmark_room_menuitem_activate(None)
|
||||||
return True
|
return True
|
||||||
# Tab switch bindings
|
# Tab switch bindings
|
||||||
elif keyval == gtk.keysyms.F4: # CTRL + F4
|
elif keyval == Gdk.KEY_F4: # CTRL + F4
|
||||||
self.remove_tab(control, self.CLOSE_CTRL_KEY)
|
self.remove_tab(control, self.CLOSE_CTRL_KEY)
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.w: # CTRL + w
|
elif keyval == Gdk.KEY_w: # CTRL + w
|
||||||
# CTRL + w removes latest word before sursor when User uses emacs
|
# CTRL + w removes latest word before sursor when User uses emacs
|
||||||
# theme
|
# theme
|
||||||
if not gtk.settings_get_default().get_property(
|
if not Gtk.Settings.get_default().get_property(
|
||||||
'gtk-key-theme-name') == 'Emacs':
|
'gtk-key-theme-name') == 'Emacs':
|
||||||
self.remove_tab(control, self.CLOSE_CTRL_KEY)
|
self.remove_tab(control, self.CLOSE_CTRL_KEY)
|
||||||
return True
|
return True
|
||||||
elif keyval in (gtk.keysyms.Page_Up, gtk.keysyms.Page_Down):
|
elif keyval in (Gdk.KEY_Page_Up, Gdk.KEY_Page_Down):
|
||||||
# CTRL + PageUp | PageDown
|
# CTRL + PageUp | PageDown
|
||||||
# Create event and send it to notebook
|
# Create event and send it to notebook
|
||||||
event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
|
event = Gdk.Event(Gdk.KEY_PRESS)
|
||||||
event.window = self.window.window
|
event.window = self.window.window
|
||||||
event.time = int(time.time())
|
event.time = int(time.time())
|
||||||
event.state = gtk.gdk.CONTROL_MASK
|
event.state = Gdk.ModifierType.CONTROL_MASK
|
||||||
event.keyval = int(keyval)
|
event.keyval = int(keyval)
|
||||||
self.notebook.emit('key_press_event', event)
|
self.notebook.emit('key_press_event', event)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if modifier & gtk.gdk.SHIFT_MASK:
|
if modifier & Gdk.ModifierType.SHIFT_MASK:
|
||||||
# CTRL + SHIFT
|
# CTRL + SHIFT
|
||||||
if control.type_id == message_control.TYPE_GC and \
|
if control.type_id == message_control.TYPE_GC and \
|
||||||
keyval == gtk.keysyms.n: # CTRL + SHIFT + n
|
keyval == Gdk.KEY_n: # CTRL + SHIFT + n
|
||||||
control._on_change_nick_menuitem_activate(None)
|
control._on_change_nick_menuitem_activate(None)
|
||||||
return True
|
return True
|
||||||
# MOD1 (ALT) mask
|
# MOD1 (ALT) mask
|
||||||
elif modifier & gtk.gdk.MOD1_MASK:
|
elif modifier & Gdk.ModifierType.MOD1_MASK:
|
||||||
# Tab switch bindings
|
# Tab switch bindings
|
||||||
if keyval == gtk.keysyms.Right: # ALT + RIGHT
|
if keyval == Gdk.KEY_Right: # ALT + RIGHT
|
||||||
new = self.notebook.get_current_page() + 1
|
new = self.notebook.get_current_page() + 1
|
||||||
if new >= self.notebook.get_n_pages():
|
if new >= self.notebook.get_n_pages():
|
||||||
new = 0
|
new = 0
|
||||||
self.notebook.set_current_page(new)
|
self.notebook.set_current_page(new)
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.Left: # ALT + LEFT
|
elif keyval == Gdk.KEY_Left: # ALT + LEFT
|
||||||
new = self.notebook.get_current_page() - 1
|
new = self.notebook.get_current_page() - 1
|
||||||
if new < 0:
|
if new < 0:
|
||||||
new = self.notebook.get_n_pages() - 1
|
new = self.notebook.get_n_pages() - 1
|
||||||
|
@ -426,23 +427,23 @@ class MessageWindow(object):
|
||||||
elif chr(keyval) in st: # ALT + 1,2,3..
|
elif chr(keyval) in st: # ALT + 1,2,3..
|
||||||
self.notebook.set_current_page(st.index(chr(keyval)))
|
self.notebook.set_current_page(st.index(chr(keyval)))
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.c: # ALT + C toggles chat buttons
|
elif keyval == Gdk.KEY_c: # ALT + C toggles chat buttons
|
||||||
control.chat_buttons_set_visible(not control.hide_chat_buttons)
|
control.chat_buttons_set_visible(not control.hide_chat_buttons)
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.m: # ALT + M show emoticons menu
|
elif keyval == Gdk.KEY_m: # ALT + M show emoticons menu
|
||||||
control.show_emoticons_menu()
|
control.show_emoticons_menu()
|
||||||
return True
|
return True
|
||||||
elif keyval == gtk.keysyms.d: # ALT + D show actions menu
|
elif keyval == Gdk.KEY_d: # ALT + D show actions menu
|
||||||
if gtk.settings_get_default().get_property(
|
if Gtk.Settings.get_default().get_property(
|
||||||
'gtk-key-theme-name') != 'Emacs':
|
'gtk-key-theme-name') != 'Emacs':
|
||||||
control.on_actions_button_clicked(control.actions_button)
|
control.on_actions_button_clicked(control.actions_button)
|
||||||
return True
|
return True
|
||||||
elif control.type_id == message_control.TYPE_GC and \
|
elif control.type_id == message_control.TYPE_GC and \
|
||||||
keyval == gtk.keysyms.t: # ALT + t
|
keyval == Gdk.KEY_t: # ALT + t
|
||||||
control._on_change_subject_menuitem_activate(None)
|
control._on_change_subject_menuitem_activate(None)
|
||||||
return True
|
return True
|
||||||
# Close tab bindings
|
# Close tab bindings
|
||||||
elif keyval == gtk.keysyms.Escape and \
|
elif keyval == Gdk.KEY_Escape and \
|
||||||
gajim.config.get('escape_key_closes'): # Escape
|
gajim.config.get('escape_key_closes'): # Escape
|
||||||
self.remove_tab(control, self.CLOSE_ESC)
|
self.remove_tab(control, self.CLOSE_ESC)
|
||||||
return True
|
return True
|
||||||
|
@ -545,7 +546,7 @@ class MessageWindow(object):
|
||||||
ctrl_page = self.notebook.page_num(ctrl.widget)
|
ctrl_page = self.notebook.page_num(ctrl.widget)
|
||||||
self.notebook.set_current_page(ctrl_page)
|
self.notebook.set_current_page(ctrl_page)
|
||||||
self.window.present()
|
self.window.present()
|
||||||
gobject.idle_add(ctrl.msg_textview.grab_focus)
|
GObject.idle_add(ctrl.msg_textview.grab_focus)
|
||||||
|
|
||||||
def remove_tab(self, ctrl, method, reason = None, force = False):
|
def remove_tab(self, ctrl, method, reason = None, force = False):
|
||||||
"""
|
"""
|
||||||
|
@ -638,12 +639,12 @@ class MessageWindow(object):
|
||||||
(tab_label_str, tab_label_color) = ctrl.get_tab_label(chatstate)
|
(tab_label_str, tab_label_color) = ctrl.get_tab_label(chatstate)
|
||||||
nick_label.set_markup(tab_label_str)
|
nick_label.set_markup(tab_label_str)
|
||||||
if tab_label_color:
|
if tab_label_color:
|
||||||
nick_label.modify_fg(gtk.STATE_NORMAL, tab_label_color)
|
nick_label.modify_fg(Gtk.StateType.NORMAL, tab_label_color)
|
||||||
nick_label.modify_fg(gtk.STATE_ACTIVE, tab_label_color)
|
nick_label.modify_fg(Gtk.StateType.ACTIVE, tab_label_color)
|
||||||
|
|
||||||
tab_img = ctrl.get_tab_image()
|
tab_img = ctrl.get_tab_image()
|
||||||
if tab_img:
|
if tab_img:
|
||||||
if tab_img.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if tab_img.get_storage_type() == Gtk.ImageType.ANIMATION:
|
||||||
status_img.set_from_animation(tab_img.get_animation())
|
status_img.set_from_animation(tab_img.get_animation())
|
||||||
else:
|
else:
|
||||||
status_img.set_from_pixbuf(tab_img.get_pixbuf())
|
status_img.set_from_pixbuf(tab_img.get_pixbuf())
|
||||||
|
@ -810,37 +811,37 @@ class MessageWindow(object):
|
||||||
def _on_notebook_key_press(self, widget, event):
|
def _on_notebook_key_press(self, widget, event):
|
||||||
# when tab itself is selected,
|
# when tab itself is selected,
|
||||||
# make sure <- and -> are allowed for navigating between tabs
|
# make sure <- and -> are allowed for navigating between tabs
|
||||||
if event.keyval in (gtk.keysyms.Left, gtk.keysyms.Right):
|
if event.keyval in (Gdk.KEY_Left, Gdk.KEY_Right):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
control = self.get_active_control()
|
control = self.get_active_control()
|
||||||
|
|
||||||
if event.state & gtk.gdk.SHIFT_MASK:
|
if event.get_state() & Gdk.ModifierType.SHIFT_MASK:
|
||||||
# CTRL + SHIFT + TAB
|
# CTRL + SHIFT + TAB
|
||||||
if event.state & gtk.gdk.CONTROL_MASK and \
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK and \
|
||||||
event.keyval == gtk.keysyms.ISO_Left_Tab:
|
event.keyval == Gdk.KEY_ISO_Left_Tab:
|
||||||
self.move_to_next_unread_tab(False)
|
self.move_to_next_unread_tab(False)
|
||||||
return True
|
return True
|
||||||
# SHIFT + PAGE_[UP|DOWN]: send to conv_textview
|
# SHIFT + PAGE_[UP|DOWN]: send to conv_textview
|
||||||
elif event.keyval in (gtk.keysyms.Page_Down, gtk.keysyms.Page_Up):
|
elif event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up):
|
||||||
control.conv_textview.tv.emit('key_press_event', event)
|
control.conv_textview.tv.emit('key_press_event', event)
|
||||||
return True
|
return True
|
||||||
elif event.state & gtk.gdk.CONTROL_MASK:
|
elif event.get_state() & Gdk.ModifierType.CONTROL_MASK:
|
||||||
if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
|
if event.keyval == Gdk.KEY_Tab: # CTRL + TAB
|
||||||
self.move_to_next_unread_tab(True)
|
self.move_to_next_unread_tab(True)
|
||||||
return True
|
return True
|
||||||
# Ctrl+PageUP / DOWN has to be handled by notebook
|
# Ctrl+PageUP / DOWN has to be handled by notebook
|
||||||
elif event.keyval == gtk.keysyms.Page_Down:
|
elif event.keyval == Gdk.KEY_Page_Down:
|
||||||
self.move_to_next_unread_tab(True)
|
self.move_to_next_unread_tab(True)
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Page_Up:
|
elif event.keyval == Gdk.KEY_Page_Up:
|
||||||
self.move_to_next_unread_tab(False)
|
self.move_to_next_unread_tab(False)
|
||||||
return True
|
return True
|
||||||
if event.keyval in (gtk.keysyms.Shift_L, gtk.keysyms.Shift_R,
|
if event.keyval in (Gdk.KEY_Shift_L, Gdk.KEY_Shift_R,
|
||||||
gtk.keysyms.Control_L, gtk.keysyms.Control_R, gtk.keysyms.Caps_Lock,
|
Gdk.KEY_Control_L, Gdk.KEY_Control_R, Gdk.KEY_Caps_Lock,
|
||||||
gtk.keysyms.Shift_Lock, gtk.keysyms.Meta_L, gtk.keysyms.Meta_R,
|
Gdk.KEY_Shift_Lock, Gdk.KEY_Meta_L, Gdk.KEY_Meta_R,
|
||||||
gtk.keysyms.Alt_L, gtk.keysyms.Alt_R, gtk.keysyms.Super_L,
|
Gdk.KEY_Alt_L, Gdk.KEY_Alt_R, Gdk.KEY_Super_L,
|
||||||
gtk.keysyms.Super_R, gtk.keysyms.Hyper_L, gtk.keysyms.Hyper_R):
|
Gdk.KEY_Super_R, Gdk.KEY_Hyper_L, Gdk.KEY_Hyper_R):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if isinstance(control, ChatControlBase):
|
if isinstance(control, ChatControlBase):
|
||||||
|
@ -855,8 +856,8 @@ class MessageWindow(object):
|
||||||
"""
|
"""
|
||||||
page_num = -1
|
page_num = -1
|
||||||
to_right = False
|
to_right = False
|
||||||
horiz = self.notebook.get_tab_pos() == gtk.POS_TOP or \
|
horiz = self.notebook.get_tab_pos() == Gtk.PositionType.TOP or \
|
||||||
self.notebook.get_tab_pos() == gtk.POS_BOTTOM
|
self.notebook.get_tab_pos() == Gtk.PositionType.BOTTOM
|
||||||
for i in xrange(self.notebook.get_n_pages()):
|
for i in xrange(self.notebook.get_n_pages()):
|
||||||
page = self.notebook.get_nth_page(i)
|
page = self.notebook.get_nth_page(i)
|
||||||
tab = self.notebook.get_tab_label(page)
|
tab = self.notebook.get_tab_label(page)
|
||||||
|
@ -892,13 +893,13 @@ class MessageWindow(object):
|
||||||
return page_num
|
return page_num
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
class MessageWindowMgr(gobject.GObject):
|
class MessageWindowMgr(GObject.GObject):
|
||||||
"""
|
"""
|
||||||
A manager and factory for MessageWindow objects
|
A manager and factory for MessageWindow objects
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
'window-delete': (gobject.SIGNAL_RUN_LAST, None, (object,)),
|
'window-delete': (GObject.SignalFlags.RUN_LAST, None, (object,)),
|
||||||
}
|
}
|
||||||
|
|
||||||
# These constants map to common.config.opt_one_window_types indices
|
# These constants map to common.config.opt_one_window_types indices
|
||||||
|
@ -923,7 +924,7 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
ONE_MSG_WINDOW_PERACCT: The key is the account name
|
ONE_MSG_WINDOW_PERACCT: The key is the account name
|
||||||
ONE_MSG_WINDOW_PERTYPE: The key is a message type constant
|
ONE_MSG_WINDOW_PERTYPE: The key is a message type constant
|
||||||
"""
|
"""
|
||||||
gobject.GObject.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self._windows = {}
|
self._windows = {}
|
||||||
|
|
||||||
# Map the mode to a int constant for frequent compares
|
# Map the mode to a int constant for frequent compares
|
||||||
|
@ -984,7 +985,10 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
parent_size = win.window.get_size()
|
parent_size = win.window.get_size()
|
||||||
# Need to add the size of the now visible paned handle, otherwise
|
# Need to add the size of the now visible paned handle, otherwise
|
||||||
# the saved width of the message window decreases by this amount
|
# the saved width of the message window decreases by this amount
|
||||||
handle_size = win.parent_paned.style_get_property('handle-size')
|
s = GObject.Value()
|
||||||
|
s.init(GObject.TYPE_INT)
|
||||||
|
win.parent_paned.style_get_property('handle-size', s)
|
||||||
|
handle_size = s.get_int()
|
||||||
size = (parent_size[0] + size[0] + handle_size, size[1])
|
size = (parent_size[0] + size[0] + handle_size, size[1])
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_PERACCT:
|
elif self.mode == self.ONE_MSG_WINDOW_PERACCT:
|
||||||
size = (gajim.config.get_per('accounts', acct, 'msgwin-width'),
|
size = (gajim.config.get_per('accounts', acct, 'msgwin-width'),
|
||||||
|
@ -1195,7 +1199,7 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
size_height_key = type_ + '-msgwin-height'
|
size_height_key = type_ + '-msgwin-height'
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
|
elif self.mode == self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
|
||||||
# Ignore any hpaned width
|
# Ignore any hpaned width
|
||||||
width = msg_win.notebook.allocation.width
|
width = msg_win.notebook.get_allocation().width
|
||||||
|
|
||||||
if acct:
|
if acct:
|
||||||
gajim.config.set_per('accounts', acct, size_width_key, width)
|
gajim.config.set_per('accounts', acct, size_width_key, width)
|
||||||
|
@ -1206,8 +1210,8 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
gajim.config.set_per('accounts', acct, pos_y_key, y)
|
gajim.config.set_per('accounts', acct, pos_y_key, y)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
win_maximized = msg_win.window.window.get_state() == \
|
win_maximized = msg_win.window.get_window().get_state() == \
|
||||||
gtk.gdk.WINDOW_STATE_MAXIMIZED
|
Gdk.WindowState.MAXIMIZED
|
||||||
gajim.config.set(max_win_key, win_maximized)
|
gajim.config.set(max_win_key, win_maximized)
|
||||||
width += width_adjust
|
width += width_adjust
|
||||||
gajim.config.set(size_width_key, width)
|
gajim.config.set(size_width_key, width)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# install _() func before importing dbus_support
|
# install _() func before importing dbus_support
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
@ -36,9 +36,9 @@ class MusicTrackInfo(object):
|
||||||
__slots__ = ['title', 'album', 'artist', 'duration', 'track_number',
|
__slots__ = ['title', 'album', 'artist', 'duration', 'track_number',
|
||||||
'paused']
|
'paused']
|
||||||
|
|
||||||
class MusicTrackListener(gobject.GObject):
|
class MusicTrackListener(GObject.GObject):
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
'music-track-changed': (gobject.SIGNAL_RUN_LAST, None, (object,)),
|
'music-track-changed': (GObject.SignalFlags.RUN_LAST, None, (object,)),
|
||||||
}
|
}
|
||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
|
@ -300,4 +300,4 @@ if __name__ == '__main__':
|
||||||
print 'Now not playing anything'
|
print 'Now not playing anything'
|
||||||
else:
|
else:
|
||||||
print 'Now playing: "%s" by %s' % (track.title, track.artist)
|
print 'Now playing: "%s" by %s' % (track.title, track.artist)
|
||||||
gobject.MainLoop().run()
|
GObject.MainLoop().run()
|
||||||
|
|
|
@ -49,7 +49,7 @@ class FeatureNegotiationWindow:
|
||||||
dataform = dataforms.ExtendForm(node = self.form)
|
dataform = dataforms.ExtendForm(node = self.form)
|
||||||
self.data_form_widget = dataforms_widget.DataFormWidget(dataform)
|
self.data_form_widget = dataforms_widget.DataFormWidget(dataform)
|
||||||
self.data_form_widget.show()
|
self.data_form_widget.show()
|
||||||
config_vbox.pack_start(self.data_form_widget)
|
config_vbox.pack_start(self.data_form_widget, True, True, 0)
|
||||||
|
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from dialogs import PopupNotificationWindow
|
from dialogs import PopupNotificationWindow
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from common import helpers
|
from common import helpers
|
||||||
|
@ -45,8 +45,8 @@ if dbus_support.supported:
|
||||||
|
|
||||||
USER_HAS_PYNOTIFY = True # user has pynotify module
|
USER_HAS_PYNOTIFY = True # user has pynotify module
|
||||||
try:
|
try:
|
||||||
import pynotify
|
from gi.repository import Notify
|
||||||
pynotify.init('Gajim Notification')
|
Notify.init('Gajim Notification')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
USER_HAS_PYNOTIFY = False
|
USER_HAS_PYNOTIFY = False
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ text=None, timeout=-1):
|
||||||
if gajim.config.get('use_notif_daemon') and dbus_support.supported:
|
if gajim.config.get('use_notif_daemon') and dbus_support.supported:
|
||||||
try:
|
try:
|
||||||
DesktopNotification(event_type, jid, account, msg_type,
|
DesktopNotification(event_type, jid, account, msg_type,
|
||||||
path_to_image, title, gobject.markup_escape_text(text), timeout)
|
path_to_image, title, GObject.markup_escape_text(text), timeout)
|
||||||
return # sucessfully did D-Bus Notification procedure!
|
return # sucessfully did D-Bus Notification procedure!
|
||||||
except dbus.DBusException, e:
|
except dbus.DBusException, e:
|
||||||
# Connection to D-Bus failed
|
# Connection to D-Bus failed
|
||||||
|
@ -103,17 +103,17 @@ text=None, timeout=-1):
|
||||||
if not text and event_type == 'new_message':
|
if not text and event_type == 'new_message':
|
||||||
# empty text for new_message means do_preview = False
|
# empty text for new_message means do_preview = False
|
||||||
# -> default value for text
|
# -> default value for text
|
||||||
_text = gobject.markup_escape_text(
|
_text = GObject.markup_escape_text(
|
||||||
gajim.get_name_from_jid(account, jid))
|
gajim.get_name_from_jid(account, jid))
|
||||||
else:
|
else:
|
||||||
_text = gobject.markup_escape_text(text)
|
_text = GObject.markup_escape_text(text)
|
||||||
|
|
||||||
if not title:
|
if not title:
|
||||||
_title = ''
|
_title = ''
|
||||||
else:
|
else:
|
||||||
_title = title
|
_title = title
|
||||||
|
|
||||||
notification = pynotify.Notification(_title, _text)
|
notification = Notify.Notification(_title, _text)
|
||||||
notification.set_timeout(timeout*1000)
|
notification.set_timeout(timeout*1000)
|
||||||
|
|
||||||
notification.set_category(event_type)
|
notification.set_category(event_type)
|
||||||
|
@ -122,14 +122,14 @@ text=None, timeout=-1):
|
||||||
notification.set_data('account', account)
|
notification.set_data('account', account)
|
||||||
notification.set_data('msg_type', msg_type)
|
notification.set_data('msg_type', msg_type)
|
||||||
notification.set_property('icon-name', path_to_image)
|
notification.set_property('icon-name', path_to_image)
|
||||||
if 'actions' in pynotify.get_server_caps():
|
if 'actions' in Notify.get_server_caps():
|
||||||
notification.add_action('default', 'Default Action',
|
notification.add_action('default', 'Default Action',
|
||||||
on_pynotify_notification_clicked)
|
on_pynotify_notification_clicked)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
notification.show()
|
notification.show()
|
||||||
return
|
return
|
||||||
except gobject.GError, e:
|
except GObject.GError, e:
|
||||||
# Connection to notification-daemon failed, see #2893
|
# Connection to notification-daemon failed, see #2893
|
||||||
gajim.log.debug(str(e))
|
gajim.log.debug(str(e))
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,11 @@ GUI classes related to plug-in management.
|
||||||
|
|
||||||
__all__ = ['PluginsWindow']
|
__all__ = ['PluginsWindow']
|
||||||
|
|
||||||
import pango
|
from gi.repository import Pango
|
||||||
import gtk, gobject, os
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GdkPixbuf
|
||||||
|
from gi.repository import GObject
|
||||||
|
import os
|
||||||
|
|
||||||
import gtkgui_helpers
|
import gtkgui_helpers
|
||||||
from dialogs import WarningDialog, YesNoDialog, ArchiveChooserDialog
|
from dialogs import WarningDialog, YesNoDialog, ArchiveChooserDialog
|
||||||
|
@ -53,7 +56,7 @@ class PluginsWindow(object):
|
||||||
'''Initialize Plugins window'''
|
'''Initialize Plugins window'''
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('plugins_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('plugins_window.ui')
|
||||||
self.window = self.xml.get_object('plugins_window')
|
self.window = self.xml.get_object('plugins_window')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.set_transient_for(gajim.interface.roster.window)
|
||||||
|
|
||||||
widgets_to_extract = ('plugins_notebook', 'plugin_name_label',
|
widgets_to_extract = ('plugins_notebook', 'plugin_name_label',
|
||||||
'plugin_version_label', 'plugin_authors_label',
|
'plugin_version_label', 'plugin_authors_label',
|
||||||
|
@ -64,45 +67,45 @@ class PluginsWindow(object):
|
||||||
for widget_name in widgets_to_extract:
|
for widget_name in widgets_to_extract:
|
||||||
setattr(self, widget_name, self.xml.get_object(widget_name))
|
setattr(self, widget_name, self.xml.get_object(widget_name))
|
||||||
|
|
||||||
attr_list = pango.AttrList()
|
attr_list = Pango.AttrList()
|
||||||
attr_list.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1))
|
attr_list.insert(Pango.AttrWeight(Pango.Weight.BOLD, 0, -1))
|
||||||
self.plugin_name_label.set_attributes(attr_list)
|
self.plugin_name_label.set_attributes(attr_list)
|
||||||
|
|
||||||
self.installed_plugins_model = gtk.ListStore(gobject.TYPE_PYOBJECT,
|
self.installed_plugins_model = Gtk.ListStore(GObject.TYPE_PYOBJECT,
|
||||||
gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, gobject.TYPE_BOOLEAN,
|
GObject.TYPE_STRING, GObject.TYPE_BOOLEAN, GObject.TYPE_BOOLEAN,
|
||||||
gtk.gdk.Pixbuf)
|
GdkPixbuf.Pixbuf)
|
||||||
self.installed_plugins_treeview.set_model(self.installed_plugins_model)
|
self.installed_plugins_treeview.set_model(self.installed_plugins_model)
|
||||||
self.installed_plugins_treeview.set_rules_hint(True)
|
self.installed_plugins_treeview.set_rules_hint(True)
|
||||||
|
|
||||||
renderer = gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('Plugin'))#, renderer, text=NAME)
|
col = Gtk.TreeViewColumn(_('Plugin'))#, renderer, text=NAME)
|
||||||
cell = gtk.CellRendererPixbuf()
|
cell = Gtk.CellRendererPixbuf()
|
||||||
col.pack_start(cell, False)
|
col.pack_start(cell, False, True, 0)
|
||||||
col.add_attribute(cell, 'pixbuf', ICON)
|
col.add_attribute(cell, 'pixbuf', ICON)
|
||||||
col.pack_start(renderer, True)
|
col.pack_start(renderer, True, True, 0)
|
||||||
col.add_attribute(renderer, 'text', NAME)
|
col.add_attribute(renderer, 'text', NAME)
|
||||||
self.installed_plugins_treeview.append_column(col)
|
self.installed_plugins_treeview.append_column(col)
|
||||||
|
|
||||||
renderer = gtk.CellRendererToggle()
|
renderer = Gtk.CellRendererToggle()
|
||||||
renderer.connect('toggled', self.installed_plugins_toggled_cb)
|
renderer.connect('toggled', self.installed_plugins_toggled_cb)
|
||||||
col = gtk.TreeViewColumn(_('Active'), renderer, active=ACTIVE,
|
col = Gtk.TreeViewColumn(_('Active'), renderer, active=ACTIVE,
|
||||||
activatable=ACTIVATABLE)
|
activatable=ACTIVATABLE)
|
||||||
self.installed_plugins_treeview.append_column(col)
|
self.installed_plugins_treeview.append_column(col)
|
||||||
|
|
||||||
icon = gtk.Image()
|
icon = Gtk.Image()
|
||||||
self.def_icon = icon.render_icon(gtk.STOCK_PREFERENCES,
|
self.def_icon = icon.render_icon(Gtk.STOCK_PREFERENCES,
|
||||||
gtk.ICON_SIZE_MENU)
|
Gtk.IconSize.MENU)
|
||||||
|
|
||||||
# connect signal for selection change
|
# connect signal for selection change
|
||||||
selection = self.installed_plugins_treeview.get_selection()
|
selection = self.installed_plugins_treeview.get_selection()
|
||||||
selection.connect('changed',
|
selection.connect('changed',
|
||||||
self.installed_plugins_treeview_selection_changed)
|
self.installed_plugins_treeview_selection_changed)
|
||||||
selection.set_mode(gtk.SELECTION_SINGLE)
|
selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||||
|
|
||||||
self._clear_installed_plugin_info()
|
self._clear_installed_plugin_info()
|
||||||
|
|
||||||
self.fill_installed_plugins_model()
|
self.fill_installed_plugins_model()
|
||||||
selection.select_iter(self.installed_plugins_model.get_iter_root())
|
selection.select_iter(self.installed_plugins_model.get_iter_first())
|
||||||
|
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
|
|
||||||
|
@ -114,7 +117,7 @@ class PluginsWindow(object):
|
||||||
|
|
||||||
|
|
||||||
def on_plugins_notebook_switch_page(self, widget, page, page_num):
|
def on_plugins_notebook_switch_page(self, widget, page, page_num):
|
||||||
gobject.idle_add(self.xml.get_object('close_button').grab_focus)
|
GObject.idle_add(self.xml.get_object('close_button').grab_focus)
|
||||||
|
|
||||||
@log_calls('PluginsWindow')
|
@log_calls('PluginsWindow')
|
||||||
def installed_plugins_treeview_selection_changed(self, treeview_selection):
|
def installed_plugins_treeview_selection_changed(self, treeview_selection):
|
||||||
|
@ -133,7 +136,7 @@ class PluginsWindow(object):
|
||||||
self.plugin_version_label.set_text(plugin.version)
|
self.plugin_version_label.set_text(plugin.version)
|
||||||
self.plugin_authors_label.set_text(plugin.authors)
|
self.plugin_authors_label.set_text(plugin.authors)
|
||||||
label = self.plugin_homepage_linkbutton.get_children()[0]
|
label = self.plugin_homepage_linkbutton.get_children()[0]
|
||||||
label.set_ellipsize(pango.ELLIPSIZE_END)
|
label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
self.plugin_homepage_linkbutton.set_uri(plugin.homepage)
|
self.plugin_homepage_linkbutton.set_uri(plugin.homepage)
|
||||||
self.plugin_homepage_linkbutton.set_label(plugin.homepage)
|
self.plugin_homepage_linkbutton.set_label(plugin.homepage)
|
||||||
self.plugin_homepage_linkbutton.set_property('sensitive', True)
|
self.plugin_homepage_linkbutton.set_property('sensitive', True)
|
||||||
|
@ -170,7 +173,7 @@ class PluginsWindow(object):
|
||||||
def fill_installed_plugins_model(self):
|
def fill_installed_plugins_model(self):
|
||||||
pm = gajim.plugin_manager
|
pm = gajim.plugin_manager
|
||||||
self.installed_plugins_model.clear()
|
self.installed_plugins_model.clear()
|
||||||
self.installed_plugins_model.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
self.installed_plugins_model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
|
||||||
|
|
||||||
for plugin in pm.plugins:
|
for plugin in pm.plugins:
|
||||||
icon = self.get_plugin_icon(plugin)
|
icon = self.get_plugin_icon(plugin)
|
||||||
|
@ -182,7 +185,7 @@ class PluginsWindow(object):
|
||||||
plugin.__path__)[1]) + '.png'
|
plugin.__path__)[1]) + '.png'
|
||||||
icon = self.def_icon
|
icon = self.def_icon
|
||||||
if os.path.isfile(icon_file):
|
if os.path.isfile(icon_file):
|
||||||
icon = gtk.gdk.pixbuf_new_from_file_at_size(icon_file, 16, 16)
|
icon = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_file, 16, 16)
|
||||||
return icon
|
return icon
|
||||||
|
|
||||||
@log_calls('PluginsWindow')
|
@log_calls('PluginsWindow')
|
||||||
|
@ -299,16 +302,16 @@ class PluginsWindow(object):
|
||||||
self.dialog = ArchiveChooserDialog(on_response_ok=_try_install)
|
self.dialog = ArchiveChooserDialog(on_response_ok=_try_install)
|
||||||
|
|
||||||
|
|
||||||
class GajimPluginConfigDialog(gtk.Dialog):
|
class GajimPluginConfigDialog(Gtk.Dialog):
|
||||||
|
|
||||||
@log_calls('GajimPluginConfigDialog')
|
@log_calls('GajimPluginConfigDialog')
|
||||||
def __init__(self, plugin, **kwargs):
|
def __init__(self, plugin, **kwargs):
|
||||||
gtk.Dialog.__init__(self, '%s %s'%(plugin.name, _('Configuration')),
|
Gtk.Dialog.__init__(self, '%s %s'%(plugin.name, _('Configuration')),
|
||||||
**kwargs)
|
**kwargs)
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.add_button('gtk-close', gtk.RESPONSE_CLOSE)
|
self.add_button('gtk-close', Gtk.ResponseType.CLOSE)
|
||||||
|
|
||||||
self.child.set_spacing(3)
|
self.get_child().set_spacing(3)
|
||||||
|
|
||||||
self.init()
|
self.init()
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
|
|
||||||
# THIS FILE IS FOR **OUR** PROFILE (when we edit our INFO)
|
# THIS FILE IS FOR **OUR** PROFILE (when we edit our INFO)
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GdkPixbuf
|
||||||
|
from gi.repository import GObject
|
||||||
import base64
|
import base64
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
|
@ -45,7 +46,7 @@ class ProfileWindow:
|
||||||
def __init__(self, account, transient_for=None):
|
def __init__(self, account, transient_for=None):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('profile_window.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('profile_window.ui')
|
||||||
self.window = self.xml.get_object('profile_window')
|
self.window = self.xml.get_object('profile_window')
|
||||||
self.window.set_transient_for(transient_for)
|
self.set_transient_for(transient_for)
|
||||||
self.progressbar = self.xml.get_object('progressbar')
|
self.progressbar = self.xml.get_object('progressbar')
|
||||||
self.statusbar = self.xml.get_object('statusbar')
|
self.statusbar = self.xml.get_object('statusbar')
|
||||||
self.context_id = self.statusbar.get_context_id('profile')
|
self.context_id = self.statusbar.get_context_id('profile')
|
||||||
|
@ -58,12 +59,12 @@ class ProfileWindow:
|
||||||
self.avatar_encoded = None
|
self.avatar_encoded = None
|
||||||
self.message_id = self.statusbar.push(self.context_id,
|
self.message_id = self.statusbar.push(self.context_id,
|
||||||
_('Retrieving profile...'))
|
_('Retrieving profile...'))
|
||||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
self.update_progressbar_timeout_id = GObject.timeout_add(100,
|
||||||
self.update_progressbar)
|
self.update_progressbar)
|
||||||
self.remove_statusbar_timeout_id = None
|
self.remove_statusbar_timeout_id = None
|
||||||
|
|
||||||
# Create Image for avatar button
|
# Create Image for avatar button
|
||||||
image = gtk.Image()
|
image = Gtk.Image()
|
||||||
self.xml.get_object('PHOTO_button').set_image(image)
|
self.xml.get_object('PHOTO_button').set_image(image)
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
gajim.ged.register_event_handler('vcard-published', ged.GUI1,
|
gajim.ged.register_event_handler('vcard-published', ged.GUI1,
|
||||||
|
@ -76,7 +77,7 @@ class ProfileWindow:
|
||||||
self.xml.get_object('ok_button').grab_focus()
|
self.xml.get_object('ok_button').grab_focus()
|
||||||
|
|
||||||
def on_information_notebook_switch_page(self, widget, page, page_num):
|
def on_information_notebook_switch_page(self, widget, page, page_num):
|
||||||
gobject.idle_add(self.xml.get_object('ok_button').grab_focus)
|
GObject.idle_add(self.xml.get_object('ok_button').grab_focus)
|
||||||
|
|
||||||
def update_progressbar(self):
|
def update_progressbar(self):
|
||||||
self.progressbar.pulse()
|
self.progressbar.pulse()
|
||||||
|
@ -88,9 +89,9 @@ class ProfileWindow:
|
||||||
|
|
||||||
def on_profile_window_destroy(self, widget):
|
def on_profile_window_destroy(self, widget):
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
if self.remove_statusbar_timeout_id is not None:
|
if self.remove_statusbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.remove_statusbar_timeout_id)
|
GObject.source_remove(self.remove_statusbar_timeout_id)
|
||||||
gajim.ged.remove_event_handler('vcard-published', ged.GUI1,
|
gajim.ged.remove_event_handler('vcard-published', ged.GUI1,
|
||||||
self._nec_vcard_published)
|
self._nec_vcard_published)
|
||||||
gajim.ged.remove_event_handler('vcard-not-published', ged.GUI1,
|
gajim.ged.remove_event_handler('vcard-not-published', ged.GUI1,
|
||||||
|
@ -102,7 +103,7 @@ class ProfileWindow:
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
|
|
||||||
def on_profile_window_key_press_event(self, widget, event):
|
def on_profile_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_clear_button_clicked(self, widget):
|
def on_clear_button_clicked(self, widget):
|
||||||
|
@ -132,12 +133,12 @@ class ProfileWindow:
|
||||||
msg = _('File does not exist')
|
msg = _('File does not exist')
|
||||||
if not invalid_file and filesize > 16384: # 16 kb
|
if not invalid_file and filesize > 16384: # 16 kb
|
||||||
try:
|
try:
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file(path_to_file)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path_to_file)
|
||||||
# get the image at 'notification size'
|
# get the image at 'notification size'
|
||||||
# and hope that user did not specify in ACE crazy size
|
# and hope that user did not specify in ACE crazy size
|
||||||
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf,
|
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf,
|
||||||
'tooltip')
|
'tooltip')
|
||||||
except gobject.GError, msg: # unknown format
|
except GObject.GError, msg: # unknown format
|
||||||
# msg should be string, not object instance
|
# msg should be string, not object instance
|
||||||
msg = str(msg)
|
msg = str(msg)
|
||||||
invalid_file = True
|
invalid_file = True
|
||||||
|
@ -198,7 +199,7 @@ class ProfileWindow:
|
||||||
If right-clicked, show popup
|
If right-clicked, show popup
|
||||||
"""
|
"""
|
||||||
if event.button == 3 and self.avatar_encoded: # right click
|
if event.button == 3 and self.avatar_encoded: # right click
|
||||||
menu = gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
|
|
||||||
# Try to get pixbuf
|
# Try to get pixbuf
|
||||||
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(self.jid,
|
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(self.jid,
|
||||||
|
@ -206,13 +207,13 @@ class ProfileWindow:
|
||||||
|
|
||||||
if pixbuf not in (None, 'ask'):
|
if pixbuf not in (None, 'ask'):
|
||||||
nick = gajim.config.get_per('accounts', self.account, 'name')
|
nick = gajim.config.get_per('accounts', self.account, 'name')
|
||||||
menuitem = gtk.ImageMenuItem(gtk.STOCK_SAVE_AS)
|
menuitem = Gtk.ImageMenuItem(Gtk.STOCK_SAVE_AS)
|
||||||
menuitem.connect('activate',
|
menuitem.connect('activate',
|
||||||
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
||||||
self.jid, nick)
|
self.jid, nick)
|
||||||
menu.append(menuitem)
|
menu.append(menuitem)
|
||||||
# show clear
|
# show clear
|
||||||
menuitem = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
|
menuitem = Gtk.ImageMenuItem(Gtk.STOCK_CLEAR)
|
||||||
menuitem.connect('activate', self.on_clear_button_clicked)
|
menuitem.connect('activate', self.on_clear_button_clicked)
|
||||||
menu.append(menuitem)
|
menu.append(menuitem)
|
||||||
menu.connect('selection-done', lambda w:w.destroy())
|
menu.connect('selection-done', lambda w:w.destroy())
|
||||||
|
@ -233,7 +234,7 @@ class ProfileWindow:
|
||||||
pritext = _('Wrong date format')
|
pritext = _('Wrong date format')
|
||||||
dialogs.ErrorDialog(pritext, _('Format of the date must be '
|
dialogs.ErrorDialog(pritext, _('Format of the date must be '
|
||||||
'YYYY-MM-DD'))
|
'YYYY-MM-DD'))
|
||||||
gobject.idle_add(lambda: widget.grab_focus())
|
GObject.idle_add(lambda: widget.grab_focus())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_value(self, entry_name, value):
|
def set_value(self, entry_name, value):
|
||||||
|
@ -290,9 +291,9 @@ class ProfileWindow:
|
||||||
self.statusbar.remove_message(self.context_id, self.message_id)
|
self.statusbar.remove_message(self.context_id, self.message_id)
|
||||||
self.message_id = self.statusbar.push(self.context_id,
|
self.message_id = self.statusbar.push(self.context_id,
|
||||||
_('Information received'))
|
_('Information received'))
|
||||||
self.remove_statusbar_timeout_id = gobject.timeout_add_seconds(3,
|
self.remove_statusbar_timeout_id = GObject.timeout_add_seconds(3,
|
||||||
self.remove_statusbar, self.message_id)
|
self.remove_statusbar, self.message_id)
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
self.progressbar.hide()
|
self.progressbar.hide()
|
||||||
self.progressbar.set_fraction(0)
|
self.progressbar.set_fraction(0)
|
||||||
self.update_progressbar_timeout_id = None
|
self.update_progressbar_timeout_id = None
|
||||||
|
@ -350,7 +351,7 @@ class ProfileWindow:
|
||||||
buff = self.xml.get_object('DESC_textview').get_buffer()
|
buff = self.xml.get_object('DESC_textview').get_buffer()
|
||||||
start_iter = buff.get_start_iter()
|
start_iter = buff.get_start_iter()
|
||||||
end_iter = buff.get_end_iter()
|
end_iter = buff.get_end_iter()
|
||||||
txt = buff.get_text(start_iter, end_iter, 0)
|
txt = buff.get_text(start_iter, end_iter, False)
|
||||||
if txt != '':
|
if txt != '':
|
||||||
vcard_['DESC'] = txt.decode('utf-8')
|
vcard_['DESC'] = txt.decode('utf-8')
|
||||||
|
|
||||||
|
@ -382,14 +383,14 @@ class ProfileWindow:
|
||||||
self.message_id = self.statusbar.push(self.context_id,
|
self.message_id = self.statusbar.push(self.context_id,
|
||||||
_('Sending profile...'))
|
_('Sending profile...'))
|
||||||
self.progressbar.show()
|
self.progressbar.show()
|
||||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
self.update_progressbar_timeout_id = GObject.timeout_add(100,
|
||||||
self.update_progressbar)
|
self.update_progressbar)
|
||||||
|
|
||||||
def _nec_vcard_published(self, obj):
|
def _nec_vcard_published(self, obj):
|
||||||
if obj.conn.name != self.account:
|
if obj.conn.name != self.account:
|
||||||
return
|
return
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
self.update_progressbar_timeout_id = None
|
self.update_progressbar_timeout_id = None
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
@ -400,10 +401,10 @@ class ProfileWindow:
|
||||||
self.statusbar.remove_message(self.context_id, self.message_id)
|
self.statusbar.remove_message(self.context_id, self.message_id)
|
||||||
self.message_id = self.statusbar.push(self.context_id,
|
self.message_id = self.statusbar.push(self.context_id,
|
||||||
_('Information NOT published'))
|
_('Information NOT published'))
|
||||||
self.remove_statusbar_timeout_id = gobject.timeout_add_seconds(3,
|
self.remove_statusbar_timeout_id = GObject.timeout_add_seconds(3,
|
||||||
self.remove_statusbar, self.message_id)
|
self.remove_statusbar, self.message_id)
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
self.progressbar.set_fraction(0)
|
self.progressbar.set_fraction(0)
|
||||||
self.update_progressbar_timeout_id = None
|
self.update_progressbar_timeout_id = None
|
||||||
dialogs.InformationDialog(_('vCard publication failed'),
|
dialogs.InformationDialog(_('vCard publication failed'),
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
@ -535,7 +535,7 @@ class SignalObject(dbus.service.Object):
|
||||||
win = gajim.interface.msg_win_mgr.get_window(jid,
|
win = gajim.interface.msg_win_mgr.get_window(jid,
|
||||||
connected_account).window
|
connected_account).window
|
||||||
if win.get_property('visible'):
|
if win.get_property('visible'):
|
||||||
win.window.focus(gtk.get_current_event_time())
|
win.window.focus(Gtk.get_current_event_time())
|
||||||
return DBUS_BOOLEAN(True)
|
return DBUS_BOOLEAN(True)
|
||||||
return DBUS_BOOLEAN(False)
|
return DBUS_BOOLEAN(False)
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ class SignalObject(dbus.service.Object):
|
||||||
if account not in gajim.connections:
|
if account not in gajim.connections:
|
||||||
return DBUS_BOOLEAN(False)
|
return DBUS_BOOLEAN(False)
|
||||||
status = gajim.SHOW_LIST[gajim.connections[account].connected]
|
status = gajim.SHOW_LIST[gajim.connections[account].connected]
|
||||||
gobject.idle_add(gajim.interface.roster.send_status, account,
|
GObject.idle_add(gajim.interface.roster.send_status, account,
|
||||||
status, message)
|
status, message)
|
||||||
else:
|
else:
|
||||||
# account not specified, so change the status of all accounts
|
# account not specified, so change the status of all accounts
|
||||||
|
@ -567,7 +567,7 @@ class SignalObject(dbus.service.Object):
|
||||||
if acc not in gajim.connections:
|
if acc not in gajim.connections:
|
||||||
continue
|
continue
|
||||||
status_ = gajim.SHOW_LIST[gajim.connections[acc].connected]
|
status_ = gajim.SHOW_LIST[gajim.connections[acc].connected]
|
||||||
gobject.idle_add(gajim.interface.roster.send_status, acc,
|
GObject.idle_add(gajim.interface.roster.send_status, acc,
|
||||||
status_, message)
|
status_, message)
|
||||||
return DBUS_BOOLEAN(False)
|
return DBUS_BOOLEAN(False)
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ class SignalObject(dbus.service.Object):
|
||||||
gajim.config.set_per('accounts', account, 'priority', prio)
|
gajim.config.set_per('accounts', account, 'priority', prio)
|
||||||
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
||||||
status = gajim.connections[account].status
|
status = gajim.connections[account].status
|
||||||
gobject.idle_add(gajim.connections[account].change_status, show,
|
GObject.idle_add(gajim.connections[account].change_status, show,
|
||||||
status)
|
status)
|
||||||
else:
|
else:
|
||||||
# account not specified, so change prio of all accounts
|
# account not specified, so change prio of all accounts
|
||||||
|
@ -594,7 +594,7 @@ class SignalObject(dbus.service.Object):
|
||||||
gajim.config.set_per('accounts', acc, 'priority', prio)
|
gajim.config.set_per('accounts', acc, 'priority', prio)
|
||||||
show = gajim.SHOW_LIST[gajim.connections[acc].connected]
|
show = gajim.SHOW_LIST[gajim.connections[acc].connected]
|
||||||
status = gajim.connections[acc].status
|
status = gajim.connections[acc].status
|
||||||
gobject.idle_add(gajim.connections[acc].change_status, show,
|
GObject.idle_add(gajim.connections[acc].change_status, show,
|
||||||
status)
|
status)
|
||||||
|
|
||||||
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
|
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
|
||||||
|
@ -687,12 +687,12 @@ class SignalObject(dbus.service.Object):
|
||||||
"""
|
"""
|
||||||
win = gajim.interface.roster.window
|
win = gajim.interface.roster.window
|
||||||
if win.get_property('visible'):
|
if win.get_property('visible'):
|
||||||
gobject.idle_add(win.hide)
|
GObject.idle_add(win.hide)
|
||||||
else:
|
else:
|
||||||
win.present()
|
win.present()
|
||||||
# preserve the 'steal focus preservation'
|
# preserve the 'steal focus preservation'
|
||||||
if self._is_first():
|
if self._is_first():
|
||||||
win.window.focus(gtk.get_current_event_time())
|
win.window.focus(Gtk.get_current_event_time())
|
||||||
else:
|
else:
|
||||||
win.window.focus(long(time()))
|
win.window.focus(long(time()))
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ class SignalObject(dbus.service.Object):
|
||||||
win.present()
|
win.present()
|
||||||
# preserve the 'steal focus preservation'
|
# preserve the 'steal focus preservation'
|
||||||
if self._is_first():
|
if self._is_first():
|
||||||
win.window.focus(gtk.get_current_event_time())
|
win.window.focus(Gtk.get_current_event_time())
|
||||||
else:
|
else:
|
||||||
win.window.focus(long(time()))
|
win.window.focus(long(time()))
|
||||||
|
|
||||||
|
@ -717,7 +717,7 @@ class SignalObject(dbus.service.Object):
|
||||||
win = gajim.ipython_window
|
win = gajim.ipython_window
|
||||||
if win:
|
if win:
|
||||||
if win.window.is_visible():
|
if win.window.is_visible():
|
||||||
gobject.idle_add(win.hide)
|
GObject.idle_add(win.hide)
|
||||||
else:
|
else:
|
||||||
win.show_all()
|
win.show_all()
|
||||||
win.present()
|
win.present()
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,8 +19,8 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from common import dataforms
|
from common import dataforms
|
||||||
|
@ -52,7 +52,7 @@ class SearchWindow:
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
self.request_form()
|
self.request_form()
|
||||||
self.pulse_id = gobject.timeout_add(80, self.pulse_callback)
|
self.pulse_id = GObject.timeout_add(80, self.pulse_callback)
|
||||||
|
|
||||||
self.is_form = None
|
self.is_form = None
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ class SearchWindow:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_search_window_key_press_event(self, widget, event):
|
def on_search_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_search_window_destroy(self, widget):
|
def on_search_window_destroy(self, widget):
|
||||||
if self.pulse_id:
|
if self.pulse_id:
|
||||||
gobject.source_remove(self.pulse_id)
|
GObject.source_remove(self.pulse_id)
|
||||||
del gajim.interface.instances[self.account]['search'][self.jid]
|
del gajim.interface.instances[self.account]['search'][self.jid]
|
||||||
gajim.ged.remove_event_handler('search-form-received', ged.GUI1,
|
gajim.ged.remove_event_handler('search-form-received', ged.GUI1,
|
||||||
self._nec_search_form_received)
|
self._nec_search_form_received)
|
||||||
|
@ -104,7 +104,7 @@ class SearchWindow:
|
||||||
self.progressbar.show()
|
self.progressbar.show()
|
||||||
self.label.set_text(_('Waiting for results'))
|
self.label.set_text(_('Waiting for results'))
|
||||||
self.label.show()
|
self.label.show()
|
||||||
self.pulse_id = gobject.timeout_add(80, self.pulse_callback)
|
self.pulse_id = GObject.timeout_add(80, self.pulse_callback)
|
||||||
self.search_button.hide()
|
self.search_button.hide()
|
||||||
|
|
||||||
def on_add_contact_button_clicked(self, widget):
|
def on_add_contact_button_clicked(self, widget):
|
||||||
|
@ -128,7 +128,7 @@ class SearchWindow:
|
||||||
|
|
||||||
def _nec_search_form_received(self, obj):
|
def _nec_search_form_received(self, obj):
|
||||||
if self.pulse_id:
|
if self.pulse_id:
|
||||||
gobject.source_remove(self.pulse_id)
|
GObject.source_remove(self.pulse_id)
|
||||||
self.progressbar.hide()
|
self.progressbar.hide()
|
||||||
self.label.hide()
|
self.label.hide()
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class SearchWindow:
|
||||||
self.data_form_widget = config.FakeDataForm(obj.data)
|
self.data_form_widget = config.FakeDataForm(obj.data)
|
||||||
|
|
||||||
self.data_form_widget.show_all()
|
self.data_form_widget.show_all()
|
||||||
self.search_vbox.pack_start(self.data_form_widget)
|
self.search_vbox.pack_start(self.data_form_widget, True, True, 0)
|
||||||
|
|
||||||
def on_result_treeview_cursor_changed(self, treeview):
|
def on_result_treeview_cursor_changed(self, treeview):
|
||||||
if self.jid_column == -1:
|
if self.jid_column == -1:
|
||||||
|
@ -168,7 +168,7 @@ class SearchWindow:
|
||||||
|
|
||||||
def _nec_search_result_received(self, obj):
|
def _nec_search_result_received(self, obj):
|
||||||
if self.pulse_id:
|
if self.pulse_id:
|
||||||
gobject.source_remove(self.pulse_id)
|
GObject.source_remove(self.pulse_id)
|
||||||
self.progressbar.hide()
|
self.progressbar.hide()
|
||||||
self.label.hide()
|
self.label.hide()
|
||||||
|
|
||||||
|
@ -178,29 +178,29 @@ class SearchWindow:
|
||||||
self.label.show()
|
self.label.show()
|
||||||
return
|
return
|
||||||
# We suppose all items have the same fields
|
# We suppose all items have the same fields
|
||||||
sw = gtk.ScrolledWindow()
|
sw = Gtk.ScrolledWindow()
|
||||||
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
self.result_treeview = gtk.TreeView()
|
self.result_treeview = Gtk.TreeView()
|
||||||
self.result_treeview.connect('cursor-changed',
|
self.result_treeview.connect('cursor-changed',
|
||||||
self.on_result_treeview_cursor_changed)
|
self.on_result_treeview_cursor_changed)
|
||||||
sw.add(self.result_treeview)
|
sw.add(self.result_treeview)
|
||||||
# Create model
|
# Create model
|
||||||
fieldtypes = [str]*len(obj.data[0])
|
fieldtypes = [str]*len(obj.data[0])
|
||||||
model = gtk.ListStore(*fieldtypes)
|
model = Gtk.ListStore(*fieldtypes)
|
||||||
# Copy data to model
|
# Copy data to model
|
||||||
for item in obj.data:
|
for item in obj.data:
|
||||||
model.append(item.values())
|
model.append(item.values())
|
||||||
# Create columns
|
# Create columns
|
||||||
counter = 0
|
counter = 0
|
||||||
for field in obj.data[0].keys():
|
for field in obj.data[0].keys():
|
||||||
self.result_treeview.append_column(gtk.TreeViewColumn(field,
|
self.result_treeview.append_column(Gtk.TreeViewColumn(field,
|
||||||
gtk.CellRendererText(), text=counter))
|
Gtk.CellRendererText(), text=counter))
|
||||||
if field == 'jid':
|
if field == 'jid':
|
||||||
self.jid_column = counter
|
self.jid_column = counter
|
||||||
counter += 1
|
counter += 1
|
||||||
self.result_treeview.set_model(model)
|
self.result_treeview.set_model(model)
|
||||||
sw.show_all()
|
sw.show_all()
|
||||||
self.search_vbox.pack_start(sw)
|
self.search_vbox.pack_start(sw, True, True, 0)
|
||||||
if self.jid_column > -1:
|
if self.jid_column > -1:
|
||||||
self.add_contact_button.show()
|
self.add_contact_button.show()
|
||||||
self.information_button.show()
|
self.information_button.show()
|
||||||
|
@ -223,7 +223,7 @@ class SearchWindow:
|
||||||
|
|
||||||
self.result_treeview = self.data_form_widget.records_treeview
|
self.result_treeview = self.data_form_widget.records_treeview
|
||||||
selection = self.result_treeview.get_selection()
|
selection = self.result_treeview.get_selection()
|
||||||
selection.set_mode(gtk.SELECTION_SINGLE)
|
selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||||
self.result_treeview.connect('cursor-changed',
|
self.result_treeview.connect('cursor-changed',
|
||||||
self.on_result_treeview_cursor_changed)
|
self.on_result_treeview_cursor_changed)
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ class SearchWindow:
|
||||||
self.jid_column = counter
|
self.jid_column = counter
|
||||||
break
|
break
|
||||||
counter += 1
|
counter += 1
|
||||||
self.search_vbox.pack_start(self.data_form_widget)
|
self.search_vbox.pack_start(self.data_form_widget, True, True, 0)
|
||||||
self.data_form_widget.show()
|
self.data_form_widget.show()
|
||||||
if self.jid_column > -1:
|
if self.jid_column > -1:
|
||||||
self.add_contact_button.show()
|
self.add_contact_button.show()
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import dialogs
|
import dialogs
|
||||||
|
@ -86,7 +86,7 @@ class StatusIcon:
|
||||||
|
|
||||||
def show_icon(self):
|
def show_icon(self):
|
||||||
if not self.status_icon:
|
if not self.status_icon:
|
||||||
self.status_icon = gtk.StatusIcon()
|
self.status_icon = Gtk.StatusIcon()
|
||||||
self.statusicon_size = '16'
|
self.statusicon_size = '16'
|
||||||
self.status_icon.set_property('has-tooltip', True)
|
self.status_icon.set_property('has-tooltip', True)
|
||||||
self.status_icon.connect('activate', self.on_status_icon_left_clicked)
|
self.status_icon.connect('activate', self.on_status_icon_left_clicked)
|
||||||
|
@ -135,11 +135,11 @@ class StatusIcon:
|
||||||
Apart from image, we also update tooltip text here
|
Apart from image, we also update tooltip text here
|
||||||
"""
|
"""
|
||||||
def really_set_img():
|
def really_set_img():
|
||||||
if image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
if image.get_storage_type() == Gtk.ImageType.PIXBUF:
|
||||||
self.status_icon.set_from_pixbuf(image.get_pixbuf())
|
self.status_icon.set_from_pixbuf(image.get_pixbuf())
|
||||||
# FIXME: oops they forgot to support GIF animation?
|
# FIXME: oops they forgot to support GIF animation?
|
||||||
# or they were lazy to get it to work under Windows! WTF!
|
# or they were lazy to get it to work under Windows! WTF!
|
||||||
elif image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
elif image.get_storage_type() == Gtk.ImageType.ANIMATION:
|
||||||
self.status_icon.set_from_pixbuf(
|
self.status_icon.set_from_pixbuf(
|
||||||
image.get_animation().get_static_image())
|
image.get_animation().get_static_image())
|
||||||
# self.status_icon.set_from_animation(image.get_animation())
|
# self.status_icon.set_from_animation(image.get_animation())
|
||||||
|
@ -150,16 +150,16 @@ class StatusIcon:
|
||||||
self.status_icon.set_visible(True)
|
self.status_icon.set_visible(True)
|
||||||
if gajim.events.get_nb_systray_events():
|
if gajim.events.get_nb_systray_events():
|
||||||
self.status_icon.set_visible(True)
|
self.status_icon.set_visible(True)
|
||||||
if gajim.config.get('trayicon_blink'):
|
# if gajim.config.get('trayicon_blink'):
|
||||||
self.status_icon.set_blinking(True)
|
# self.status_icon.set_blinking(True)
|
||||||
else:
|
# else:
|
||||||
image = gtkgui_helpers.load_icon('event')
|
image = gtkgui_helpers.load_icon('event')
|
||||||
really_set_img()
|
really_set_img()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if gajim.config.get('trayicon') == 'on_event':
|
if gajim.config.get('trayicon') == 'on_event':
|
||||||
self.status_icon.set_visible(False)
|
self.status_icon.set_visible(False)
|
||||||
self.status_icon.set_blinking(False)
|
# self.status_icon.set_blinking(False)
|
||||||
|
|
||||||
image = gajim.interface.jabber_state_images[self.statusicon_size][
|
image = gajim.interface.jabber_state_images[self.statusicon_size][
|
||||||
self.status]
|
self.status]
|
||||||
|
@ -213,11 +213,11 @@ class StatusIcon:
|
||||||
chat_with_menuitem.disconnect(self.new_chat_handler_id)
|
chat_with_menuitem.disconnect(self.new_chat_handler_id)
|
||||||
self.new_chat_handler_id = None
|
self.new_chat_handler_id = None
|
||||||
|
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = Gtk.Menu()
|
||||||
self.popup_menus.append(sub_menu)
|
self.popup_menus.append(sub_menu)
|
||||||
status_menuitem.set_submenu(sub_menu)
|
status_menuitem.set_submenu(sub_menu)
|
||||||
|
|
||||||
gc_sub_menu = gtk.Menu() # gc is always a submenu
|
gc_sub_menu = Gtk.Menu() # gc is always a submenu
|
||||||
join_gc_menuitem.set_submenu(gc_sub_menu)
|
join_gc_menuitem.set_submenu(gc_sub_menu)
|
||||||
|
|
||||||
# We need our own set of status icons, let's make 'em!
|
# We need our own set of status icons, let's make 'em!
|
||||||
|
@ -230,15 +230,15 @@ class StatusIcon:
|
||||||
|
|
||||||
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
||||||
uf_show = helpers.get_uf_show(show, use_mnemonic = True)
|
uf_show = helpers.get_uf_show(show, use_mnemonic = True)
|
||||||
item = gtk.ImageMenuItem(uf_show)
|
item = Gtk.ImageMenuItem(uf_show)
|
||||||
item.set_image(state_images[show])
|
item.set_image(state_images[show])
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.on_show_menuitem_activate, show)
|
item.connect('activate', self.on_show_menuitem_activate, show)
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(_('_Change Status Message...'))
|
item = Gtk.ImageMenuItem(_('_Change Status Message...'))
|
||||||
gtkgui_helpers.add_image_to_menuitem(item, 'gajim-kbd_input')
|
gtkgui_helpers.add_image_to_menuitem(item, 'gajim-kbd_input')
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.on_change_status_message_activate)
|
item.connect('activate', self.on_change_status_message_activate)
|
||||||
|
@ -249,11 +249,11 @@ class StatusIcon:
|
||||||
|
|
||||||
connected_accounts_with_private_storage = 0
|
connected_accounts_with_private_storage = 0
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem()
|
item = Gtk.SeparatorMenuItem()
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
||||||
uf_show = helpers.get_uf_show('offline', use_mnemonic = True)
|
uf_show = helpers.get_uf_show('offline', use_mnemonic = True)
|
||||||
item = gtk.ImageMenuItem(uf_show)
|
item = Gtk.ImageMenuItem(uf_show)
|
||||||
item.set_image(state_images['offline'])
|
item.set_image(state_images['offline'])
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.on_show_menuitem_activate, 'offline')
|
item.connect('activate', self.on_show_menuitem_activate, 'offline')
|
||||||
|
@ -267,14 +267,14 @@ class StatusIcon:
|
||||||
accounts_list = sorted(gajim.contacts.get_accounts())
|
accounts_list = sorted(gajim.contacts.get_accounts())
|
||||||
# items that get shown whether an account is zeroconf or not
|
# items that get shown whether an account is zeroconf or not
|
||||||
if connected_accounts > 1: # 2 or more connections? make submenus
|
if connected_accounts > 1: # 2 or more connections? make submenus
|
||||||
account_menu_for_chat_with = gtk.Menu()
|
account_menu_for_chat_with = Gtk.Menu()
|
||||||
chat_with_menuitem.set_submenu(account_menu_for_chat_with)
|
chat_with_menuitem.set_submenu(account_menu_for_chat_with)
|
||||||
self.popup_menus.append(account_menu_for_chat_with)
|
self.popup_menus.append(account_menu_for_chat_with)
|
||||||
|
|
||||||
for account in accounts_list:
|
for account in accounts_list:
|
||||||
if gajim.account_is_connected(account):
|
if gajim.account_is_connected(account):
|
||||||
# for chat_with
|
# for chat_with
|
||||||
item = gtk.MenuItem(_('using account %s') % account)
|
item = Gtk.MenuItem(_('using account %s') % account)
|
||||||
account_menu_for_chat_with.append(item)
|
account_menu_for_chat_with.append(item)
|
||||||
item.connect('activate', self.on_new_chat, account)
|
item.connect('activate', self.on_new_chat, account)
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class StatusIcon:
|
||||||
connected_accounts_with_private_storage += 1
|
connected_accounts_with_private_storage += 1
|
||||||
|
|
||||||
# for single message
|
# for single message
|
||||||
single_message_menuitem.remove_submenu()
|
single_message_menuitemset_submenu(None)
|
||||||
self.single_message_handler_id = single_message_menuitem.\
|
self.single_message_handler_id = single_message_menuitem.\
|
||||||
connect('activate',
|
connect('activate',
|
||||||
self.on_single_message_menuitem_activate, account)
|
self.on_single_message_menuitem_activate, account)
|
||||||
|
@ -309,7 +309,7 @@ class StatusIcon:
|
||||||
break # No other account connected
|
break # No other account connected
|
||||||
else:
|
else:
|
||||||
# 2 or more 'real' accounts are connected, make submenus
|
# 2 or more 'real' accounts are connected, make submenus
|
||||||
account_menu_for_single_message = gtk.Menu()
|
account_menu_for_single_message = Gtk.Menu()
|
||||||
single_message_menuitem.set_submenu(
|
single_message_menuitem.set_submenu(
|
||||||
account_menu_for_single_message)
|
account_menu_for_single_message)
|
||||||
self.popup_menus.append(account_menu_for_single_message)
|
self.popup_menus.append(account_menu_for_single_message)
|
||||||
|
@ -321,24 +321,25 @@ class StatusIcon:
|
||||||
if gajim.connections[account].private_storage_supported:
|
if gajim.connections[account].private_storage_supported:
|
||||||
connected_accounts_with_private_storage += 1
|
connected_accounts_with_private_storage += 1
|
||||||
# for single message
|
# for single message
|
||||||
item = gtk.MenuItem(_('using account %s') % account)
|
item = Gtk.MenuItem(_('using account %s') % account)
|
||||||
item.connect('activate',
|
item.connect('activate',
|
||||||
self.on_single_message_menuitem_activate, account)
|
self.on_single_message_menuitem_activate, account)
|
||||||
account_menu_for_single_message.append(item)
|
account_menu_for_single_message.append(item)
|
||||||
|
|
||||||
# join gc
|
# join gc
|
||||||
gc_item = gtk.MenuItem(_('using account %s') % account, False)
|
gc_item = Gtk.MenuItem(_('using account %s') % account,
|
||||||
|
use_underline=False)
|
||||||
gc_sub_menu.append(gc_item)
|
gc_sub_menu.append(gc_item)
|
||||||
gc_menuitem_menu = gtk.Menu()
|
gc_menuitem_menu = Gtk.Menu()
|
||||||
gajim.interface.roster.add_bookmarks_list(gc_menuitem_menu,
|
gajim.interface.roster.add_bookmarks_list(gc_menuitem_menu,
|
||||||
account)
|
account)
|
||||||
gc_item.set_submenu(gc_menuitem_menu)
|
gc_item.set_submenu(gc_menuitem_menu)
|
||||||
gc_sub_menu.show_all()
|
gc_sub_menu.show_all()
|
||||||
|
|
||||||
newitem = gtk.SeparatorMenuItem() # separator
|
newitem = Gtk.SeparatorMenuItem() # separator
|
||||||
gc_sub_menu.append(newitem)
|
gc_sub_menu.append(newitem)
|
||||||
newitem = gtk.ImageMenuItem(_('_Manage Bookmarks...'))
|
newitem = Gtk.ImageMenuItem(_('_Manage Bookmarks...'))
|
||||||
img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU)
|
img = Gtk.Image.new_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU)
|
||||||
newitem.set_image(img)
|
newitem.set_image(img)
|
||||||
newitem.connect('activate',
|
newitem.connect('activate',
|
||||||
gajim.interface.roster.on_manage_bookmarks_menuitem_activate)
|
gajim.interface.roster.on_manage_bookmarks_menuitem_activate)
|
||||||
|
@ -362,8 +363,8 @@ class StatusIcon:
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
if self.added_hide_menuitem is False:
|
if self.added_hide_menuitem is False:
|
||||||
self.systray_context_menu.prepend(gtk.SeparatorMenuItem())
|
self.systray_context_menu.prepend(Gtk.SeparatorMenuItem())
|
||||||
item = gtk.MenuItem(_('Hide this menu'))
|
item = Gtk.MenuItem(_('Hide this menu'))
|
||||||
self.systray_context_menu.prepend(item)
|
self.systray_context_menu.prepend(item)
|
||||||
self.added_hide_menuitem = True
|
self.added_hide_menuitem = True
|
||||||
|
|
||||||
|
@ -423,7 +424,7 @@ class StatusIcon:
|
||||||
gajim.config.get('roster_y-position'))
|
gajim.config.get('roster_y-position'))
|
||||||
if not gajim.config.get('roster_window_skip_taskbar'):
|
if not gajim.config.get('roster_window_skip_taskbar'):
|
||||||
win.set_property('skip-taskbar-hint', False)
|
win.set_property('skip-taskbar-hint', False)
|
||||||
win.present_with_time(gtk.get_current_event_time())
|
win.present_with_time(Gtk.get_current_event_time())
|
||||||
else:
|
else:
|
||||||
self.handle_first_event()
|
self.handle_first_event()
|
||||||
|
|
||||||
|
@ -452,7 +453,7 @@ class StatusIcon:
|
||||||
|
|
||||||
def on_clicked(self, widget, event):
|
def on_clicked(self, widget, event):
|
||||||
self.on_tray_leave_notify_event(widget, None)
|
self.on_tray_leave_notify_event(widget, None)
|
||||||
if event.type_ != gtk.gdk.BUTTON_PRESS:
|
if event.type_ != Gdk.EventType.BUTTON_PRESS:
|
||||||
return
|
return
|
||||||
if event.button == 1: # Left click
|
if event.button == 1: # Left click
|
||||||
self.on_left_click()
|
self.on_left_click()
|
||||||
|
|
129
src/tooltips.py
129
src/tooltips.py
|
@ -28,8 +28,9 @@
|
||||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import GObject
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
|
@ -78,20 +79,20 @@ class BaseTooltip:
|
||||||
implementation: show data as value of a label
|
implementation: show data as value of a label
|
||||||
"""
|
"""
|
||||||
self.create_window()
|
self.create_window()
|
||||||
self.win.add(gtk.Label(data))
|
self.win.add(Gtk.Label(label=data))
|
||||||
|
|
||||||
def create_window(self):
|
def create_window(self):
|
||||||
"""
|
"""
|
||||||
Create a popup window each time tooltip is requested
|
Create a popup window each time tooltip is requested
|
||||||
"""
|
"""
|
||||||
self.win = gtk.Window(gtk.WINDOW_POPUP)
|
self.win = Gtk.Window(Gtk.WindowType.POPUP)
|
||||||
self.win.set_title('tooltip')
|
self.win.set_title('tooltip')
|
||||||
self.win.set_border_width(3)
|
self.win.set_border_width(3)
|
||||||
self.win.set_resizable(False)
|
self.win.set_resizable(False)
|
||||||
self.win.set_name('gtk-tooltips')
|
self.win.set_name('gtk-tooltips')
|
||||||
self.win.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
|
self.win.set_type_hint(Gdk.WindowTypeHint.TOOLTIP)
|
||||||
|
|
||||||
self.win.set_events(gtk.gdk.POINTER_MOTION_MASK)
|
self.win.set_events(Gdk.EventMask.POINTER_MOTION_MASK)
|
||||||
self.win.connect_after('expose_event', self.expose)
|
self.win.connect_after('expose_event', self.expose)
|
||||||
self.win.connect('size-request', self.on_size_request)
|
self.win.connect('size-request', self.on_size_request)
|
||||||
self.win.connect('motion-notify-event', self.motion_notify_event)
|
self.win.connect('motion-notify-event', self.motion_notify_event)
|
||||||
|
@ -135,7 +136,7 @@ class BaseTooltip:
|
||||||
def expose(self, widget, event):
|
def expose(self, widget, event):
|
||||||
style = self.win.get_style()
|
style = self.win.get_style()
|
||||||
size = self.win.get_size()
|
size = self.win.get_size()
|
||||||
style.paint_shadow(self.win.window, gtk.STATE_NORMAL, gtk.SHADOW_OUT,
|
style.paint_shadow(self.win.window, Gtk.StateType.NORMAL, Gtk.ShadowType.OUT,
|
||||||
None, self.win, 'tooltip', 0, 0, size[0], size[1])
|
None, self.win, 'tooltip', 0, 0, size[0], size[1])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ class BaseTooltip:
|
||||||
|
|
||||||
def hide_tooltip(self):
|
def hide_tooltip(self):
|
||||||
if self.timeout > 0:
|
if self.timeout > 0:
|
||||||
gobject.source_remove(self.timeout)
|
GObject.source_remove(self.timeout)
|
||||||
self.timeout = 0
|
self.timeout = 0
|
||||||
if self.win:
|
if self.win:
|
||||||
self.win.destroy()
|
self.win.destroy()
|
||||||
|
@ -231,12 +232,12 @@ class StatusTable:
|
||||||
self.spacer_label = ' '
|
self.spacer_label = ' '
|
||||||
|
|
||||||
def create_table(self):
|
def create_table(self):
|
||||||
self.table = gtk.Table(4, 1)
|
self.table = Gtk.Table(4, 1)
|
||||||
self.table.set_property('column-spacing', 2)
|
self.table.set_property('column-spacing', 2)
|
||||||
|
|
||||||
def add_text_row(self, text, col_inc = 0):
|
def add_text_row(self, text, col_inc = 0):
|
||||||
self.current_row += 1
|
self.current_row += 1
|
||||||
self.text_label = gtk.Label()
|
self.text_label = Gtk.Label()
|
||||||
self.text_label.set_line_wrap(True)
|
self.text_label.set_line_wrap(True)
|
||||||
self.text_label.set_alignment(0, 0)
|
self.text_label.set_alignment(0, 0)
|
||||||
self.text_label.set_selectable(False)
|
self.text_label.set_selectable(False)
|
||||||
|
@ -254,8 +255,8 @@ class StatusTable:
|
||||||
status = unicode(status, encoding='utf-8')
|
status = unicode(status, encoding='utf-8')
|
||||||
# reduce to 100 chars, 1 line
|
# reduce to 100 chars, 1 line
|
||||||
status = helpers.reduce_chars_newlines(status, 100, 1)
|
status = helpers.reduce_chars_newlines(status, 100, 1)
|
||||||
str_status = gobject.markup_escape_text(str_status)
|
str_status = GObject.markup_escape_text(str_status)
|
||||||
status = gobject.markup_escape_text(status)
|
status = GObject.markup_escape_text(status)
|
||||||
str_status += ' - <i>' + status + '</i>'
|
str_status += ' - <i>' + status + '</i>'
|
||||||
return str_status
|
return str_status
|
||||||
|
|
||||||
|
@ -269,29 +270,29 @@ class StatusTable:
|
||||||
files = []
|
files = []
|
||||||
files.append(os.path.join(file_path, state_file + '.png'))
|
files.append(os.path.join(file_path, state_file + '.png'))
|
||||||
files.append(os.path.join(file_path, state_file + '.gif'))
|
files.append(os.path.join(file_path, state_file + '.gif'))
|
||||||
image = gtk.Image()
|
image = Gtk.Image()
|
||||||
image.set_from_pixbuf(None)
|
image.set_from_pixbuf(None)
|
||||||
for f in files:
|
for f in files:
|
||||||
if os.path.exists(f):
|
if os.path.exists(f):
|
||||||
image.set_from_file(f)
|
image.set_from_file(f)
|
||||||
break
|
break
|
||||||
spacer = gtk.Label(self.spacer_label)
|
spacer = Gtk.Label(label=self.spacer_label)
|
||||||
image.set_alignment(1, 0.5)
|
image.set_alignment(1, 0.5)
|
||||||
if indent:
|
if indent:
|
||||||
self.table.attach(spacer, 1, 2, self.current_row,
|
self.table.attach(spacer, 1, 2, self.current_row,
|
||||||
self.current_row + 1, 0, 0, 0, 0)
|
self.current_row + 1, 0, 0, 0, 0)
|
||||||
self.table.attach(image, 2, 3, self.current_row,
|
self.table.attach(image, 2, 3, self.current_row,
|
||||||
self.current_row + 1, gtk.FILL, gtk.FILL, 2, 0)
|
self.current_row + 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL, 2, 0)
|
||||||
status_label = gtk.Label()
|
status_label = Gtk.Label()
|
||||||
status_label.set_markup(str_status)
|
status_label.set_markup(str_status)
|
||||||
status_label.set_alignment(0, 0)
|
status_label.set_alignment(0, 0)
|
||||||
status_label.set_line_wrap(True)
|
status_label.set_line_wrap(True)
|
||||||
self.table.attach(status_label, 3, 4, self.current_row,
|
self.table.attach(status_label, 3, 4, self.current_row,
|
||||||
self.current_row + 1, gtk.FILL | gtk.EXPAND, 0, 0, 0)
|
self.current_row + 1, Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND, 0, 0, 0)
|
||||||
if show_lock:
|
if show_lock:
|
||||||
lock_image = gtk.Image()
|
lock_image = Gtk.Image()
|
||||||
lock_image.set_from_stock(gtk.STOCK_DIALOG_AUTHENTICATION,
|
lock_image.set_from_stock(Gtk.STOCK_DIALOG_AUTHENTICATION,
|
||||||
gtk.ICON_SIZE_MENU)
|
Gtk.IconSize.MENU)
|
||||||
self.table.attach(lock_image, 4, 5, self.current_row,
|
self.table.attach(lock_image, 4, 5, self.current_row,
|
||||||
self.current_row + 1, 0, 0, 0, 0)
|
self.current_row + 1, 0, 0, 0, 0)
|
||||||
|
|
||||||
|
@ -316,7 +317,7 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
|
||||||
if isinstance(message, str):
|
if isinstance(message, str):
|
||||||
message = unicode(message, encoding = 'utf-8')
|
message = unicode(message, encoding = 'utf-8')
|
||||||
message = helpers.reduce_chars_newlines(message, 100, 1)
|
message = helpers.reduce_chars_newlines(message, 100, 1)
|
||||||
message = gobject.markup_escape_text(message)
|
message = GObject.markup_escape_text(message)
|
||||||
if acct['name'] in gajim.con_types and \
|
if acct['name'] in gajim.con_types and \
|
||||||
gajim.con_types[acct['name']] in ('tls', 'ssl'):
|
gajim.con_types[acct['name']] in ('tls', 'ssl'):
|
||||||
show_lock = True
|
show_lock = True
|
||||||
|
@ -324,11 +325,11 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
|
||||||
show_lock = False
|
show_lock = False
|
||||||
if message:
|
if message:
|
||||||
self.add_status_row(file_path, acct['show'],
|
self.add_status_row(file_path, acct['show'],
|
||||||
gobject.markup_escape_text(acct['name']) + \
|
GObject.markup_escape_text(acct['name']) + \
|
||||||
' - ' + message, show_lock=show_lock, indent=False)
|
' - ' + message, show_lock=show_lock, indent=False)
|
||||||
else:
|
else:
|
||||||
self.add_status_row(file_path, acct['show'],
|
self.add_status_row(file_path, acct['show'],
|
||||||
gobject.markup_escape_text(acct['name'])
|
GObject.markup_escape_text(acct['name'])
|
||||||
, show_lock=show_lock, indent=False)
|
, show_lock=show_lock, indent=False)
|
||||||
for line in acct['event_lines']:
|
for line in acct['event_lines']:
|
||||||
self.add_text_row(' ' + line, 1)
|
self.add_text_row(' ' + line, 1)
|
||||||
|
@ -340,7 +341,7 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
|
||||||
accounts = helpers.get_notification_icon_tooltip_dict()
|
accounts = helpers.get_notification_icon_tooltip_dict()
|
||||||
self.table.resize(2, 1)
|
self.table.resize(2, 1)
|
||||||
self.fill_table_with_accounts(accounts)
|
self.fill_table_with_accounts(accounts)
|
||||||
self.hbox = gtk.HBox()
|
self.hbox = Gtk.HBox()
|
||||||
self.table.set_property('column-spacing', 1)
|
self.table.set_property('column-spacing', 1)
|
||||||
|
|
||||||
self.hbox.add(self.table)
|
self.hbox.add(self.table)
|
||||||
|
@ -353,11 +354,11 @@ class GCTooltip(BaseTooltip):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.account = None
|
self.account = None
|
||||||
self.text_label = gtk.Label()
|
self.text_label = Gtk.Label()
|
||||||
self.text_label.set_line_wrap(True)
|
self.text_label.set_line_wrap(True)
|
||||||
self.text_label.set_alignment(0, 0)
|
self.text_label.set_alignment(0, 0)
|
||||||
self.text_label.set_selectable(False)
|
self.text_label.set_selectable(False)
|
||||||
self.avatar_image = gtk.Image()
|
self.avatar_image = Gtk.Image()
|
||||||
|
|
||||||
BaseTooltip.__init__(self)
|
BaseTooltip.__init__(self)
|
||||||
|
|
||||||
|
@ -365,14 +366,14 @@ class GCTooltip(BaseTooltip):
|
||||||
if not contact:
|
if not contact:
|
||||||
return
|
return
|
||||||
self.create_window()
|
self.create_window()
|
||||||
vcard_table = gtk.Table(3, 1)
|
vcard_table = Gtk.Table(3, 1)
|
||||||
vcard_table.set_property('column-spacing', 2)
|
vcard_table.set_property('column-spacing', 2)
|
||||||
vcard_table.set_homogeneous(False)
|
vcard_table.set_homogeneous(False)
|
||||||
vcard_current_row = 1
|
vcard_current_row = 1
|
||||||
properties = []
|
properties = []
|
||||||
|
|
||||||
nick_markup = '<b>' + \
|
nick_markup = '<b>' + \
|
||||||
gobject.markup_escape_text(contact.get_shown_name()) \
|
GObject.markup_escape_text(contact.get_shown_name()) \
|
||||||
+ '</b>'
|
+ '</b>'
|
||||||
properties.append((nick_markup, None))
|
properties.append((nick_markup, None))
|
||||||
|
|
||||||
|
@ -382,7 +383,7 @@ class GCTooltip(BaseTooltip):
|
||||||
# escape markup entities
|
# escape markup entities
|
||||||
status = helpers.reduce_chars_newlines(status, 300, 5)
|
status = helpers.reduce_chars_newlines(status, 300, 5)
|
||||||
status = '<i>' +\
|
status = '<i>' +\
|
||||||
gobject.markup_escape_text(status) + '</i>'
|
GObject.markup_escape_text(status) + '</i>'
|
||||||
properties.append((status, None))
|
properties.append((status, None))
|
||||||
|
|
||||||
show = helpers.get_uf_show(contact.show)
|
show = helpers.get_uf_show(contact.show)
|
||||||
|
@ -394,7 +395,7 @@ class GCTooltip(BaseTooltip):
|
||||||
|
|
||||||
if hasattr(contact, 'resource') and contact.resource.strip():
|
if hasattr(contact, 'resource') and contact.resource.strip():
|
||||||
properties.append((_('Resource: '),
|
properties.append((_('Resource: '),
|
||||||
gobject.markup_escape_text(contact.resource)))
|
GObject.markup_escape_text(contact.resource)))
|
||||||
|
|
||||||
if contact.affiliation != 'none':
|
if contact.affiliation != 'none':
|
||||||
uf_affiliation = helpers.get_uf_affiliation(contact.affiliation)
|
uf_affiliation = helpers.get_uf_affiliation(contact.affiliation)
|
||||||
|
@ -419,31 +420,31 @@ class GCTooltip(BaseTooltip):
|
||||||
while properties:
|
while properties:
|
||||||
property_ = properties.pop(0)
|
property_ = properties.pop(0)
|
||||||
vcard_current_row += 1
|
vcard_current_row += 1
|
||||||
vertical_fill = gtk.FILL
|
vertical_fill = Gtk.AttachOptions.FILL
|
||||||
if not properties:
|
if not properties:
|
||||||
vertical_fill |= gtk.EXPAND
|
vertical_fill |= Gtk.AttachOptions.EXPAND
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
if property_[1]:
|
if property_[1]:
|
||||||
label.set_markup(property_[0])
|
label.set_markup(property_[0])
|
||||||
vcard_table.attach(label, 1, 2, vcard_current_row,
|
vcard_table.attach(label, 1, 2, vcard_current_row,
|
||||||
vcard_current_row + 1, gtk.FILL, vertical_fill, 0, 0)
|
vcard_current_row + 1, Gtk.AttachOptions.FILL, vertical_fill, 0, 0)
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
label.set_markup(property_[1])
|
label.set_markup(property_[1])
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
vcard_table.attach(label, 2, 3, vcard_current_row,
|
vcard_table.attach(label, 2, 3, vcard_current_row,
|
||||||
vcard_current_row + 1, gtk.EXPAND | gtk.FILL,
|
vcard_current_row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||||
vertical_fill, 0, 0)
|
vertical_fill, 0, 0)
|
||||||
else:
|
else:
|
||||||
label.set_markup(property_[0])
|
label.set_markup(property_[0])
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
vcard_table.attach(label, 1, 3, vcard_current_row,
|
vcard_table.attach(label, 1, 3, vcard_current_row,
|
||||||
vcard_current_row + 1, gtk.FILL, vertical_fill, 0)
|
vcard_current_row + 1, Gtk.AttachOptions.FILL, vertical_fill, 0)
|
||||||
|
|
||||||
self.avatar_image.set_alignment(0, 0)
|
self.avatar_image.set_alignment(0, 0)
|
||||||
vcard_table.attach(self.avatar_image, 3, 4, 2, vcard_current_row + 1,
|
vcard_table.attach(self.avatar_image, 3, 4, 2, vcard_current_row + 1,
|
||||||
gtk.FILL, gtk.FILL | gtk.EXPAND, 3, 3)
|
Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND, 3, 3)
|
||||||
gajim.plugin_manager.gui_extension_point('gc_tooltip_populate',
|
gajim.plugin_manager.gui_extension_point('gc_tooltip_populate',
|
||||||
self, contact, vcard_table)
|
self, contact, vcard_table)
|
||||||
self.win.add(vcard_table)
|
self.win.add(vcard_table)
|
||||||
|
@ -455,11 +456,11 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.account = None
|
self.account = None
|
||||||
self.image = gtk.Image()
|
self.image = Gtk.Image()
|
||||||
self.image.set_alignment(0, 0)
|
self.image.set_alignment(0, 0)
|
||||||
# padding is independent of the total length and better than alignment
|
# padding is independent of the total length and better than alignment
|
||||||
self.image.set_padding(1, 2)
|
self.image.set_padding(1, 2)
|
||||||
self.avatar_image = gtk.Image()
|
self.avatar_image = Gtk.Image()
|
||||||
NotificationAreaTooltip.__init__(self)
|
NotificationAreaTooltip.__init__(self)
|
||||||
|
|
||||||
def populate(self, contacts):
|
def populate(self, contacts):
|
||||||
|
@ -491,19 +492,19 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
table_size = 4
|
table_size = 4
|
||||||
else:
|
else:
|
||||||
self.avatar_image.set_from_pixbuf(None)
|
self.avatar_image.set_from_pixbuf(None)
|
||||||
vcard_table = gtk.Table(1,table_size)
|
vcard_table = Gtk.Table(1,table_size)
|
||||||
vcard_table.set_property('column-spacing', 2)
|
vcard_table.set_property('column-spacing', 2)
|
||||||
vcard_table.set_homogeneous(False)
|
vcard_table.set_homogeneous(False)
|
||||||
vcard_current_row = 1
|
vcard_current_row = 1
|
||||||
properties = []
|
properties = []
|
||||||
|
|
||||||
name_markup = u'<span weight="bold">' + \
|
name_markup = u'<span weight="bold">' + \
|
||||||
gobject.markup_escape_text(prim_contact.get_shown_name())\
|
GObject.markup_escape_text(prim_contact.get_shown_name())\
|
||||||
+ '</span>'
|
+ '</span>'
|
||||||
if gajim.config.get('mergeaccounts'):
|
if gajim.config.get('mergeaccounts'):
|
||||||
name_markup += u" <span foreground='%s'>(%s)</span>" % (
|
name_markup += u" <span foreground='%s'>(%s)</span>" % (
|
||||||
gajim.config.get('tooltip_account_name_color'),
|
gajim.config.get('tooltip_account_name_color'),
|
||||||
gobject.markup_escape_text(prim_contact.account.name))
|
GObject.markup_escape_text(prim_contact.account.name))
|
||||||
|
|
||||||
if self.account and helpers.jid_is_blocked(self.account,
|
if self.account and helpers.jid_is_blocked(self.account,
|
||||||
prim_contact.jid):
|
prim_contact.jid):
|
||||||
|
@ -604,7 +605,7 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
# status is wrapped
|
# status is wrapped
|
||||||
status = helpers.reduce_chars_newlines(status, 300, 5)
|
status = helpers.reduce_chars_newlines(status, 300, 5)
|
||||||
# escape markup entities.
|
# escape markup entities.
|
||||||
status = gobject.markup_escape_text(status)
|
status = GObject.markup_escape_text(status)
|
||||||
properties.append(('<i>%s</i>' % status, None))
|
properties.append(('<i>%s</i>' % status, None))
|
||||||
properties.append((show, None))
|
properties.append((show, None))
|
||||||
|
|
||||||
|
@ -615,14 +616,14 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
# contact has only one ressource
|
# contact has only one ressource
|
||||||
if num_resources == 1 and contact.resource:
|
if num_resources == 1 and contact.resource:
|
||||||
properties.append((_('Resource: '),
|
properties.append((_('Resource: '),
|
||||||
gobject.markup_escape_text(contact.resource) +\
|
GObject.markup_escape_text(contact.resource) +\
|
||||||
' (' + unicode(contact.priority) + ')'))
|
' (' + unicode(contact.priority) + ')'))
|
||||||
|
|
||||||
if self.account and prim_contact.sub and prim_contact.sub != 'both' and\
|
if self.account and prim_contact.sub and prim_contact.sub != 'both' and\
|
||||||
prim_contact.jid not in gajim.gc_connected[self.account]:
|
prim_contact.jid not in gajim.gc_connected[self.account]:
|
||||||
# ('both' is the normal sub so we don't show it)
|
# ('both' is the normal sub so we don't show it)
|
||||||
properties.append(( _('Subscription: '),
|
properties.append(( _('Subscription: '),
|
||||||
gobject.markup_escape_text(helpers.get_uf_sub(prim_contact.sub))))
|
GObject.markup_escape_text(helpers.get_uf_sub(prim_contact.sub))))
|
||||||
|
|
||||||
if prim_contact.keyID:
|
if prim_contact.keyID:
|
||||||
keyID = None
|
keyID = None
|
||||||
|
@ -632,7 +633,7 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
keyID = prim_contact.keyID[8:]
|
keyID = prim_contact.keyID[8:]
|
||||||
if keyID:
|
if keyID:
|
||||||
properties.append((_('OpenPGP: '),
|
properties.append((_('OpenPGP: '),
|
||||||
gobject.markup_escape_text(keyID)))
|
GObject.markup_escape_text(keyID)))
|
||||||
|
|
||||||
if contact.last_activity_time:
|
if contact.last_activity_time:
|
||||||
last_active = datetime(*contact.last_activity_time[:6])
|
last_active = datetime(*contact.last_activity_time[:6])
|
||||||
|
@ -660,21 +661,21 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
while properties:
|
while properties:
|
||||||
property_ = properties.pop(0)
|
property_ = properties.pop(0)
|
||||||
vcard_current_row += 1
|
vcard_current_row += 1
|
||||||
vertical_fill = gtk.FILL
|
vertical_fill = Gtk.AttachOptions.FILL
|
||||||
if not properties and table_size == 4:
|
if not properties and table_size == 4:
|
||||||
vertical_fill |= gtk.EXPAND
|
vertical_fill |= Gtk.AttachOptions.EXPAND
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
if property_[1]:
|
if property_[1]:
|
||||||
label.set_markup(property_[0])
|
label.set_markup(property_[0])
|
||||||
vcard_table.attach(label, 1, 2, vcard_current_row,
|
vcard_table.attach(label, 1, 2, vcard_current_row,
|
||||||
vcard_current_row + 1, gtk.FILL, vertical_fill, 0, 0)
|
vcard_current_row + 1, Gtk.AttachOptions.FILL, vertical_fill, 0, 0)
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
label.set_markup(property_[1])
|
label.set_markup(property_[1])
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
vcard_table.attach(label, 2, 3, vcard_current_row,
|
vcard_table.attach(label, 2, 3, vcard_current_row,
|
||||||
vcard_current_row + 1, gtk.EXPAND | gtk.FILL,
|
vcard_current_row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||||
vertical_fill, 0, 0)
|
vertical_fill, 0, 0)
|
||||||
else:
|
else:
|
||||||
if isinstance(property_[0], (unicode, str)): # FIXME: rm unicode?
|
if isinstance(property_[0], (unicode, str)): # FIXME: rm unicode?
|
||||||
|
@ -683,11 +684,11 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
else:
|
else:
|
||||||
label = property_[0]
|
label = property_[0]
|
||||||
vcard_table.attach(label, 1, 3, vcard_current_row,
|
vcard_table.attach(label, 1, 3, vcard_current_row,
|
||||||
vcard_current_row + 1, gtk.FILL, vertical_fill, 0)
|
vcard_current_row + 1, Gtk.AttachOptions.FILL, vertical_fill, 0)
|
||||||
self.avatar_image.set_alignment(0, 0)
|
self.avatar_image.set_alignment(0, 0)
|
||||||
if table_size == 4:
|
if table_size == 4:
|
||||||
vcard_table.attach(self.avatar_image, 3, 4, 2,
|
vcard_table.attach(self.avatar_image, 3, 4, 2,
|
||||||
vcard_current_row + 1, gtk.FILL, gtk.FILL | gtk.EXPAND, 3, 3)
|
vcard_current_row + 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND, 3, 3)
|
||||||
|
|
||||||
gajim.plugin_manager.gui_extension_point('roster_tooltip_populate',
|
gajim.plugin_manager.gui_extension_point('roster_tooltip_populate',
|
||||||
self, contacts, vcard_table)
|
self, contacts, vcard_table)
|
||||||
|
@ -733,7 +734,7 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
BaseTooltip.__init__(self)
|
BaseTooltip.__init__(self)
|
||||||
|
|
||||||
def populate(self, file_props):
|
def populate(self, file_props):
|
||||||
ft_table = gtk.Table(2, 1)
|
ft_table = Gtk.Table(2, 1)
|
||||||
ft_table.set_property('column-spacing', 2)
|
ft_table.set_property('column-spacing', 2)
|
||||||
current_row = 1
|
current_row = 1
|
||||||
self.create_window()
|
self.create_window()
|
||||||
|
@ -744,7 +745,7 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
else:
|
else:
|
||||||
file_name = file_props.name
|
file_name = file_props.name
|
||||||
properties.append((_('Name: '),
|
properties.append((_('Name: '),
|
||||||
gobject.markup_escape_text(file_name)))
|
GObject.markup_escape_text(file_name)))
|
||||||
if file_props.type_ == 'r':
|
if file_props.type_ == 'r':
|
||||||
type_ = _('Download')
|
type_ = _('Download')
|
||||||
actor = _('Sender: ')
|
actor = _('Sender: ')
|
||||||
|
@ -760,7 +761,7 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
else:
|
else:
|
||||||
name = receiver.split('/')[0]
|
name = receiver.split('/')[0]
|
||||||
properties.append((_('Type: '), type_))
|
properties.append((_('Type: '), type_))
|
||||||
properties.append((actor, gobject.markup_escape_text(name)))
|
properties.append((actor, GObject.markup_escape_text(name)))
|
||||||
|
|
||||||
transfered_len = file_props.received_len
|
transfered_len = file_props.received_len
|
||||||
if not transfered_len:
|
if not transfered_len:
|
||||||
|
@ -788,22 +789,22 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
status = _('Not started')
|
status = _('Not started')
|
||||||
properties.append((_('Status: '), status))
|
properties.append((_('Status: '), status))
|
||||||
file_desc = file_props.desc
|
file_desc = file_props.desc
|
||||||
properties.append((_('Description: '), gobject.markup_escape_text(
|
properties.append((_('Description: '), GObject.markup_escape_text(
|
||||||
file_desc)))
|
file_desc)))
|
||||||
while properties:
|
while properties:
|
||||||
property_ = properties.pop(0)
|
property_ = properties.pop(0)
|
||||||
current_row += 1
|
current_row += 1
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
label.set_markup(property_[0])
|
label.set_markup(property_[0])
|
||||||
ft_table.attach(label, 1, 2, current_row, current_row + 1,
|
ft_table.attach(label, 1, 2, current_row, current_row + 1,
|
||||||
gtk.FILL, gtk.FILL, 0, 0)
|
Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL, 0, 0)
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
label.set_markup(property_[1])
|
label.set_markup(property_[1])
|
||||||
ft_table.attach(label, 2, 3, current_row, current_row + 1,
|
ft_table.attach(label, 2, 3, current_row, current_row + 1,
|
||||||
gtk.EXPAND | gtk.FILL, gtk.FILL, 0, 0)
|
Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL, 0, 0)
|
||||||
|
|
||||||
self.win.add(ft_table)
|
self.win.add(ft_table)
|
||||||
|
|
||||||
|
@ -814,7 +815,7 @@ class ServiceDiscoveryTooltip(BaseTooltip):
|
||||||
"""
|
"""
|
||||||
def populate(self, status):
|
def populate(self, status):
|
||||||
self.create_window()
|
self.create_window()
|
||||||
label = gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
label.set_selectable(False)
|
label.set_selectable(False)
|
||||||
|
|
44
src/vcard.py
44
src/vcard.py
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
# THIS FILE IS FOR **OTHERS'** PROFILE (when we VIEW their INFO)
|
# THIS FILE IS FOR **OTHERS'** PROFILE (when we VIEW their INFO)
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
import gobject
|
from gi.repository import GObject
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
|
@ -123,7 +123,7 @@ class VcardWindow:
|
||||||
self.vcard_arrived = False
|
self.vcard_arrived = False
|
||||||
self.os_info_arrived = False
|
self.os_info_arrived = False
|
||||||
self.entity_time_arrived = False
|
self.entity_time_arrived = False
|
||||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
self.update_progressbar_timeout_id = GObject.timeout_add(100,
|
||||||
self.update_progressbar)
|
self.update_progressbar)
|
||||||
|
|
||||||
gajim.ged.register_event_handler('version-result-received', ged.GUI1,
|
gajim.ged.register_event_handler('version-result-received', ged.GUI1,
|
||||||
|
@ -151,11 +151,11 @@ class VcardWindow:
|
||||||
|
|
||||||
def on_vcard_information_window_destroy(self, widget):
|
def on_vcard_information_window_destroy(self, widget):
|
||||||
if self.update_progressbar_timeout_id is not None:
|
if self.update_progressbar_timeout_id is not None:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
del gajim.interface.instances[self.account]['infos'][self.contact.jid]
|
del gajim.interface.instances[self.account]['infos'][self.contact.jid]
|
||||||
buffer_ = self.xml.get_object('textview_annotation').get_buffer()
|
buffer_ = self.xml.get_object('textview_annotation').get_buffer()
|
||||||
annotation = buffer_.get_text(buffer_.get_start_iter(),
|
annotation = buffer_.get_text(buffer_.get_start_iter(),
|
||||||
buffer_.get_end_iter())
|
buffer_.get_end_iter(), True)
|
||||||
connection = gajim.connections[self.account]
|
connection = gajim.connections[self.account]
|
||||||
if annotation != connection.annotations.get(self.contact.jid, ''):
|
if annotation != connection.annotations.get(self.contact.jid, ''):
|
||||||
connection.annotations[self.contact.jid] = annotation
|
connection.annotations[self.contact.jid] = annotation
|
||||||
|
@ -170,19 +170,19 @@ class VcardWindow:
|
||||||
self._nec_vcard_received)
|
self._nec_vcard_received)
|
||||||
|
|
||||||
def on_vcard_information_window_key_press_event(self, widget, event):
|
def on_vcard_information_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_information_notebook_switch_page(self, widget, page, page_num):
|
def on_information_notebook_switch_page(self, widget, page, page_num):
|
||||||
gobject.idle_add(self.xml.get_object('close_button').grab_focus)
|
GObject.idle_add(self.xml.get_object('close_button').grab_focus)
|
||||||
|
|
||||||
def on_PHOTO_eventbox_button_press_event(self, widget, event):
|
def on_PHOTO_eventbox_button_press_event(self, widget, event):
|
||||||
"""
|
"""
|
||||||
If right-clicked, show popup
|
If right-clicked, show popup
|
||||||
"""
|
"""
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
menu = gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
menuitem = gtk.ImageMenuItem(gtk.STOCK_SAVE_AS)
|
menuitem = Gtk.ImageMenuItem(Gtk.STOCK_SAVE_AS)
|
||||||
menuitem.connect('activate',
|
menuitem.connect('activate',
|
||||||
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
||||||
self.contact.jid, self.contact.get_shown_name())
|
self.contact.jid, self.contact.get_shown_name())
|
||||||
|
@ -195,7 +195,7 @@ class VcardWindow:
|
||||||
def set_value(self, entry_name, value):
|
def set_value(self, entry_name, value):
|
||||||
try:
|
try:
|
||||||
if value and entry_name == 'URL_label':
|
if value and entry_name == 'URL_label':
|
||||||
widget = gtk.LinkButton(value, value)
|
widget = Gtk.LinkButton(value, value)
|
||||||
widget.set_alignment(0, 0)
|
widget.set_alignment(0, 0)
|
||||||
widget.show()
|
widget.show()
|
||||||
table = self.xml.get_object('personal_info_table')
|
table = self.xml.get_object('personal_info_table')
|
||||||
|
@ -220,7 +220,7 @@ class VcardWindow:
|
||||||
self.xml.get_object('user_avatar_label').show()
|
self.xml.get_object('user_avatar_label').show()
|
||||||
if not pixbuf:
|
if not pixbuf:
|
||||||
image.set_from_icon_name('stock_person',
|
image.set_from_icon_name('stock_person',
|
||||||
gtk.ICON_SIZE_DIALOG)
|
Gtk.IconSize.DIALOG)
|
||||||
continue
|
continue
|
||||||
pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard')
|
pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard')
|
||||||
image.set_from_pixbuf(pixbuf)
|
image.set_from_pixbuf(pixbuf)
|
||||||
|
@ -259,7 +259,7 @@ class VcardWindow:
|
||||||
def test_remove_progressbar(self):
|
def test_remove_progressbar(self):
|
||||||
if self.update_progressbar_timeout_id is not None and \
|
if self.update_progressbar_timeout_id is not None and \
|
||||||
self.vcard_arrived and self.os_info_arrived and self.entity_time_arrived:
|
self.vcard_arrived and self.os_info_arrived and self.entity_time_arrived:
|
||||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
GObject.source_remove(self.update_progressbar_timeout_id)
|
||||||
self.progressbar.hide()
|
self.progressbar.hide()
|
||||||
self.update_progressbar_timeout_id = None
|
self.update_progressbar_timeout_id = None
|
||||||
|
|
||||||
|
@ -432,10 +432,10 @@ class VcardWindow:
|
||||||
else: # Request os info if contact is connected
|
else: # Request os info if contact is connected
|
||||||
if self.gc_contact:
|
if self.gc_contact:
|
||||||
j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
|
j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
|
||||||
gobject.idle_add(gajim.connections[self.account].request_os_info,
|
GObject.idle_add(gajim.connections[self.account].request_os_info,
|
||||||
j, r, self.contact.jid)
|
j, r, self.contact.jid)
|
||||||
else:
|
else:
|
||||||
gobject.idle_add(gajim.connections[self.account].request_os_info,
|
GObject.idle_add(gajim.connections[self.account].request_os_info,
|
||||||
self.contact.jid, self.contact.resource)
|
self.contact.jid, self.contact.resource)
|
||||||
|
|
||||||
# do not wait for entity_time if contact is not connected or has error
|
# do not wait for entity_time if contact is not connected or has error
|
||||||
|
@ -446,10 +446,10 @@ class VcardWindow:
|
||||||
else: # Request entity time if contact is connected
|
else: # Request entity time if contact is connected
|
||||||
if self.gc_contact:
|
if self.gc_contact:
|
||||||
j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
|
j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
|
||||||
gobject.idle_add(gajim.connections[self.account].\
|
GObject.idle_add(gajim.connections[self.account].\
|
||||||
request_entity_time, j, r, self.contact.jid)
|
request_entity_time, j, r, self.contact.jid)
|
||||||
else:
|
else:
|
||||||
gobject.idle_add(gajim.connections[self.account].\
|
GObject.idle_add(gajim.connections[self.account].\
|
||||||
request_entity_time, self.contact.jid, self.contact.resource)
|
request_entity_time, self.contact.jid, self.contact.resource)
|
||||||
|
|
||||||
self.os_info = {0: {'resource': self.real_resource, 'client': '',
|
self.os_info = {0: {'resource': self.real_resource, 'client': '',
|
||||||
|
@ -465,10 +465,10 @@ class VcardWindow:
|
||||||
uf_resources += '\n' + c.resource + \
|
uf_resources += '\n' + c.resource + \
|
||||||
_(' resource with priority ') + unicode(c.priority)
|
_(' resource with priority ') + unicode(c.priority)
|
||||||
if c.show not in ('offline', 'error'):
|
if c.show not in ('offline', 'error'):
|
||||||
gobject.idle_add(
|
GObject.idle_add(
|
||||||
gajim.connections[self.account].request_os_info, c.jid,
|
gajim.connections[self.account].request_os_info, c.jid,
|
||||||
c.resource)
|
c.resource)
|
||||||
gobject.idle_add(gajim.connections[self.account].\
|
GObject.idle_add(gajim.connections[self.account].\
|
||||||
request_entity_time, c.jid, c.resource)
|
request_entity_time, c.jid, c.resource)
|
||||||
self.os_info[i] = {'resource': c.resource, 'client': '',
|
self.os_info[i] = {'resource': c.resource, 'client': '',
|
||||||
'os': ''}
|
'os': ''}
|
||||||
|
@ -516,7 +516,7 @@ class ZeroconfVcardWindow:
|
||||||
del gajim.interface.instances[self.account]['infos'][self.contact.jid]
|
del gajim.interface.instances[self.account]['infos'][self.contact.jid]
|
||||||
|
|
||||||
def on_zeroconf_information_window_key_press_event(self, widget, event):
|
def on_zeroconf_information_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_PHOTO_eventbox_button_press_event(self, widget, event):
|
def on_PHOTO_eventbox_button_press_event(self, widget, event):
|
||||||
|
@ -524,8 +524,8 @@ class ZeroconfVcardWindow:
|
||||||
If right-clicked, show popup
|
If right-clicked, show popup
|
||||||
"""
|
"""
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
menu = gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
menuitem = gtk.ImageMenuItem(gtk.STOCK_SAVE_AS)
|
menuitem = Gtk.ImageMenuItem(Gtk.STOCK_SAVE_AS)
|
||||||
menuitem.connect('activate',
|
menuitem.connect('activate',
|
||||||
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
|
||||||
self.contact.jid, self.contact.get_shown_name())
|
self.contact.jid, self.contact.get_shown_name())
|
||||||
|
@ -538,7 +538,7 @@ class ZeroconfVcardWindow:
|
||||||
def set_value(self, entry_name, value):
|
def set_value(self, entry_name, value):
|
||||||
try:
|
try:
|
||||||
if value and entry_name == 'URL_label':
|
if value and entry_name == 'URL_label':
|
||||||
widget = gtk.LinkButton(value, value)
|
widget = Gtk.LinkButton(value, value)
|
||||||
widget.set_alignment(0, 0)
|
widget.set_alignment(0, 0)
|
||||||
table = self.xml.get_object('personal_info_table')
|
table = self.xml.get_object('personal_info_table')
|
||||||
table.attach(widget, 1, 4, 3, 4, yoptions = 0)
|
table.attach(widget, 1, 4, 3, 4, yoptions = 0)
|
||||||
|
|
Loading…
Reference in New Issue