From: <jb...@us...> - 2010-02-15 10:40:44
|
Revision: 512 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=512&view=rev Author: jblance Date: 2010-02-15 10:40:37 +0000 (Mon, 15 Feb 2010) Log Message: ----------- Unified import - plugins tab now functional Modified Paths: -------------- pytrainer/trunk/glade/importdata.glade pytrainer/trunk/glade/pytrainer.glade pytrainer/trunk/pytrainer/gui/windowimportdata.py pytrainer/trunk/pytrainer/gui/windowplugins.py pytrainer/trunk/pytrainer/importdata.py pytrainer/trunk/pytrainer/main.py Added Paths: ----------- pytrainer/trunk/glade/plugins.glade Modified: pytrainer/trunk/glade/importdata.glade =================================================================== --- pytrainer/trunk/glade/importdata.glade 2010-02-15 08:26:32 UTC (rev 511) +++ pytrainer/trunk/glade/importdata.glade 2010-02-15 10:40:37 UTC (rev 512) @@ -381,11 +381,65 @@ </packing> </child> <child> - <widget class="GtkVBox" id="vboxPlugins"> + <widget class="GtkVBox" id="vboxPluginsTab"> <property name="visible">True</property> <property name="orientation">vertical</property> <child> - <placeholder/> + <widget class="GtkVBox" id="vboxPlugins"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + <child> + <widget class="GtkHBox" id="hboxPluginsButtons"> + <property name="visible">True</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <widget class="GtkButton" id="buttonPluginsClose"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_buttonPluginsClose_clicked"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">5</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkStatusbar" id="statusbarPlugins"> + <property name="visible">True</property> + <property name="spacing">2</property> + <property name="has_resize_grip">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + </widget> + <packing> + <property name="position">0</property> + </packing> </child> </widget> <packing> @@ -454,6 +508,27 @@ <property name="position">1</property> </packing> </child> + <child> + <widget class="GtkRadioButton" id="radiobuttonPlugins"> + <property name="label" translatable="yes">Plugins</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="yalign">0.4699999988079071</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">radiobuttonTabGPSDevice</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">10</property> + <property name="position">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> </widget> </child> </widget> Added: pytrainer/trunk/glade/plugins.glade =================================================================== --- pytrainer/trunk/glade/plugins.glade (rev 0) +++ pytrainer/trunk/glade/plugins.glade 2010-02-15 10:40:37 UTC (rev 512) @@ -0,0 +1,224 @@ +<?xml version="1.0"?> +<glade-interface> + <!-- interface-requires gtk+ 2.16 --> + <!-- interface-naming-policy toplevel-contextual --> + <widget class="GtkWindow" id="plugins"> + <property name="width_request">650</property> + <property name="height_request">230</property> + <property name="visible">True</property> + <property name="title" translatable="yes">Plugins</property> + <property name="icon">logo_mini.png</property> + <child> + <widget class="GtkHBox" id="hbox34"> + <property name="width_request">32</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="border_width">9</property> + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow5"> + <property name="width_request">230</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="shadow_type">in</property> + <child> + <widget class="GtkTreeView" id="pluginsTreeview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="rules_hint">True</property> + <signal name="button_release_event" handler="on_pluginsTree_clicked"/> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkVBox" id="vbox21"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <child> + <widget class="GtkTable" id="table12"> + <property name="visible">True</property> + <property name="border_width">5</property> + <property name="n_rows">4</property> + <property name="n_columns">2</property> + <property name="column_spacing">5</property> + <property name="row_spacing">5</property> + <child> + <widget class="GtkLabel" id="label-2147483647"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes"><b>Plugin Details</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <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="descriptionEntry"> + <property name="height_request">78</property> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="label" translatable="yes">description-entry </property> + <property name="use_underline">True</property> + <property name="wrap">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label11113"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="label" translatable="yes">Description:</property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="statusEntry"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">status-entry</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <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="label11114"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Status:</property> + <property name="use_markup">True</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="nameEntry"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">nameEntry</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="label11112"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Name:</property> + <property name="use_markup">True</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> + </widget> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkHBox" id="hbox35"> + <property name="visible">True</property> + <child> + <widget class="GtkLabel" id="label11118"> + <property name="visible">True</property> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label11119"> + <property name="visible">True</property> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="button32"> + <property name="label">gtk-preferences</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_preferences_clicked"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="button33"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_accept_clicked"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> +</glade-interface> Modified: pytrainer/trunk/glade/pytrainer.glade =================================================================== --- pytrainer/trunk/glade/pytrainer.glade 2010-02-15 08:26:32 UTC (rev 511) +++ pytrainer/trunk/glade/pytrainer.glade 2010-02-15 10:40:37 UTC (rev 512) @@ -9090,393 +9090,6 @@ </child> </widget> -<widget class="GtkWindow" id="plugins"> - <property name="width_request">650</property> - <property name="height_request">230</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Plugins</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="icon">logo_mini.png</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkHBox" id="hbox34"> - <property name="border_width">9</property> - <property name="width_request">32</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow5"> - <property name="width_request">230</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="pluginsTreeview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">True</property> - <property name="rules_hint">True</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - <property name="fixed_height_mode">False</property> - <property name="hover_selection">False</property> - <property name="hover_expand">False</property> - <signal name="button_release_event" handler="on_pluginsTree_clicked" last_modification_time="Tue, 27 Mar 2007 11:56:15 GMT"/> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox21"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkTable" id="table12"> - <property name="border_width">5</property> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">5</property> - <property name="column_spacing">5</property> - - <child> - <widget class="GtkLabel" id="label-2147483647"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Plugin Details</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="descriptionEntry"> - <property name="height_request">78</property> - <property name="visible">True</property> - <property name="label" translatable="yes">description-entry </property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11113"> - <property name="visible">True</property> - <property name="label" translatable="yes">Description:</property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="statusEntry"> - <property name="visible">True</property> - <property name="label" translatable="yes">status-entry</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11114"> - <property name="visible">True</property> - <property name="label" translatable="yes">Status:</property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="nameEntry"> - <property name="visible">True</property> - <property name="label" translatable="yes">nameEntry</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">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">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11112"> - <property name="visible">True</property> - <property name="label" translatable="yes">Name:</property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox35"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label11118"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11119"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button32"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-preferences</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_preferences_clicked" last_modification_time="Tue, 31 Oct 2006 10:35:46 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button33"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_accept_clicked" last_modification_time="Tue, 31 Oct 2006 11:54:10 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - <widget class="GtkWindow" id="selecttrackdialog"> <property name="width_request">350</property> <property name="height_request">235</property> Modified: pytrainer/trunk/pytrainer/gui/windowimportdata.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowimportdata.py 2010-02-15 08:26:32 UTC (rev 511) +++ pytrainer/trunk/pytrainer/gui/windowimportdata.py 2010-02-15 10:40:37 UTC (rev 512) @@ -28,21 +28,22 @@ from pytrainer.gui.dialogs import fileChooserDialog class WindowImportdata(SimpleGladeApp): - def __init__(self, data_path = None, parent=None, config=None): + def __init__(self, data_path = None, parent=None, config=None, pytrainer_main=None): self.data_path = data_path self.glade_path=data_path+"glade/importdata.glade" self.root = "win_importdata" self.domain = None self.parent = parent + self.pytrainer_main = pytrainer_main self.configuration = config self.activities_store = None self.files_store = None self.processClasses = [] self.plugins = Plugins(data_path, self.parent.parent) - #SimpleGladeApp.__init__(self, data_path+glade_path, root, domain) + SimpleGladeApp.__init__(self, self.glade_path, self.root, self.domain) - def run(self): - SimpleGladeApp.__init__(self, self.glade_path, self.root, self.domain) + #def run(self): + # SimpleGladeApp.__init__(self, self.glade_path, self.root, self.domain) def new(self): self.defaulttab = self.configuration.getValue("pytraining","import_default_tab") @@ -96,10 +97,10 @@ return def init_plugins_tab(self): - #Remove all components in vbox - in case of re-detection + #Remove components in vbox - in case of re-detection for child in self.vboxPlugins.get_children(): - print "removing ", child - self.vboxPlugins.remove(child) + if isinstance(child, gtk.Table): + self.vboxPlugins.remove(child) pluginList = self.plugins.getPluginsList() for plugin in pluginList: #Store plugin details @@ -117,29 +118,24 @@ pluginFrame.add(description) #Get plugin information name,description,status = self.plugins.getPluginInfo(pluginClass) - #get plugin conf params ## These are the default params, need to get those stored for the user - #params = self.plugins.getPluginConfParams(pluginClass) - #print params - #Create buttons - statusButton = gtk.Button(label="Disable") - statusButton.connect('clicked', self.pluginsButton_clicked, pluginClass) - configButton = gtk.Button(label="Configure") - configButton.connect('clicked', self.pluginsButton_clicked, pluginClass) - runButton = gtk.Button(label="Run") - runButton.connect('clicked', self.pluginsButton_clicked, pluginClass) - + #Create labels and buttons + configButton = gtk.Button(label=_("Configure")) + runButton = gtk.Button(label=_("Run")) + #Connect button handlers + configButton.connect('clicked', self.on_pluginsButton_Configure_clicked, pluginClass) + runButton.connect('clicked', self.on_pluginsButton_Run_clicked, pluginClass) if status == 0 or status == "0": #Plugin disabled pluginFrame.set_sensitive(0) - statusButton.set_label("Enable") - configButton.set_sensitive(0) runButton.set_sensitive(0) + statusLabel = gtk.Label(_("Disabled")) else: - pass + statusLabel = gtk.Label(_("Enabled")) + #Create a table for the frame and button pluginTable = gtk.Table() pluginTable.attach(pluginFrame, 0, 1, 0, 1, xoptions=gtk.EXPAND|gtk.FILL, xpadding=5) - pluginTable.attach(statusButton, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=gtk.SHRINK, xpadding=5, ypadding=5) + pluginTable.attach(statusLabel, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=gtk.SHRINK, xpadding=5, ypadding=5) pluginTable.attach(configButton, 2, 3, 0, 1, xoptions=gtk.FILL, yoptions=gtk.SHRINK, xpadding=5, ypadding=5) pluginTable.attach(runButton, 3, 4, 0, 1, xoptions=gtk.FILL, yoptions=gtk.SHRINK, xpadding=5, ypadding=5) #Add frame to tab @@ -151,24 +147,25 @@ #Set correct radiobutton based on saved preference if self.defaulttab == 1: self.radiobuttonFile.set_active(1) + elif self.defaulttab == 2: + self.radiobuttonPlugins.set_active(1) else: self.radiobuttonTabGPSDevice.set_active(1) return def detect_tools(self): - """ + ''' Iterate through all tool files from import directory Each file contains information on a particular tool and knows how to determine if the tool is present on the system and what configuration options are needed for the tool Currently displays the tool info and config grayed out if tool is not present - """ + ''' logging.debug('>>') self.updateStatusbar(self.statusbarDevice, "Checking for tools") #Remove all components in vbox - in case of re-detection for child in self.vboxImportTools.get_children(): - print "removing ", child self.vboxImportTools.remove(child) #Get import tool_* files fileList = glob.glob(self.data_path+"import/tool_*.py") @@ -213,7 +210,7 @@ self.win_importdata.show_all() def validateFile(self, import_filename): - """ + ''' Iterate through all supported types of file by reading processing files from import directory Each processing file understands one type of file @@ -221,7 +218,7 @@ returns the instantiated class otherwise: returns None - """ + ''' logging.debug('>>') self.updateStatusbar(self.statusbarImportFile, "Checking file type for: " + import_filename) #Get import files_* files @@ -308,27 +305,27 @@ return store def checkTreestoreForSelection(self, store): - """ + ''' Function iterates over store checking if any items are selected returns True if at least one item is selected, False otherwise Checks item in position 1 only - """ + ''' for item in store: if item[1]: return True return False def treeviewImportFiles_toggled_checkbox(self, cell, path, store): - """ + ''' Sets the state of the checkbox to true or false. - """ + ''' store[path][1] = not store[path][1] self.buttonRemoveSelectedFiles.set_sensitive(self.checkTreestoreForSelection(store)) def treeviewImportEvents_toggled_checkbox(self, cell, path, store): - """ + ''' Sets the state of the checkbox to true or false. - """ + ''' store[path][1] = not store[path][1] self.buttonFileImport.set_sensitive(self.checkTreestoreForSelection(store)) @@ -354,15 +351,17 @@ self.defaulttab = "0" elif self.radiobuttonFile.get_active(): self.defaulttab = "1" + elif self.radiobuttonPlugins.get_active(): + self.defaulttab = "2" self.configuration.setValue("pytraining","import_default_tab",self.defaulttab) #option def removeSelectedFiles(self): - """ + ''' Function to determine which files are selected * remove them from the list * remove the associated activities from the list also - """ + ''' if self.files_store is None: return file_index = 0 @@ -438,22 +437,78 @@ def close_window(self): self.win_importdata.hide() - self.win_importdata.destroy() + #self.win_importdata.destroy() + self.quit() ############################ ## Window signal handlers ## ############################ - def pluginsButton_clicked(self, button, pluginClass): + def on_pluginsButton_Configure_clicked(self, button, pluginClass): ''' Handler for plugin Buttons ''' - print button.get_label(), pluginClass - + name,description,status = self.plugins.getPluginInfo(pluginClass) + prefs = self.plugins.getPluginConfParams(pluginClass) + + self.prefwindow = gtk.Window() + self.prefwindow.set_border_width(20) + self.prefwindow.set_title(_("%s settings" %name)) + + table = gtk.Table(1,2) + i=0 + self.entryList = [] + for pref in prefs: + label = gtk.Label("<b>%s</b>"%pref[0]) + label.set_use_markup(True) + if pref[0] != "status": + entry = gtk.Entry() + entry.set_text(pref[1]) + self.entryList.append(entry) + table.attach(entry,1,2,i,i+1) + else: + combobox = gtk.combo_box_new_text() + combobox.append_text(_("Disable")) + combobox.append_text(_("Enable")) + combobox.set_active(int(pref[1])) + table.attach(combobox,1,2,i,i+1) + self.entryList.append(combobox) + table.attach(label,0,1,i,i+1) + i+=1 + + button = gtk.Button(_("Ok")) + button.connect("clicked", self.on_pluginAcceptSettings_clicked, pluginClass) + table.attach(button,0,2,i,i+1) + self.prefwindow.add(table) + self.prefwindow.show_all() + + def on_pluginsButton_Run_clicked(self, button, pluginClass): + ''' + Handler for plugin Buttons + ''' + self.pytrainer_main.runPlugin(button,pluginClass) + + def on_pluginAcceptSettings_clicked(self, widget, pluginClass): + prefs = self.plugins.getPluginConfParams(pluginClass) + savedOptions = [] + i = 0 + for pref in prefs: + try: + savedOptions.append((pref[0],self.entryList[i].get_text())) + except: + combobox = self.entryList[i] + index = combobox.get_active() + savedOptions.append((pref[0],"%s" %index)) + i+=1 + self.prefwindow.hide() + self.prefwindow = None + self.plugins.setPluginConfParams(pluginClass,savedOptions) + self.init_plugins_tab() + def treeviewImportEvents_header_checkbox(self, column, store): - """ + ''' Handler for click on checkbox column - """ + ''' if store is None: return for item in store: @@ -463,62 +518,16 @@ self.treeviewImportEvents_setCheckboxes(True) def on_win_importdata_delete_event(self, widget, window): - """ Windows closed """ + ''' Window closed ''' self.close_window() def on_notebookMainTabs_switch_page(self, notebook, page, new_page): self.init_tab(new_page) - #def on_filechooserbuttonSelectFile_file_set(self, widget): - ''' - self.buttonClearFile.set_sensitive(1) #Enable clear button - self.buttonFileImport.set_sensitive(0) #Disable import button - self.updateStatusbar(self.statusbarImportFile, "" ) #Clear status bar - #Clear store - if self.activities_store is not None: - self.activities_store.clear() - #Validate file - self.processClass = self.validateFile(self.filechooserbuttonSelectFile.get_filename()) - if self.processClass is not None: - self.updateStatusbar(self.statusbarImportFile, _("Found file of type: %s") % self.processClass.getFileType() ) - #Get activities in file - activitiesSummary = self.processClass.getActivitiesSummary() - for activity in activitiesSummary: - if not activity[1]: - #Activity selected, so enable import button - self.buttonFileImport.set_sensitive(1) - note = "" - else: - note = _("Found in database") - #Add activity details to TreeView store to display - iter = self.activities_store.append() - self.activities_store.set( - iter, - 0, activity[0], - 1, not activity[1], - 2, activity[2], - 3, activity[3], - 4, activity[4], - 5, activity[5], - 6, note, - ) - else: - #Selected file not understood by any of the process files - self.updateStatusbar(self.statusbarImportFile, _("Unknown file type") ) - #Display error - msg = _("File selected is of unknown or unsupported file type") - md = gtk.MessageDialog(self.win_importdata, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, msg) - md.set_title("Error") - md.run() - md.destroy()''' - - #def on_buttonClearFile_clicked(self, widget): - # self.init_tab(1) - def on_buttonOptionsSave_clicked(self, widget): - self.updateStatusbar(self.statusbarOptions, "Saving options") + self.updateStatusbar(self.statusbarOptions, _("Saving options")) self.saveOptions() - self.updateStatusbar(self.statusbarOptions, "Options saved") + self.updateStatusbar(self.statusbarOptions, _("Options saved")) def on_buttonOptionsReset_clicked(self, widget): #GPS Device is default @@ -557,7 +566,7 @@ self.buttonFileImport.set_sensitive(0) #Disable import button def on_buttonSelectFiles_clicked(self, widget): - selectedFiles = fileChooserDialog(title="Choose a file (or files) to import activities from", multiple=True).getFiles() + selectedFiles = fileChooserDialog(title=_("Choose a file (or files) to import activities from"), multiple=True).getFiles() while gtk.events_pending(): # This allows the GUI to update gtk.main_iteration() # before completion of this entire action if selectedFiles is None or len(selectedFiles) == 0: @@ -618,6 +627,9 @@ def on_buttonOptionsClose_clicked(self, widget): self.close_window() + + def on_buttonPluginsClose_clicked(self, widget): + self.close_window() def on_buttonDeviceToolRescan_clicked(self, widget): self.detect_tools() Modified: pytrainer/trunk/pytrainer/gui/windowplugins.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowplugins.py 2010-02-15 08:26:32 UTC (rev 511) +++ pytrainer/trunk/pytrainer/gui/windowplugins.py 2010-02-15 10:40:37 UTC (rev 512) @@ -23,7 +23,7 @@ class WindowPlugins(SimpleGladeApp): def __init__(self, data_path = None, parent=None): - glade_path="glade/pytrainer.glade" + glade_path="glade/plugins.glade" root = "plugins" domain = None self.parent = parent @@ -61,7 +61,6 @@ i+=1 def on_pluginsTree_clicked(self,widget,widget2): - print "clicked" selected,iter = self.pluginsTreeview.get_selection().get_selected() name,description,status = self.parent.getPluginInfo(selected.get_value(iter,0)) self.nameEntry.set_text(name) Modified: pytrainer/trunk/pytrainer/importdata.py =================================================================== --- pytrainer/trunk/pytrainer/importdata.py 2010-02-15 08:26:32 UTC (rev 511) +++ pytrainer/trunk/pytrainer/importdata.py 2010-02-15 10:40:37 UTC (rev 512) @@ -27,9 +27,10 @@ def __init__(self, data_path = None, parent = None, config = None): self.data_path=data_path self.parent = parent + self.pytrainer_main = parent #self.conf = checkConf() self.configuration = config def runImportdata(self): - windowImportdata = WindowImportdata(self.data_path, self, self.configuration) + windowImportdata = WindowImportdata(self.data_path, self, self.configuration, self.pytrainer_main) windowImportdata.run() Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-02-15 08:26:32 UTC (rev 511) +++ pytrainer/trunk/pytrainer/main.py 2010-02-15 10:40:37 UTC (rev 512) @@ -101,7 +101,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.7.1_svn#511" + self.version ="1.7.1_svn#512" self.DB_version = 3 self.date = Date() # Checking profile @@ -369,7 +369,11 @@ def importData(self): logging.debug('>>') + activeplugins_before = self.plugins.getActivePlugins() self.importdata.runImportdata() + activeplugins_after = self.plugins.getActivePlugins() + #Need to check for plugins that have been disabled (were active and now are not) + self.setMenuPlugins(activeplugins_before, activeplugins_after) logging.debug('<<') def editGpsPlugins(self): @@ -378,6 +382,12 @@ self.plugins.managePlugins() activeplugins_after = self.plugins.getActivePlugins() #Need to check for plugins that have been disabled (were active and now are not) + self.setMenuPlugins(activeplugins_before, activeplugins_after) + logging.debug('<<') + + def setMenuPlugins(self, activeplugins_before, activeplugins_after): + logging.debug('>>') + #Need to check for plugins that have been disabled (were active and now are not) for plugin in activeplugins_before: if plugin not in activeplugins_after: #disabled plugin -> need to unload plugin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |