GUI cleanup on editmediaref
svn: r16065
This commit is contained in:
parent
83972bd006
commit
f96145f2fc
@ -16,7 +16,6 @@
|
||||
<object class="GtkVBox" id="vbox22">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook_ref">
|
||||
@ -26,7 +25,7 @@
|
||||
<object class="GtkTable" id="table50">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">5</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
@ -41,7 +40,7 @@
|
||||
<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="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -56,7 +55,7 @@
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -79,8 +78,8 @@
|
||||
<object class="GtkSpinButton" id="corner2_y">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_markup">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<property name="tooltip_text" translatable="yes">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<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>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="adjustment">adjustment4</property>
|
||||
<property name="climb_rate">1</property>
|
||||
@ -98,8 +97,9 @@
|
||||
<object class="GtkSpinButton" id="corner2_x">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_markup">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<property name="tooltip_text" translatable="yes">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<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>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="adjustment">adjustment3</property>
|
||||
<property name="climb_rate">1</property>
|
||||
@ -116,6 +116,8 @@
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame9">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Referenced region of the image media object.
|
||||
Select a region with clicking and holding the mouse button on the top left corner of the region you want, dragging the mouse to the bottom right corner of the region, and then releasing the mouse button.</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
<object class="GtkEventBox" id="eventbox1">
|
||||
@ -125,6 +127,7 @@
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="yalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -139,9 +142,8 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -155,7 +157,7 @@
|
||||
<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="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -163,8 +165,9 @@
|
||||
<object class="GtkSpinButton" id="corner1_x">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_markup">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<property name="tooltip_text" translatable="yes">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<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>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="adjustment">adjustment2</property>
|
||||
<property name="climb_rate">1</property>
|
||||
@ -182,8 +185,8 @@
|
||||
<object class="GtkSpinButton" id="corner1_y">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_markup">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<property name="tooltip_text" translatable="yes">If media is an image, select a region of the image that is referenced. Point (0,0) is the top left corner. Do this by giving two corners on a diagonal of the rectangular region you want to use.</property>
|
||||
<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>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="climb_rate">1</property>
|
||||
@ -208,29 +211,74 @@
|
||||
<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="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="private">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2686">
|
||||
<object class="GtkToggleButton" id="private">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon_name">gtk-dialog-authentication</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">none</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2686">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon_name">gtk-dialog-authentication</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
@ -272,7 +320,6 @@
|
||||
<property name="label" translatable="yes">_Path:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">path</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@ -321,6 +368,7 @@
|
||||
<object class="UndoableEntry" id="description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Descriptive title for this media object.</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -331,20 +379,6 @@
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="path">
|
||||
<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="GtkHBox" id="warn_box">
|
||||
<property name="border_width">6</property>
|
||||
@ -356,11 +390,14 @@
|
||||
<property name="icon-size">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label659">
|
||||
<property name="width_request">400</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ypad">3</property>
|
||||
@ -436,6 +473,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="type">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Type of media object as indicated by the computer, eg Image, Video, ...</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -455,6 +493,7 @@
|
||||
<object class="UndoableEntry" id="gid">
|
||||
<property name="visible">True</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">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -466,6 +505,7 @@
|
||||
<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="image2710">
|
||||
<property name="visible">True</property>
|
||||
@ -488,6 +528,49 @@
|
||||
<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">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="file_select">
|
||||
<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="image2673">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</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>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
|
@ -94,25 +94,51 @@ class EditMediaRef(EditReference):
|
||||
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('_General'), tblref)
|
||||
|
||||
def setup_filepath(self):
|
||||
self.select = self.top.get_object('file_select')
|
||||
self.file_path = self.top.get_object("path")
|
||||
|
||||
self.file_path.set_text(self.source.get_path())
|
||||
self.select.connect('clicked', self.select_file)
|
||||
|
||||
def determine_mime(self):
|
||||
descr = gen.mime.get_description(self.source.get_mime_type())
|
||||
if descr:
|
||||
self.mimetext.set_text(descr)
|
||||
|
||||
path = self.file_path.get_text()
|
||||
path_full = Utils.media_path_full(self.db, path)
|
||||
if path != self.source.get_path() and path_full != self.source.get_path():
|
||||
#redetermine mime
|
||||
mime = gen.mime.get_type(Utils.find_file(path_full))
|
||||
self.source.set_mime_type(mime)
|
||||
descr = gen.mime.get_description(mime)
|
||||
if descr:
|
||||
self.mimetext.set_text(descr)
|
||||
else:
|
||||
self.mimetext.set_text(_('Unknown'))
|
||||
#if mime type not set, is note
|
||||
if not self.source.get_mime_type():
|
||||
self.mimetext.set_text(_('Note'))
|
||||
|
||||
def draw_preview(self):
|
||||
"""
|
||||
Draw the two preview images. This method can be called on eg change of
|
||||
the path.
|
||||
"""
|
||||
self.mtype = self.source.get_mime_type()
|
||||
fullpath = Utils.media_path_full(self.db, self.source.get_path())
|
||||
self.pix = ThumbNails.get_thumbnail_image(fullpath,
|
||||
self.mtype)
|
||||
self.pixmap.set_from_pixbuf(self.pix)
|
||||
|
||||
self.subpix = ThumbNails.get_thumbnail_image(fullpath,
|
||||
self.mtype,
|
||||
self.rectangle)
|
||||
self.subpixmap.set_from_pixbuf(self.subpix)
|
||||
mtype = self.source.get_mime_type()
|
||||
if mtype:
|
||||
fullpath = Utils.media_path_full(self.db, self.source.get_path())
|
||||
pb = ThumbNails.get_thumbnail_image(fullpath, mtype)
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
subpix = ThumbNails.get_thumbnail_image(fullpath, mtype,
|
||||
self.rectangle)
|
||||
self.subpixmap.set_from_pixbuf(subpix)
|
||||
else:
|
||||
pb = ThumbNails.find_mime_type_pixbuf('text/plain')
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
self.subpixmap.set_from_pixbuf(pb)
|
||||
|
||||
mt = gen.mime.get_description(self.mtype)
|
||||
self.top.get_object("type").set_text(mt if mt else "")
|
||||
|
||||
def _setup_fields(self):
|
||||
ebox_shared = self.top.get_object('eventbox')
|
||||
ebox_shared.connect('button-press-event', self.button_press_event)
|
||||
@ -127,6 +153,7 @@ class EditMediaRef(EditReference):
|
||||
ebox_ref.add_events(gtk.gdk.BUTTON_RELEASE_MASK)
|
||||
|
||||
self.pixmap = self.top.get_object("pixmap")
|
||||
self.mimetext = self.top.get_object("type")
|
||||
|
||||
coord = self.source_ref.get_rectangle()
|
||||
#upgrade path: set invalid (from eg old db) to none
|
||||
@ -141,6 +168,8 @@ class EditMediaRef(EditReference):
|
||||
self.rectangle = coord
|
||||
self.subpixmap = self.top.get_object("subpixmap")
|
||||
|
||||
self.setup_filepath()
|
||||
self.determine_mime()
|
||||
self.draw_preview()
|
||||
|
||||
corners = ["corner1_x", "corner1_y", "corner2_x", "corner2_y"]
|
||||
@ -468,8 +497,16 @@ class EditMediaRef(EditReference):
|
||||
"""
|
||||
for obj in (self.descr_window, self.path_obj):
|
||||
obj.update()
|
||||
self.determine_mime()
|
||||
self.draw_preview()
|
||||
|
||||
def select_file(self, val):
|
||||
self.determine_mime()
|
||||
path = self.file_path.get_text()
|
||||
self.source.set_path(Utils.get_unicode_path_from_file_chooser(path))
|
||||
AddMediaObject(self.dbstate, self.uistate, self.track, self.source,
|
||||
self._update_addmedia)
|
||||
|
||||
def _connect_signals(self):
|
||||
self.define_cancel_button(self.top.get_object('button84'))
|
||||
self.define_ok_button(self.top.get_object('button82'),self.save)
|
||||
|
Loading…
Reference in New Issue
Block a user