From: <umg...@us...> - 2007-07-23 11:28:51
|
Revision: 490 http://svn.sourceforge.net/pybridge/?rev=490&view=rev Author: umgangee Date: 2007-07-23 04:28:54 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Add support for requesting and displaying user information. Modified Paths: -------------- trunk/pybridge/glade/pybridge.glade trunk/pybridge/pybridge/server/user.py trunk/pybridge/pybridge/ui/window_main.py Added Paths: ----------- trunk/pybridge/pybridge/ui/dialog_userinfo.py Modified: trunk/pybridge/glade/pybridge.glade =================================================================== --- trunk/pybridge/glade/pybridge.glade 2007-07-22 18:02:34 UTC (rev 489) +++ trunk/pybridge/glade/pybridge.glade 2007-07-23 11:28:54 UTC (rev 490) @@ -307,93 +307,6 @@ <property name="position">1</property> </packing> </child> - <child> - <widget class="GtkFrame" id="frame_tableinfo"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <child> - <widget class="GtkAlignment" id="alignment21"> - <property name="visible">True</property> - <property name="top_padding">4</property> - <property name="bottom_padding">4</property> - <property name="left_padding">4</property> - <property name="right_padding">4</property> - <child> - <widget class="GtkTable" id="table_tableinfo"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="column_spacing">8</property> - <property name="row_spacing">2</property> - <child> - <widget class="GtkLabel" id="label63"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">ID:</property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_tableid"> - <property name="visible">True</property> - <property name="xalign">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Type:</property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_tabletype"> - <property name="visible">True</property> - <property name="xalign">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkLabel" id="label57"> - <property name="visible">True</property> - <property name="label" translatable="yes">Table Information</property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="position">2</property> - </packing> - </child> </widget> <packing> <property name="expand">False</property> @@ -406,9 +319,9 @@ </packing> </child> <child> - <widget class="GtkLabel" id="tab_tables"> + <widget class="GtkLabel" id="label_tabletab"> <property name="visible">True</property> - <property name="label" translatable="yes">Available Tables</property> + <property name="label" translatable="yes">Tables</property> </widget> <packing> <property name="type">tab</property> @@ -431,75 +344,29 @@ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <child> - <widget class="GtkIconView" id="peopleview"> + <widget class="GtkIconView" id="userview"> <property name="visible">True</property> <property name="can_focus">True</property> - <signal name="item_activated" handler="on_peopleview_item_activated"/> - <signal name="selection_changed" handler="on_peopleview_selection_changed"/> + <signal name="item_activated" handler="on_userview_item_activated"/> + <signal name="selection_changed" handler="on_userview_selection_changed"/> </widget> </child> </widget> </child> <child> - <widget class="GtkVBox" id="vbox17"> - <property name="width_request">160</property> + <widget class="GtkVButtonBox" id="buttonbox_users"> <property name="visible">True</property> - <property name="spacing">4</property> + <property name="sensitive">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="layout_style">GTK_BUTTONBOX_START</property> <child> - <widget class="GtkFrame" id="frame_personinfo"> + <widget class="GtkButton" id="button_userinfo"> <property name="visible">True</property> - <property name="sensitive">False</property> - <child> - <widget class="GtkAlignment" id="alignment22"> - <property name="visible">True</property> - <property name="top_padding">4</property> - <property name="bottom_padding">4</property> - <property name="left_padding">4</property> - <property name="right_padding">4</property> - <child> - <widget class="GtkTable" id="table_personinfo"> - <property name="visible">True</property> - <property name="n_rows">1</property> - <property name="n_columns">2</property> - <property name="column_spacing">8</property> - <property name="row_spacing">2</property> - <child> - <widget class="GtkLabel" id="label67"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Name:</property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_personname"> - <property name="visible">True</property> - <property name="xalign">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkLabel" id="label58"> - <property name="visible">True</property> - <property name="label" translatable="yes">Person Information</property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">User Information</property> + <signal name="clicked" handler="on_userinfo_clicked"/> </widget> </child> </widget> @@ -515,9 +382,9 @@ </packing> </child> <child> - <widget class="GtkLabel" id="label_people"> + <widget class="GtkLabel" id="label_usertab"> <property name="visible">True</property> - <property name="label" translatable="yes">People Online</property> + <property name="label" translatable="yes">Users</property> </widget> <packing> <property name="type">tab</property> @@ -568,30 +435,23 @@ <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkLabel" id="label_portnum"> + <widget class="GtkEntry" id="entry_portnum"> + <property name="width_request">80</property> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Port:</property> + <property name="can_focus">True</property> + <property name="max_length">5</property> + <property name="invisible_char">*</property> + <signal name="changed" handler="on_field_changed"/> </widget> <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label_hostname"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Host Name:</property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> <widget class="GtkEntry" id="entry_hostname"> <property name="width_request">140</property> <property name="visible">True</property> @@ -606,19 +466,26 @@ </packing> </child> <child> - <widget class="GtkEntry" id="entry_portnum"> - <property name="width_request">80</property> + <widget class="GtkLabel" id="label_hostname"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="max_length">5</property> - <property name="invisible_char">*</property> - <signal name="changed" handler="on_field_changed"/> + <property name="xalign">0</property> + <property name="label" translatable="yes">Host Name:</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label_portnum"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Port:</property> + </widget> + <packing> <property name="top_attach">1</property> <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> @@ -661,26 +528,20 @@ <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkLabel" id="label_username"> + <widget class="GtkEntry" id="entry_password"> + <property name="width_request">120</property> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">User Name:</property> + <property name="can_focus">True</property> + <property name="max_length">40</property> + <property name="visibility">False</property> + <property name="invisible_char">*</property> + <signal name="changed" handler="on_field_changed"/> </widget> <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_password"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Password:</property> - </widget> - <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> @@ -700,23 +561,29 @@ </packing> </child> <child> - <widget class="GtkEntry" id="entry_password"> - <property name="width_request">120</property> + <widget class="GtkLabel" id="label_password"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="max_length">40</property> - <property name="visibility">False</property> - <property name="invisible_char">*</property> - <signal name="changed" handler="on_field_changed"/> + <property name="xalign">0</property> + <property name="label" translatable="yes">Password:</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> + <child> + <widget class="GtkLabel" id="label_username"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">User Name:</property> + </widget> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> </widget> </child> <child> @@ -818,6 +685,7 @@ <property name="title" translatable="yes">Create a New Table</property> <property name="resizable">False</property> <property name="modal">True</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="skip_taskbar_hint">True</property> <property name="gravity">GDK_GRAVITY_CENTER</property> @@ -840,53 +708,53 @@ <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkLabel" id="label_gamelist"> + <widget class="GtkLabel" id="label_tablename"> <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Game at Table:</property> + <property name="label" translatable="yes">Table Name:</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="gamelist"> + <widget class="GtkEntry" id="tablename"> + <property name="width_request">140</property> <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal name="changed" handler="on_gamelist_changed"/> + <property name="can_focus">True</property> + <property name="invisible_char">*</property> + <signal name="changed" handler="on_tablename_changed"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkEntry" id="tablename"> - <property name="width_request">140</property> + <widget class="GtkComboBox" id="gamelist"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">*</property> - <signal name="changed" handler="on_tablename_changed"/> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <signal name="changed" handler="on_gamelist_changed"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkLabel" id="label_tablename"> + <widget class="GtkLabel" id="label_gamelist"> <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Table Name:</property> + <property name="label" translatable="yes">Game at Table:</property> </widget> <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options"></property> </packing> </child> @@ -942,6 +810,7 @@ <property name="border_width">5</property> <property name="title" translatable="yes">PyBridge Preferences</property> <property name="resizable">False</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -966,72 +835,6 @@ <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkFileChooserButton" id="background"> - <property name="width_request">160</property> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal name="selection_changed" handler="on_background_changed"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <widget class="GtkComboBox" id="cardstyle"> - <property name="width_request">160</property> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal name="changed" handler="on_cardstyle_changed"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_background"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Background:</property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_cardstyle"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Card Style:</property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_suitcolours"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Suit Colours:</property> - </widget> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> <widget class="GtkHBox" id="hbox2"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> @@ -1128,6 +931,72 @@ <property name="bottom_attach">3</property> </packing> </child> + <child> + <widget class="GtkLabel" id="label_suitcolours"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Suit Colours:</property> + </widget> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label_cardstyle"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Card Style:</property> + </widget> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label_background"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Background:</property> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkComboBox" id="cardstyle"> + <property name="width_request">160</property> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <signal name="changed" handler="on_cardstyle_changed"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkFileChooserButton" id="background"> + <property name="width_request">160</property> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <signal name="selection_changed" handler="on_background_changed"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> </widget> <packing> <property name="expand">False</property> @@ -1211,4 +1080,95 @@ </widget> </child> </widget> + <widget class="GtkDialog" id="dialog_userinfo"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">User Information</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="has_separator">False</property> + <signal name="delete_event" handler="on_delete_event"/> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox6"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">2</property> + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="top_padding">4</property> + <property name="bottom_padding">4</property> + <property name="left_padding">4</property> + <property name="right_padding">4</property> + <child> + <widget class="GtkVBox" id="vbox3"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">8</property> + <child> + <widget class="GtkLabel" id="label_userinfo"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="xalign">0</property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="expand">False</property> + </packing> + </child> + <child> + <widget class="GtkScrolledWindow" id="scrolled_userinfo"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <child> + <widget class="GtkTextView" id="userinfo"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="editable">False</property> + </widget> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area6"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <child> + <widget class="GtkButton" id="closebutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-close</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_closebutton_clicked"/> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> + </widget> </glade-interface> Modified: trunk/pybridge/pybridge/server/user.py =================================================================== --- trunk/pybridge/pybridge/server/user.py 2007-07-22 18:02:34 UTC (rev 489) +++ trunk/pybridge/pybridge/server/user.py 2007-07-23 11:28:54 UTC (rev 490) @@ -75,7 +75,7 @@ def perspective_getUserInformation(self, username=None): """Returns public information for user with specified username. - If username is unspecified, returns user's own profile. + If username is unspecified, returns user's own public information. """ if username is None: username = self.name @@ -85,8 +85,13 @@ except IndexError: raise DeniedRequest, "Specified user does not exist" - return {'realname': user.realname, 'email': user.email, - 'profile': user.profile} + info = {} + for field in 'realname', 'email', 'country', 'profile': + value = getattr(user, field, None) + # Do not send unspecified (null) values. + if value is not None: + info[field] = value + return info # def perspective_setProfile(self, **kwargs): Added: trunk/pybridge/pybridge/ui/dialog_userinfo.py =================================================================== --- trunk/pybridge/pybridge/ui/dialog_userinfo.py (rev 0) +++ trunk/pybridge/pybridge/ui/dialog_userinfo.py 2007-07-23 11:28:54 UTC (rev 490) @@ -0,0 +1,79 @@ +# PyBridge -- online contract bridge made easy. +# Copyright (C) 2004-2007 PyBridge Project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +import gtk, pango + +from manager import wm +from wrapper import GladeWrapper + + +class DialogUserInfo(GladeWrapper): + + glade_name = 'dialog_userinfo' + + fields = [('realname', _('Real Name')), + ('email', _('Email Address')), + ('country', ('Country')), + ('profile', _('Profile'))] + + texttags = {'heading': {'weight': pango.WEIGHT_BOLD}, + 'value': {}, + 'value-unknown': {'foreground': 'gray'}, + } + + + def setUp(self): + self.userinfo.set_size_request(320, 160) + + # Populate information textview with text tags. + tagtable = self.userinfo.get_buffer().get_tag_table() + for tagname, tagattrs in self.texttags.items(): + tag = gtk.TextTag(tagname) + for attrname, attrvalue in tagattrs.items(): + tag.set_property(attrname, attrvalue) + tagtable.add(tag) + + + def setUserInfo(self, username, info): + self.label_userinfo.set_markup("<span size='large'><b>%s</b></span>" % + _('Information for %(user)s') % {'user': username}) + + # Populate information textview. + buffer = self.userinfo.get_buffer() + + # Display recognised fields in order. + for id, title in self.fields: + buffer.insert_with_tags_by_name(buffer.get_end_iter(), title, 'heading') + buffer.insert(buffer.get_end_iter(), ': ') + + value = info.get(id) + if value: + buffer.insert_with_tags_by_name(buffer.get_end_iter(), value, 'value') + else: + buffer.insert_with_tags_by_name(buffer.get_end_iter(), _('not specified'), 'value-unknown') + + buffer.insert(buffer.get_end_iter(), '\n') + + + def on_closebutton_clicked(self, widget, *args): + wm.close(self) + + + def on_delete_event(self, widget, *args): + self.on_closebutton_clicked(widget, *args) + Modified: trunk/pybridge/pybridge/ui/window_main.py =================================================================== --- trunk/pybridge/pybridge/ui/window_main.py 2007-07-22 18:02:34 UTC (rev 489) +++ trunk/pybridge/pybridge/ui/window_main.py 2007-07-23 11:28:54 UTC (rev 490) @@ -33,6 +33,7 @@ from dialog_connection import DialogConnection from dialog_newtable import DialogNewtable from dialog_preferences import DialogPreferences +from dialog_userinfo import DialogUserInfo # TODO: import all Window*Table classes automatically. from pybridge.games.bridge.ui.window_bridgetable import WindowBridgeTable @@ -46,7 +47,7 @@ glade_name = 'window_main' tableview_icon = gtk.gdk.pixbuf_new_from_file_at_size(TABLE_ICON, 48, 48) - peopleview_icon = gtk.gdk.pixbuf_new_from_file_at_size(USER_ICON, 48, 48) + userview_icon = gtk.gdk.pixbuf_new_from_file_at_size(USER_ICON, 48, 48) def setUp(self): @@ -56,17 +57,16 @@ # Set up table model and icon view. self.tableview.set_text_column(0) self.tableview.set_pixbuf_column(1) - self.tableview_model = gtk.ListStore(str, gtk.gdk.Pixbuf) - self.tableview_model.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.tableview.set_model(self.tableview_model) + model = gtk.ListStore(str, gtk.gdk.Pixbuf) + model.set_sort_column_id(0, gtk.SORT_ASCENDING) + self.tableview.set_model(model) - # Set up people model and icon view. - # TODO: allow users to provide their own "avatar" icons. - self.peopleview.set_text_column(0) - self.peopleview.set_pixbuf_column(1) - self.peopleview_model = gtk.ListStore(str, gtk.gdk.Pixbuf) - self.peopleview_model.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.peopleview.set_model(self.peopleview_model) + # Set up user model and icon view. + self.userview.set_text_column(0) + self.userview.set_pixbuf_column(1) + model = gtk.ListStore(str, gtk.gdk.Pixbuf) + model.set_sort_column_id(0, gtk.SORT_ASCENDING) + self.userview.set_model(model) # Attach event handler to listen for events. self.eventHandler = SimpleEventHandler(self) @@ -87,6 +87,7 @@ def quit(self): """Shut down gracefully.""" + client.detach(self.eventHandler) wm.close(self) reactor.stop() gtk.main_quit() @@ -94,6 +95,7 @@ def errback(self, failure): print "Error: %s" % failure.getErrorMessage() + print failure.getTraceback() # Event handlers. @@ -115,10 +117,11 @@ self.menu_connect.set_property('visible', True) self.menu_disconnect.set_property('visible', False) self.menu_newtable.set_property('sensitive', False) - self.newtable.set_property('sensitive', False) + #self.newtable.set_property('sensitive', False) - self.tableview_model.clear() - self.peopleview_model.clear() + print self.tableview.get_model() + self.tableview.get_model().clear() + self.userview.get_model().clear() def event_connectionLost(self, host, port): @@ -142,8 +145,8 @@ def event_gotRoster(self, name, roster): - lookup = {'tables' : (self.tableview_model, self.tableview_icon), - 'users' : (self.peopleview_model, self.peopleview_icon)} + lookup = {'tables' : (self.tableview.get_model(), self.tableview_icon), + 'users' : (self.userview.get_model(), self.userview_icon)} try: model, icon = lookup[name] @@ -167,7 +170,7 @@ """Adds a table to the table listing.""" # Only display table if it supported by client. if info['gamename'] in SUPPORTED_GAMES: - self.tableview_model.append([tableid, self.tableview_icon]) + self.tableview.get_model().append([tableid, self.tableview_icon]) def event_closeTable(self, tableid): @@ -177,13 +180,14 @@ if model.get_value(iter, 0) in user_data: model.remove(iter) return True - - self.tableview_model.foreach(func, tableid) + model = self.tableview.get_model() + model.foreach(func, tableid) + def event_userLogin(self, username, info): """Adds a user to the people listing.""" - self.peopleview_model.append([username, self.peopleview_icon]) + self.userview.get_model().append([username, self.userview_icon]) def event_userLogout(self, username): @@ -193,10 +197,11 @@ if model.get_value(iter, 0) in user_data: model.remove(iter) return True - - self.peopleview_model.foreach(func, username) + model = self.userview.get_model() + model.foreach(func, username) + # Signal handlers. @@ -205,8 +210,9 @@ def on_tableview_item_activated(self, iconview, path, *args): - iter = self.tableview_model.get_iter(path) - tableid = self.tableview_model.get_value(iter, 0) + model = self.tableview.get_model() + iter = model.get_iter(path) + tableid = model.get_value(iter, 0) if tableid not in client.tables: d = client.joinTable(tableid) d.addErrback(self.errback) @@ -216,32 +222,40 @@ def on_tableview_selection_changed(self, iconview, *args): cursor = self.tableview.get_cursor() if cursor: # Ensure cursor contains a path, not None. - iter = self.tableview_model.get_iter(cursor[0]) # Path. - tableid = self.tableview_model.get_value(iter, 0) + model = self.tableview.get_model() + iter = model.get_iter(cursor[0]) # Path. + tableid = model.get_value(iter, 0) # If client not joined to table, enable Join Table button. sensitive = tableid not in client.tables self.jointable.set_property('sensitive', sensitive) - # Display information about table. - self.frame_tableinfo.set_property('sensitive', True) - self.label_tableid.set_text(tableid) - self.label_tabletype.set_text(client.tableRoster[tableid]['gamename']) else: - self.frame_tableinfo.set_property('sensitive', False) - self.label_tableid.set_text('') - self.label_tabletype.set_text('') + self.jointable.set_property('sensitive', False) - def on_peopleview_selection_changed(self, iconview, *args): - cursor = self.peopleview.get_cursor() + def on_userview_item_activated(self, iconview, path, *args): + model = self.userview.get_model() + iter = model.get_iter(path) + username = model.get_value(iter, 0) + + # Allow one DialogUserInfo instance for each user. + winid = (DialogUserInfo, username) + + def gotUserInfo(info): + w = wm.open(DialogUserInfo, winid) + w.setUserInfo(username, info) + + if not wm.get(winid): + # TODO: if user info in cache, do not request again from server. + d = client.getUserInformation(username) + d.addCallback(gotUserInfo) + + + def on_userview_selection_changed(self, iconview, *args): + cursor = self.userview.get_cursor() if cursor: # Ensure cursor contains a path, not None. - iter = self.peopleview_model.get_iter(cursor[0]) # Path. - person = self.peopleview_model.get_value(iter, 0) - # Display information about person. - self.frame_personinfo.set_property('sensitive', True) - self.label_personname.set_text(person) + self.buttonbox_users.set_property('sensitive', True) else: - self.frame_personinfo.set_property('sensitive', False) - self.label_personname.set_text('') + self.buttonbox_users.set_property('sensitive', False) def on_window_main_delete_event(self, widget, *args): @@ -258,6 +272,11 @@ self.on_tableview_item_activated(self.tableview, path) + def on_userinfo_clicked(self, widget, *args): + path = self.userview.get_cursor()[0] + self.on_userview_item_activated(self.userview, path) + + def on_connect_activate(self, widget, *args): if not wm.get(DialogConnection): wm.open(DialogConnection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |