Added progress messages when handling moved/modified images.
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 29 Jul 2004 14:06:28 +0000 (14:06 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 29 Jul 2004 14:06:28 +0000 (14:06 +0000)
src/gkofoto/glade/gkofoto.glade
src/gkofoto/handleimagesdialog.py

index fe26317..a9d471b 100644 (file)
@@ -2146,7 +2146,7 @@ The categories' children will not be destroyed, nor will the images associated w
          <child>
            <widget class="GtkLabel" id="label44">
              <property name="visible">True</property>
-             <property name="label" translatable="yes">Files investigated:</property>
+             <property name="label" translatable="yes">Investigated files:</property>
              <property name="use_underline">False</property>
              <property name="use_markup">False</property>
              <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2345,4 +2345,331 @@ The categories' children will not be destroyed, nor will the images associated w
   </child>
 </widget>
 
+<widget class="GtkDialog" id="handleImagesProgressDialog">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">dialog2</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="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_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="vbox14">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">8</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="hbuttonbox3">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="okButton">
+             <property name="visible">True</property>
+             <property name="can_default">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>
+             <property name="response_id">-5</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkLabel" id="label45">
+         <property name="visible">True</property>
+         <property name="label" translatable="yes">Investigating images, please wait...</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>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkTable" id="table3">
+         <property name="visible">True</property>
+         <property name="n_rows">5</property>
+         <property name="n_columns">2</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">0</property>
+         <property name="column_spacing">9</property>
+
+         <child>
+           <widget class="GtkLabel" id="label46">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Known, unchanged images:</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>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</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="label47">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Known, moved/renamed images:</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>
+           </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>
+
+         <child>
+           <widget class="GtkLabel" id="label48">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Unknown, probably modified images:</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>
+           </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="knownUnchangedImagesCount">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">0</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>
+           </widget>
+           <packing>
+             <property name="left_attach">1</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="knownMovedImagesCount">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">0</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>
+           </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="unknownModifiedImagesCount">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">0</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>
+           </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="label49">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Unknown files:</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>
+           </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"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="unknownFilesCount">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">0</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>
+           </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="label50">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Investigated files:</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>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="investigatedFilesCount">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">0</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>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</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>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>
index 702bcde..3a72b5b 100644 (file)
@@ -15,6 +15,29 @@ class HandleImagesDialog(gtk.FileSelection):
         self.ok_button.connect("clicked", self._ok)
 
     def _ok(self, widget):
+        widgets = gtk.glade.XML(env.gladeFile, "handleImagesProgressDialog")
+        handleImagesProgressDialog = widgets.get_widget(
+            "handleImagesProgressDialog")
+        knownUnchangedImagesCount = widgets.get_widget(
+            "knownUnchangedImagesCount")
+        knownMovedImagesCount = widgets.get_widget(
+            "knownMovedImagesCount")
+        unknownModifiedImagesCount = widgets.get_widget(
+            "unknownModifiedImagesCount")
+        unknownFilesCount = widgets.get_widget(
+            "unknownFilesCount")
+        investigatedFilesCount = widgets.get_widget(
+            "investigatedFilesCount")
+        okButton = widgets.get_widget("okButton")
+        okButton.set_sensitive(False)
+
+        handleImagesProgressDialog.show()
+
+        knownUnchangedImages = 0
+        knownMovedImages = 0
+        unknownModifiedImages = 0
+        unknownFiles = 0
+        investigatedFiles = 0
         modifiedImages = []
         movedImages = []
         for filepath in walk_files(self.get_selections()):
@@ -23,15 +46,22 @@ class HandleImagesDialog(gtk.FileSelection):
                 image = env.shelf.getImage(filepath)
                 if image.getLocation() == os.path.realpath(filepath):
                     # Registered.
-                    pass
+                    knownUnchangedImages += 1
+                    knownUnchangedImagesCount.set_text(
+                        str(knownUnchangedImages))
                 else:
                     # Moved.
+                    knownMovedImages += 1
+                    knownMovedImagesCount.set_text(str(knownMovedImages))
                     movedImages.append(filepath)
             except ImageDoesNotExistError:
                 try:
                     image = env.shelf.getImage(
                         filepath, identifyByLocation=True)
                     # Modified.
+                    unknownModifiedImages += 1
+                    unknownModifiedImagesCount.set_text(
+                        str(unknownModifiedImages))
                     modifiedImages.append(filepath)
                 except MultipleImagesAtOneLocationError:
                     # Multiple images at one location.
@@ -39,7 +69,16 @@ class HandleImagesDialog(gtk.FileSelection):
                     pass
                 except ImageDoesNotExistError:
                     # Unregistered.
-                    pass
+                    unknownFiles += 1
+                    unknownFilesCount.set_text(str(unknownFiles))
+            investigatedFiles += 1
+            investigatedFilesCount.set_text(str(investigatedFiles))
+            gtk.main_iteration()
+
+        okButton.set_sensitive(True)
+        handleImagesProgressDialog.run()
+        handleImagesProgressDialog.destroy()
+
         if modifiedImages or movedImages:
             if modifiedImages:
                 self._dialogHelper(