5310: Missing Date field on MediaRef Editor

svn: r18473
This commit is contained in:
Jérôme Rapinat 2011-11-21 10:57:11 +00:00
parent 68e7025c4e
commit 280b4c7d99
2 changed files with 137 additions and 88 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-requires grampswidgets 0.0 -->
@ -7,7 +7,6 @@
<property name="default_width">600</property> <property name="default_width">600</property>
<property name="default_height">450</property> <property name="default_height">450</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox20"> <object class="GtkVBox" id="dialog-vbox20">
<property name="visible">True</property> <property name="visible">True</property>
@ -80,7 +79,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference. <property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference.
You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.</property> You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.</property>
<property name="invisible_char">&#x25CF;</property> <property name="invisible_char"></property>
<property name="adjustment">adjustment4</property> <property name="adjustment">adjustment4</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
<property name="numeric">True</property> <property name="numeric">True</property>
@ -99,7 +98,7 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference. <property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference.
You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.</property> You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.</property>
<property name="invisible_char">&#x25CF;</property> <property name="invisible_char"></property>
<property name="adjustment">adjustment3</property> <property name="adjustment">adjustment3</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
<property name="numeric">True</property> <property name="numeric">True</property>
@ -167,7 +166,7 @@ Select a region with clicking and holding the mouse button on the top left corne
<property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference. <property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference.
You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner. You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.
</property> </property>
<property name="invisible_char">&#x25CF;</property> <property name="invisible_char"></property>
<property name="adjustment">adjustment2</property> <property name="adjustment">adjustment2</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
<property name="numeric">True</property> <property name="numeric">True</property>
@ -186,7 +185,7 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference. <property name="tooltip_text" translatable="yes">If media is an image, select the specific part of the image you want to reference.
You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.</property> You can use the mouse on the picture to select a region, or use these spinbuttons to set the top left, and bottom right corner of the referenced region. Point (0,0) is the top left corner of the picture, and (100,100) the bottom right corner.</property>
<property name="invisible_char">&#x25CF;</property> <property name="invisible_char"></property>
<property name="adjustment">adjustment1</property> <property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
<property name="numeric">True</property> <property name="numeric">True</property>
@ -308,8 +307,8 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<object class="GtkTable" id="table2"> <object class="GtkTable" id="table2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="n_rows">5</property> <property name="n_rows">6</property>
<property name="n_columns">3</property> <property name="n_columns">4</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<child> <child>
@ -319,12 +318,13 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<property name="label" translatable="yes">_Path:</property> <property name="label" translatable="yes">_Path:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="justify">center</property> <property name="justify">center</property>
<property name="mnemonic_widget">path</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">3</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -368,7 +368,7 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Descriptive title for this media object.</property> <property name="tooltip_text" translatable="yes">Descriptive title for this media object.</property>
<property name="invisible_char">&#x25CF;</property> <property name="invisible_char"></property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@ -414,8 +414,8 @@ You can use the mouse on the picture to select a region, or use these spinbutton
</object> </object>
<packing> <packing>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">4</property> <property name="top_attach">5</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
@ -447,7 +447,7 @@ You can use the mouse on the picture to select a region, or use these spinbutton
</child> </child>
</object> </object>
<packing> <packing>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
@ -463,8 +463,8 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">4</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -478,25 +478,63 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">3</property> <property name="top_attach">4</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkHBox" id="hbox136"> <object class="GtkLabel" id="label422">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">12</property> <property name="xalign">0</property>
<child> <property name="label" translatable="yes">_Date:</property>
<object class="UndoableEntry" id="gid"> <property name="use_underline">True</property>
<property name="visible">True</property> <property name="mnemonic_widget">date_edit</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the Media object.</property>
<property name="invisible_char">&#x25CF;</property>
</object> </object>
<packing> <packing>
<property name="position">0</property> <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>
<object class="ValidatableMaskedEntry" id="date_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkButton" id="date_edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<child>
<object class="GtkImage" id="image2264">
<property name="visible">True</property>
<property name="icon_name">gramps-date</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</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> </packing>
</child> </child>
<child> <child>
@ -514,31 +552,19 @@ You can use the mouse on the picture to select a region, or use these spinbutton
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="left_attach">3</property>
<property name="fill">False</property> <property name="right_attach">4</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="UndoableEntry" id="gid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<object class="UndoableEntry" id="path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
</object>
<packing>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -556,20 +582,34 @@ You can use the mouse on the picture to select a region, or use these spinbutton
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="left_attach">3</property>
<property name="fill">False</property> <property name="right_attach">4</property>
<property name="position">1</property> <property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="UndoableEntry" id="path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">2</property> <property name="top_attach">3</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
</child> </child>
<child type="tab"> <child type="tab">

View File

@ -51,7 +51,8 @@ from gen.db import DbTxn
from glade import Glade from glade import Glade
from displaytabs import (SourceEmbedList, AttrEmbedList, MediaBackRefList, from displaytabs import (SourceEmbedList, AttrEmbedList, MediaBackRefList,
NoteTab) NoteTab)
from gui.widgets import MonitoredSpinButton, MonitoredEntry, PrivacyButton from gui.widgets import (MonitoredSpinButton, MonitoredEntry, PrivacyButton,
MonitoredDate)
from editreference import RefTab, EditReference from editreference import RefTab, EditReference
from addmedia import AddMediaObject from addmedia import AddMediaObject
@ -147,6 +148,7 @@ class EditMediaRef(EditReference):
self.subpixmap.set_from_pixbuf(pb) self.subpixmap.set_from_pixbuf(pb)
def _setup_fields(self): def _setup_fields(self):
ebox_shared = self.top.get_object('eventbox') ebox_shared = self.top.get_object('eventbox')
ebox_shared.connect('button-press-event', self.button_press_event) ebox_shared.connect('button-press-event', self.button_press_event)
@ -250,6 +252,13 @@ class EditMediaRef(EditReference):
self.source.get_path, self.source.get_path,
self.db.readonly) self.db.readonly)
self.date_field = MonitoredDate(
self.top.get_object("date_entry"),
self.top.get_object("date_edit"),
self.source.get_date_object(),
self.uistate, self.track,
self.db.readonly)
def set_corner1_x(self, value): def set_corner1_x(self, value):
""" """
Callback for the signal handling of the spinbutton for the first Callback for the signal handling of the spinbutton for the first