mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
* Added notebook widget for file preview.
* Added thumbnail preview.
This commit is contained in:
37
README
37
README
@@ -26,7 +26,6 @@ pyGTKtalog is written in python with following dependencies:
|
||||
Optional modules:
|
||||
|
||||
- PIL <http://www.pythonware.com/products/pil/index.htm> for image manipulation
|
||||
|
||||
- pyExcelerator <http://sourceforge.net/projects/pyexcelerator> for export to
|
||||
excel capability
|
||||
|
||||
@@ -54,15 +53,38 @@ Then, just run pyGTKtalog script.
|
||||
TODO
|
||||
====
|
||||
|
||||
For version 1.0 following aims have to be done:
|
||||
|
||||
- searching database
|
||||
- taggin files
|
||||
- files properties
|
||||
- adding images
|
||||
- generating/saving thumbnails
|
||||
- command line query support (text output)
|
||||
- tagging files
|
||||
- file details:
|
||||
- files properties
|
||||
x thumbnail
|
||||
- description
|
||||
- file information (date, size, etc) (50%)
|
||||
- exif information
|
||||
- keywords
|
||||
- anime/movie
|
||||
- title
|
||||
- alt title
|
||||
- type (anime movie, movie, anime oav, anime tv series, tv series, etc)
|
||||
- cover/images
|
||||
- genre
|
||||
- lang
|
||||
- sub lang
|
||||
- release date (from - to)
|
||||
- anidb link/imdb link
|
||||
- adding images (60% done)
|
||||
x generating/saving thumbnails
|
||||
x moving hardcoded files extensions into config
|
||||
|
||||
Legend: [-] not done, [x] done.
|
||||
|
||||
For version 2.0:
|
||||
- Icon grid in files view
|
||||
- command line support: query, adding media to collection etc
|
||||
- internationalization support
|
||||
- statistics
|
||||
- moving hardcoded files extensions into config
|
||||
|
||||
NOTES
|
||||
=====
|
||||
@@ -75,3 +97,4 @@ BUGS
|
||||
====
|
||||
|
||||
All bugs please report to Roman 'gryf' Dobosz <roman.dobosz@gmail.com>
|
||||
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
@@ -451,7 +450,7 @@
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkExpander" id="expander1">
|
||||
<widget class="GtkExpander" id="keywords">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
@@ -522,10 +521,107 @@
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook_details">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="fileinfo">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="thumb_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="thumb">
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="xpad">3</property>
|
||||
<property name="ypad">3</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="remove_thumb">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip" translatable="yes">Remove thumbnail image</property>
|
||||
<property name="label" translatable="yes">Remove</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTextView" id="description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="border_width">3</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="wrap_mode">GTK_WRAP_CHAR</property>
|
||||
<property name="left_margin">3</property>
|
||||
<property name="right_margin">3</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="nb_fileinfo">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">File info</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
@@ -632,56 +728,10 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkWindow" id="window_details">
|
||||
<widget class="GtkWindow" id="win_fileinfo">
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox_details">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="headers_clickable">True</property>
|
||||
<property name="rules_hint">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="headers_clickable">True</property>
|
||||
<property name="rules_hint">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
|
||||
@@ -34,7 +34,6 @@ from utils import deviceHelper
|
||||
from gtkmvc import Controller
|
||||
|
||||
from c_config import ConfigController
|
||||
from c_details import DetailsController
|
||||
from views.v_config import ConfigView
|
||||
from models.m_config import ConfigModel
|
||||
|
||||
@@ -50,19 +49,20 @@ class MainController(Controller):
|
||||
widgets = (
|
||||
"discs","files",
|
||||
'save1','save_as1','cut1','copy1','paste1','delete1','add_cd','add_directory1',
|
||||
'tb_save','tb_addcd','tb_find',
|
||||
'tb_save','tb_addcd','tb_find','keywords','description',
|
||||
)
|
||||
widgets_all = (
|
||||
"discs","files",
|
||||
'file1','edit1','add_cd','add_directory1','help1',
|
||||
'tb_save','tb_addcd','tb_find','tb_new','tb_open','tb_quit',
|
||||
'keywords','description',
|
||||
)
|
||||
|
||||
widgets_cancel = ('cancel','cancel1')
|
||||
|
||||
def __init__(self, model):
|
||||
"""Initialize controller"""
|
||||
Controller.__init__(self, model)
|
||||
self.details = DetailsController(model.details)
|
||||
return
|
||||
|
||||
def register_view(self, view):
|
||||
@@ -115,11 +115,9 @@ class MainController(Controller):
|
||||
if self.model.filename != None:
|
||||
self.__activateUI(self.model.filename)
|
||||
|
||||
# register detail subview
|
||||
#self.view.create_sub_view(self.details)
|
||||
|
||||
# generate recent menu
|
||||
self.__generate_recent_menu()
|
||||
|
||||
# Show main window
|
||||
self.view['main'].show();
|
||||
return
|
||||
@@ -277,6 +275,7 @@ class MainController(Controller):
|
||||
print "c_main.py: on_files_cursor_changed() directory selected"
|
||||
else:
|
||||
#file, show what you got.
|
||||
#self.details.get_top_widget()
|
||||
selected_item = self.model.files_list.get_value(model.get_iter(treeview.get_cursor()[0]),0)
|
||||
self.__get_item_info(selected_item)
|
||||
if __debug__:
|
||||
@@ -654,10 +653,20 @@ class MainController(Controller):
|
||||
return
|
||||
|
||||
def __get_item_info(self, item):
|
||||
'''self.view['details'].show()
|
||||
txt = self.model.get_file_info(item)
|
||||
buf = self.view['details'].get_buffer()
|
||||
buf.set_text(txt)
|
||||
self.view['details'].set_buffer(buf)'''
|
||||
self.view['description'].show()
|
||||
set = self.model.get_file_info(item)
|
||||
|
||||
buf = self.view['description'].get_buffer()
|
||||
if set.has_key('description'):
|
||||
buf.set_text(set['description'])
|
||||
else:
|
||||
buf.set_text('')
|
||||
self.view['description'].set_buffer(buf)
|
||||
|
||||
if set.has_key('thumbnail'):
|
||||
self.view['thumb'].set_from_file(set['thumbnail'])
|
||||
self.view['thumb'].show()
|
||||
else:
|
||||
self.view['thumb'].hide()
|
||||
return
|
||||
pass # end of class
|
||||
|
||||
@@ -426,15 +426,23 @@ class MainModel(ModelMT):
|
||||
|
||||
def get_file_info(self, id):
|
||||
"""get file info from database"""
|
||||
self.db_cursor.execute("SELECT filename, date, size, type \
|
||||
FROM files WHERE id = ?", (id,))
|
||||
retval = {}
|
||||
self.db_cursor.execute("SELECT filename, date, size, type, filetype, \
|
||||
id FROM files WHERE id = ?", (id,))
|
||||
set = self.db_cursor.fetchone()
|
||||
if set == None:
|
||||
return ''
|
||||
|
||||
if set:
|
||||
string = "Filename: %s\nDate: %s\nSize: %s\ntype: %s" % \
|
||||
(set[0], datetime.fromtimestamp(set[1]), set[2], set[3])
|
||||
return string
|
||||
retval['description'] = string
|
||||
|
||||
if set[4] == self.F_IMG:
|
||||
self.db_cursor.execute("SELECT filename FROM thumbnails \
|
||||
WHERE file_id = ?",
|
||||
(id,))
|
||||
set = self.db_cursor.fetchone()
|
||||
if set:
|
||||
retval['thumbnail'] = os.path.join(self.internal_dirname, set[0])
|
||||
return retval
|
||||
|
||||
def get_source(self, path):
|
||||
"""get source of top level directory"""
|
||||
|
||||
@@ -34,13 +34,11 @@ class MainView(View):
|
||||
GLADE = os.path.join(utils.globals.GLADE_DIR, "main.glade")
|
||||
def __init__(self, ctrl):
|
||||
View.__init__(self, ctrl, self.GLADE)
|
||||
self.details = None
|
||||
|
||||
# hide v2.0 features
|
||||
self['separatormenuitem4'].hide()
|
||||
self['list1'].hide()
|
||||
self['thumbnails1'].hide()
|
||||
return
|
||||
|
||||
def create_sub_view(self, details_ctrl):
|
||||
"""attach sub view"""
|
||||
self.details = DetailsView(details_ctrl, False)
|
||||
vpan = self['vpaned1']
|
||||
vpan.add2(self.details.get_top_widget())
|
||||
return
|
||||
pass # end of class
|
||||
|
||||
Reference in New Issue
Block a user