[Pycodeocr-main] SF.net SVN: pycodeocr:[37] branches/laserb
Status: Beta
Brought to you by:
drtrigon
|
From: <la...@us...> - 2011-02-10 18:17:12
|
Revision: 37
http://pycodeocr.svn.sourceforge.net/pycodeocr/?rev=37&view=rev
Author: laserb
Date: 2011-02-10 18:17:05 +0000 (Thu, 10 Feb 2011)
Log Message:
-----------
Fully scalable interface (todo: change image size when rescaling), bigger image on click (minimum size 600px, or 2x bigger) / Small fixes with multiple printer selection and stdout redirection
Modified Paths:
--------------
branches/laserb/PyCodeOCR.glade
branches/laserb/PyCodeOCR.py
Modified: branches/laserb/PyCodeOCR.glade
===================================================================
--- branches/laserb/PyCodeOCR.glade 2011-02-10 14:53:47 UTC (rev 36)
+++ branches/laserb/PyCodeOCR.glade 2011-02-10 18:17:05 UTC (rev 37)
@@ -15,89 +15,231 @@
<property name="can_focus">True</property>
<property name="tab_pos">left</property>
<child>
- <widget class="GtkFixed" id="fixed1">
+ <widget class="GtkHBox" id="hbox1">
+ <property name="width_request">1284</property>
+ <property name="height_request">443</property>
<property name="visible">True</property>
<child>
- <widget class="GtkProgressBar" id="progressbar1">
- <property name="width_request">504</property>
- <property name="height_request">20</property>
+ <widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="pulse_step">0.10000000149</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="height_request">32</property>
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkComboBox" id="combobox2">
+ <property name="width_request">200</property>
+ <property name="height_request">29</property>
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">E-Banking invoice OCR
+Barcode optical recogn. (beta)
+DataMatrix optical recogn. (beta)
+PDF417 bc. optical recogn. (beta)
+</property>
+ <signal name="changed" handler="on_combobox2_changed"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="height_request">30</property>
+ <property name="visible">True</property>
+ <property name="spacing">11</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton1">
+ <property name="width_request">21</property>
+ <property name="height_request">21</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton2</property>
+ <signal name="toggled" handler="on_combobox2_changed"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFileChooserButton" id="filechooserbutton1">
+ <property name="width_request">168</property>
+ <property name="height_request">29</property>
+ <property name="visible">True</property>
+ <property name="do_overwrite_confirmation">True</property>
+ <signal name="file_set" handler="on_filechooserbutton1_file_set"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="width_request">102</property>
+ <property name="height_request">17</property>
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Scanned code:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEventBox" id="eventbox2">
+ <property name="visible">True</property>
+ <signal name="button_press_event" handler="on_eventbox2_button_press_event"/>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">4</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="entry1">
+ <property name="width_request">504</property>
+ <property name="height_request">27</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">•</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkProgressBar" id="progressbar1">
+ <property name="width_request">504</property>
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="pulse_step">0.10000000149</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="x">16</property>
- <property name="y">208</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="entry1">
- <property name="width_request">504</property>
- <property name="height_request">27</property>
+ <widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">•</property>
- </widget>
- <packing>
- <property name="x">16</property>
- <property name="y">168</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label5">
- <property name="width_request">90</property>
- <property name="height_request">21</property>
- <property name="visible">True</property>
- <property name="label" translatable="yes">Orientation:</property>
- </widget>
- <packing>
- <property name="x">569</property>
- <property name="y">160</property>
- </packing>
- </child>
- <child>
- <widget class="GtkComboBox" id="combobox1">
- <property name="width_request">90</property>
- <property name="height_request">29</property>
- <property name="visible">True</property>
- <property name="items" translatable="yes">0 deg
-90 deg
-180 deg
-270 deg</property>
- <signal name="changed" handler="on_combobox1_changed"/>
- </widget>
- <packing>
- <property name="x">691</property>
- <property name="y">155</property>
- </packing>
- </child>
- <child>
- <widget class="GtkFrame" id="frame1">
- <property name="width_request">224</property>
- <property name="height_request">91</property>
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <widget class="GtkHBox" id="hbox3">
+ <property name="height_request">30</property>
<property name="visible">True</property>
- <property name="left_padding">12</property>
<child>
- <widget class="GtkFixed" id="fixed2">
+ <widget class="GtkRadioButton" id="radiobutton2">
+ <property name="label" translatable="yes">Standard SANE Interface</property>
+ <property name="width_request">224</property>
+ <property name="height_request">21</property>
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_combobox2_changed"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button1">
+ <property name="label" translatable="yes">Retry</property>
+ <property name="width_request">60</property>
+ <property name="height_request">29</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button1_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label6">
- <property name="width_request">72</property>
+ <property name="width_request">92</property>
<property name="height_request">17</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Position:</property>
</widget>
<packing>
- <property name="y">8</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spinbutton1">
- <property name="width_request">56</property>
+ <property name="width_request">60</property>
<property name="height_request">27</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -108,12 +250,15 @@
<signal name="value_changed" handler="on_spinbutton_value_changed"/>
</widget>
<packing>
- <property name="x">80</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spinbutton2">
- <property name="width_request">56</property>
+ <property name="width_request">60</property>
<property name="height_request">27</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -124,12 +269,40 @@
<signal name="value_changed" handler="on_spinbutton_value_changed"/>
</widget>
<packing>
- <property name="x">144</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">2</property>
</packing>
</child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
<child>
+ <widget class="GtkLabel" id="label7">
+ <property name="width_request">92</property>
+ <property name="height_request">17</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Size:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkSpinButton" id="spinbutton3">
- <property name="width_request">56</property>
+ <property name="width_request">60</property>
<property name="height_request">27</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -140,13 +313,15 @@
<signal name="value_changed" handler="on_spinbutton_value_changed"/>
</widget>
<packing>
- <property name="x">80</property>
- <property name="y">40</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spinbutton4">
- <property name="width_request">56</property>
+ <property name="width_request">60</property>
<property name="height_request">27</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -157,181 +332,129 @@
<signal name="value_changed" handler="on_spinbutton_value_changed"/>
</widget>
<packing>
- <property name="x">144</property>
- <property name="y">40</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">2</property>
</packing>
</child>
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="width_request">72</property>
- <property name="height_request">17</property>
- <property name="visible">True</property>
- <property name="label" translatable="yes">Size:</property>
- </widget>
- <packing>
- <property name="y">48</property>
- </packing>
- </child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
<child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="width_request">1</property>
+ <property name="height_request">30</property>
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="width_request">92</property>
+ <property name="height_request">21</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Orientation:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="combobox1">
+ <property name="width_request">90</property>
+ <property name="height_request">29</property>
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">0 deg
+90 deg
+180 deg
+270 deg</property>
+ <signal name="changed" handler="on_combobox1_changed"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
- <property name="label" translatable="yes">Placement</property>
- <property name="use_markup">True</property>
</widget>
<packing>
- <property name="type">label_item</property>
+ <property name="position">3</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="x">558</property>
- <property name="y">56</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label9">
- <property name="width_request">102</property>
- <property name="height_request">17</property>
- <property name="visible">True</property>
- <property name="label" translatable="yes">Scanned code:</property>
- </widget>
- <packing>
- <property name="x">16</property>
- <property name="y">55</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button2">
- <property name="label" translatable="yes">exit</property>
- <property name="width_request">90</property>
- <property name="height_request">29</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="on_button2_clicked"/>
- </widget>
- <packing>
- <property name="x">692</property>
- <property name="y">200</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToggleButton" id="togglebutton1">
- <property name="label" translatable="yes">scan</property>
- <property name="width_request">90</property>
- <property name="height_request">29</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="toggled" handler="on_togglebutton1_toggled"/>
- </widget>
- <packing>
- <property name="x">568</property>
- <property name="y">200</property>
- </packing>
- </child>
- <child>
- <widget class="GtkComboBox" id="combobox2">
- <property name="width_request">256</property>
- <property name="height_request">31</property>
- <property name="visible">True</property>
- <property name="items" translatable="yes">E-Banking invoice OCR
-Barcode optical recogn. (beta)
-DataMatrix optical recogn. (beta)
-PDF417 bc. optical recogn. (beta)
-</property>
- <signal name="changed" handler="on_combobox2_changed"/>
- </widget>
- <packing>
- <property name="x">16</property>
- <property name="y">16</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton2">
- <property name="label" translatable="yes">Standard SANE Interface</property>
- <property name="width_request">224</property>
- <property name="height_request">21</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_combobox2_changed"/>
- </widget>
- <packing>
- <property name="x">534</property>
- <property name="y">24</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton1">
- <property name="width_request">21</property>
- <property name="height_request">21</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton2</property>
- <signal name="toggled" handler="on_combobox2_changed"/>
- </widget>
- <packing>
- <property name="x">318</property>
- <property name="y">24</property>
- </packing>
- </child>
- <child>
- <widget class="GtkFileChooserButton" id="filechooserbutton1">
- <property name="width_request">168</property>
- <property name="height_request">31</property>
- <property name="visible">True</property>
- <property name="do_overwrite_confirmation">True</property>
- <signal name="file_set" handler="on_filechooserbutton1_file_set"/>
- </widget>
- <packing>
- <property name="x">342</property>
- <property name="y">16</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button1">
- <property name="label" translatable="yes">Retry</property>
- <property name="width_request">60</property>
- <property name="height_request">29</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="on_button1_clicked"/>
- </widget>
- <packing>
- <property name="x">721</property>
- <property name="y">20</property>
- </packing>
- </child>
- <child>
- <widget class="GtkEventBox" id="eventbox2">
- <property name="width_request">505</property>
- <property name="height_request">84</property>
- <property name="visible">True</property>
- <signal name="button_press_event" handler="on_eventbox2_button_press_event"/>
<child>
- <widget class="GtkImage" id="image1">
- <property name="width_request">505</property>
- <property name="height_request">84</property>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="height_request">31</property>
<property name="visible">True</property>
+ <child>
+ <widget class="GtkToggleButton" id="togglebutton1">
+ <property name="label" translatable="yes">scan</property>
+ <property name="width_request">90</property>
+ <property name="height_request">29</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="toggled" handler="on_togglebutton1_toggled"/>
+ </widget>
+ <packing>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button2">
+ <property name="label" translatable="yes">exit</property>
+ <property name="width_request">90</property>
+ <property name="height_request">19</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_button2_clicked"/>
+ </widget>
+ <packing>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">4</property>
+ </packing>
</child>
</widget>
<packing>
- <property name="x">16</property>
- <property name="y">75</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
@@ -365,7 +488,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
- <property name="wrap-mode">word</property>
+ <property name="wrap_mode">word</property>
</widget>
</child>
</widget>
@@ -390,24 +513,11 @@
</packing>
</child>
<child>
- <widget class="GtkFixed" id="fixed3">
+ <widget class="GtkVBox" id="vbox1">
+ <property name="width_request">100</property>
+ <property name="height_request">80</property>
<property name="visible">True</property>
<child>
- <widget class="GtkButton" id="button3">
- <property name="label" translatable="yes">OK</property>
- <property name="width_request">90</property>
- <property name="height_request">29</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="on_button3_clicked"/>
- </widget>
- <packing>
- <property name="x">662</property>
- <property name="y">200</property>
- </packing>
- </child>
- <child>
<widget class="GtkLabel" id="label10">
<property name="width_request">416</property>
<property name="height_request">30</property>
@@ -416,8 +526,9 @@
<property name="label" translatable="yes">Select device to use.</property>
</widget>
<packing>
- <property name="x">23</property>
- <property name="y">12</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -439,13 +550,28 @@
</child>
</widget>
<packing>
- <property name="x">15</property>
- <property name="y">52</property>
+ <property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton" id="button3">
+ <property name="label" translatable="yes">OK</property>
+ <property name="width_request">90</property>
+ <property name="height_request">29</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button3_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -475,7 +601,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
- <property name="wrap-mode">word</property>
+ <property name="wrap_mode">word</property>
</widget>
</child>
</widget>
@@ -508,22 +634,23 @@
<property name="destroy_with_parent">True</property>
<signal name="leave_notify_event" handler="on_eventbox2_button_press_event"/>
<child>
- <widget class="GtkFixed" id="fixed3">
+ <widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<widget class="GtkEventBox" id="eventbox1">
- <property name="width_request">600</property>
- <property name="height_request">600</property>
<property name="visible">True</property>
- <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK</property>
+ <property name="extension_events">all</property>
+ <property name="visible_window">False</property>
<child>
<widget class="GtkImage" id="image2">
- <property name="width_request">600</property>
- <property name="height_request">600</property>
<property name="visible">True</property>
</widget>
</child>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
</widget>
</child>
Modified: branches/laserb/PyCodeOCR.py
===================================================================
--- branches/laserb/PyCodeOCR.py 2011-02-10 14:53:47 UTC (rev 36)
+++ branches/laserb/PyCodeOCR.py 2011-02-10 18:17:05 UTC (rev 37)
@@ -74,7 +74,7 @@
def write(self, text):
enditer = self.textbuffer.get_end_iter()
- self.textbuffer.insert(enditer,"\n%s" % text )
+ self.textbuffer.insert(enditer,"%s" % text )
## MainWindow
# The GUI was created/designed using GLADE
@@ -174,6 +174,7 @@
# redirect print
self.logging = logging(self.textbuffer)
sys.stdout = self.logging
+ sys.stderr = self.logging
print "---------",strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()),"----------"
@@ -208,8 +209,8 @@
# set tooltips
self.button1.set_tooltip_text("Restart PyCodeOCR to search for a SANE device.")
self.button1.set_visible(True)
-# self.image1.set_tooltip_text("Click for bigger image")
- self.image2.set_tooltip_text("Click to close")
+ self.image1.set_tooltip_text("Click for bigger image")
+ self.image2.set_tooltip_text("Leave window to close")
# take some time to init sane
#self.init_sane()
@@ -240,7 +241,7 @@
# show tab with device list
# choose device and press ok to initialize scanner
# self.window2.show()
- self.notebook.set_current_page(3)
+ self.notebook.set_current_page(2)
return False
@@ -257,11 +258,12 @@
self.notebook.set_current_page(3)
def on_pointer_motion(self, source=None, event=None):
- (x,y,state) = self.window1.window.get_pointer()
- (wxim, wyim ) = self.image1.get_size_request()
- if x > 16+(wxim-self.new_width)/2 and x < 16+(wxim+self.new_width)/2 and y > 75+(wyim-self.new_height)/2 and y < 75+(wyim+self.new_height)/2:
- if not self.window3.get_visible():
- self.on_eventbox2_button_press_event()
+ pass
+# (x,y,state) = self.window1.window.get_pointer()
+# (wxim, wyim ) = self.image1.get_size_request()
+# if x > 16+(wxim-self.new_width)/2 and x < 16+(wxim+self.new_width)/2 and y > 75+(wyim-self.new_height)/2 and y < 75+(wyim+self.new_height)/2:
+# if not self.window3.get_visible():
+# self.on_eventbox2_button_press_event()
def on_eventbox2_button_press_event(self, source=None, event=None):
if self.window3.get_visible():
@@ -274,7 +276,21 @@
im1 = Image.open(self.imageFile)
# adjust width and height to your needs and keep ratio
(im_width, im_height) = im1.size #get image size
- (width, height) = self.image2.get_size_request() #get needed size
+ # get size of shown image
+ width = self.image1.allocation.width
+ height = self.image1.allocation.height
+
+ # make it bigger in window
+ # size should be at least 600
+ if max(width,height) < 300:
+ ratio = min(600/float(width),600/float(height))
+ width = ratio*width
+ height = ratio*height
+ # or 2x bigger
+ else:
+ width = 2*width
+ height = 2*height
+
ratio = min(float(width)/im_width,float(height)/im_height) #calculate resizing ratio
new_width = int(im_width*ratio)
new_height = int(im_height*ratio)
@@ -301,15 +317,16 @@
## set sensitivity of buttons the first time
def init_sensitivity(self):
# set sensitivity
- if self.run_sane.found_scanner:
- self.radiobutton2.set_active(True)
- self.radiobutton2.set_sensitive(True)
- else:
- self.radiobutton1.set_active(True)
- self.radiobutton2.set_sensitive(False)
- #self.on_radiobutton1_toggled()
- self.progress(0.,"No SANE device found. Use file input instead.")
- self.button1.set_visible(True)
+ if len(self.run_sane.devices) == 0:
+ if self.run_sane.found_scanner:
+ self.radiobutton2.set_active(True)
+ self.radiobutton2.set_sensitive(True)
+ else:
+ self.radiobutton1.set_active(True)
+ self.radiobutton2.set_sensitive(False)
+ #self.on_radiobutton1_toggled()
+ self.progress(0.,"No SANE device found. Use file input instead.")
+ self.button1.set_visible(True)
# unlock window
self.window1.set_sensitive(True)
@@ -429,10 +446,11 @@
## toggle placement sensitivity
def toggle_placement_sensitive(self, value):
- if self.radiobutton2.get_active():
- self.frame1.set_sensitive(value)
- else:
- self.frame1.set_sensitive(False)
+ pass
+# if self.radiobutton2.get_active():
+# self.frame1.set_sensitive(value)
+# else:
+# self.frame1.set_sensitive(False)
# helpers
#
@@ -740,7 +758,9 @@
# adjust width and height to your needs and keep ratio
(im_width, im_height) = im1.size #get image size
- (width, height) = self.image1.get_size_request() #get needed size
+ #get needed size
+ width = self.image1.allocation.width
+ height = self.image1.allocation.height
ratio = min(float(width)/im_width,float(height)/im_height) #calculate resizing ratio
self.new_width = int(im_width*ratio)
self.new_height = int(im_height*ratio)
@@ -955,13 +975,16 @@
# Get the path set up properly
#sys.path.append('.')
+ list_store = self.main.treeview1.get_model()
+ if list_store == None:
+ # create treeview things
+ list_store = gtk.ListStore(gobject.TYPE_STRING)
+ self.main.treeview1.set_model(list_store)
+ col = gtk.TreeViewColumn("Devices", gtk.CellRendererText(),text=0)
+ self.main.treeview1.append_column(col)
+ else:
+ list_store.clear()
- # create treeview things
- list_store = gtk.ListStore(gobject.TYPE_STRING)
- self.main.treeview1.set_model(list_store)
- col = gtk.TreeViewColumn("Devices", gtk.CellRendererText(),text=0)
- self.main.treeview1.append_column(col)
-
# get blacklist
self.read_blacklist()
@@ -994,7 +1017,7 @@
self.found_scanner = False
elif len(list_store) > 1:
# more than one device, choose one.
- progress(2./self.n,"More than one device found.")
+ self.main.progress(2./self.n,"More than one device found.")
if sys.argv[1:]:
# choose one by command line
devnr = raw_input("Choose device: ")
@@ -1002,8 +1025,10 @@
# continue to init scanner
self.init_scanner(devnr)
else:
- # simply continue and select device in GUI ( look in init_sane )
+ # simply continue and select device in GUI ( see init_sane )
self.main.progress(2./self.n,"More than one device found.")
+ self.main.notebook.set_current_page(2)
+ self.found_scanner = False
else:
# only one device found
@@ -1014,7 +1039,7 @@
except:
# No device found at all
self.found_scanner = False
- print "No sane device found. Restart to try it again."
+ print "No sane device found. Retry again."
## iInit of sane interface -> scanner
def init_scanner(self, devnr):
@@ -1034,12 +1059,13 @@
self.main.progress(4./self.n,"Ready: %s" % self.devices[devnr][1]+" "+self.devices[devnr][2])
self.info()
+ self.main.notebook.set_current_page(0)
print "done."
except:
# init scanner failed. maybe device has no scanner
self.found_scanner = False
- print "Loading sane device failed. Restart to try it again."
+ print "Loading sane device failed. Retry again."
@@ -1086,13 +1112,14 @@
def info(self):
# print self.entry3.get_text()
entrybuffer = self.main.entry3.get_buffer()
+ entrybuffer.delete(entrybuffer.get_start_iter(),entrybuffer.get_end_iter())
# redirect print to device textbuffer
logdev = logging(entrybuffer)
sys.stdout = logdev
- print """SANE version: %s
-Selected device= %s
-SaneDev object= %s
-""" % ( self.version ,self.dev,self.scanner )
+# print """SANE version: %s
+#Selected device= %s
+#SaneDev object= %s
+#""" % ( self.version ,self.dev,self.scanner )
# enditer = entrybuffer.get_end_iter()
# entrybuffer.insert(enditer,"test")
print 'SANE version: %s' % repr(self.version).replace('array',' ')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|