mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 19:40:21 +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:
|
Optional modules:
|
||||||
|
|
||||||
- PIL <http://www.pythonware.com/products/pil/index.htm> for image manipulation
|
- PIL <http://www.pythonware.com/products/pil/index.htm> for image manipulation
|
||||||
|
|
||||||
- pyExcelerator <http://sourceforge.net/projects/pyexcelerator> for export to
|
- pyExcelerator <http://sourceforge.net/projects/pyexcelerator> for export to
|
||||||
excel capability
|
excel capability
|
||||||
|
|
||||||
@@ -54,15 +53,38 @@ Then, just run pyGTKtalog script.
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
For version 1.0 following aims have to be done:
|
||||||
|
|
||||||
- searching database
|
- searching database
|
||||||
- taggin files
|
- tagging files
|
||||||
- files properties
|
- file details:
|
||||||
- adding images
|
- files properties
|
||||||
- generating/saving thumbnails
|
x thumbnail
|
||||||
- command line query support (text output)
|
- 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
|
- internationalization support
|
||||||
- statistics
|
- statistics
|
||||||
- moving hardcoded files extensions into config
|
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
=====
|
=====
|
||||||
@@ -75,3 +97,4 @@ BUGS
|
|||||||
====
|
====
|
||||||
|
|
||||||
All bugs please report to Roman 'gryf' Dobosz <roman.dobosz@gmail.com>
|
All bugs please report to Roman 'gryf' Dobosz <roman.dobosz@gmail.com>
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
<widget class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -451,7 +450,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkExpander" id="expander1">
|
<widget class="GtkExpander" id="keywords">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">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="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>
|
<property name="shrink">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</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>
|
<packing>
|
||||||
<property name="resize">True</property>
|
<property name="resize">True</property>
|
||||||
<property name="shrink">False</property>
|
<property name="shrink">False</property>
|
||||||
@@ -632,56 +728,10 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</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>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox_details">
|
<placeholder/>
|
||||||
<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>
|
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</glade-interface>
|
</glade-interface>
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ from utils import deviceHelper
|
|||||||
from gtkmvc import Controller
|
from gtkmvc import Controller
|
||||||
|
|
||||||
from c_config import ConfigController
|
from c_config import ConfigController
|
||||||
from c_details import DetailsController
|
|
||||||
from views.v_config import ConfigView
|
from views.v_config import ConfigView
|
||||||
from models.m_config import ConfigModel
|
from models.m_config import ConfigModel
|
||||||
|
|
||||||
@@ -50,19 +49,20 @@ class MainController(Controller):
|
|||||||
widgets = (
|
widgets = (
|
||||||
"discs","files",
|
"discs","files",
|
||||||
'save1','save_as1','cut1','copy1','paste1','delete1','add_cd','add_directory1',
|
'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 = (
|
widgets_all = (
|
||||||
"discs","files",
|
"discs","files",
|
||||||
'file1','edit1','add_cd','add_directory1','help1',
|
'file1','edit1','add_cd','add_directory1','help1',
|
||||||
'tb_save','tb_addcd','tb_find','tb_new','tb_open','tb_quit',
|
'tb_save','tb_addcd','tb_find','tb_new','tb_open','tb_quit',
|
||||||
|
'keywords','description',
|
||||||
)
|
)
|
||||||
|
|
||||||
widgets_cancel = ('cancel','cancel1')
|
widgets_cancel = ('cancel','cancel1')
|
||||||
|
|
||||||
def __init__(self, model):
|
def __init__(self, model):
|
||||||
"""Initialize controller"""
|
"""Initialize controller"""
|
||||||
Controller.__init__(self, model)
|
Controller.__init__(self, model)
|
||||||
self.details = DetailsController(model.details)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def register_view(self, view):
|
def register_view(self, view):
|
||||||
@@ -115,11 +115,9 @@ class MainController(Controller):
|
|||||||
if self.model.filename != None:
|
if self.model.filename != None:
|
||||||
self.__activateUI(self.model.filename)
|
self.__activateUI(self.model.filename)
|
||||||
|
|
||||||
# register detail subview
|
|
||||||
#self.view.create_sub_view(self.details)
|
|
||||||
|
|
||||||
# generate recent menu
|
# generate recent menu
|
||||||
self.__generate_recent_menu()
|
self.__generate_recent_menu()
|
||||||
|
|
||||||
# Show main window
|
# Show main window
|
||||||
self.view['main'].show();
|
self.view['main'].show();
|
||||||
return
|
return
|
||||||
@@ -277,6 +275,7 @@ class MainController(Controller):
|
|||||||
print "c_main.py: on_files_cursor_changed() directory selected"
|
print "c_main.py: on_files_cursor_changed() directory selected"
|
||||||
else:
|
else:
|
||||||
#file, show what you got.
|
#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)
|
selected_item = self.model.files_list.get_value(model.get_iter(treeview.get_cursor()[0]),0)
|
||||||
self.__get_item_info(selected_item)
|
self.__get_item_info(selected_item)
|
||||||
if __debug__:
|
if __debug__:
|
||||||
@@ -654,10 +653,20 @@ class MainController(Controller):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def __get_item_info(self, item):
|
def __get_item_info(self, item):
|
||||||
'''self.view['details'].show()
|
self.view['description'].show()
|
||||||
txt = self.model.get_file_info(item)
|
set = self.model.get_file_info(item)
|
||||||
buf = self.view['details'].get_buffer()
|
|
||||||
buf.set_text(txt)
|
buf = self.view['description'].get_buffer()
|
||||||
self.view['details'].set_buffer(buf)'''
|
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
|
return
|
||||||
pass # end of class
|
pass # end of class
|
||||||
|
|||||||
@@ -426,15 +426,23 @@ class MainModel(ModelMT):
|
|||||||
|
|
||||||
def get_file_info(self, id):
|
def get_file_info(self, id):
|
||||||
"""get file info from database"""
|
"""get file info from database"""
|
||||||
self.db_cursor.execute("SELECT filename, date, size, type \
|
retval = {}
|
||||||
FROM files WHERE id = ?", (id,))
|
self.db_cursor.execute("SELECT filename, date, size, type, filetype, \
|
||||||
|
id FROM files WHERE id = ?", (id,))
|
||||||
set = self.db_cursor.fetchone()
|
set = self.db_cursor.fetchone()
|
||||||
if set == None:
|
if set:
|
||||||
return ''
|
|
||||||
|
|
||||||
string = "Filename: %s\nDate: %s\nSize: %s\ntype: %s" % \
|
string = "Filename: %s\nDate: %s\nSize: %s\ntype: %s" % \
|
||||||
(set[0], datetime.fromtimestamp(set[1]), set[2], set[3])
|
(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):
|
def get_source(self, path):
|
||||||
"""get source of top level directory"""
|
"""get source of top level directory"""
|
||||||
|
|||||||
@@ -34,13 +34,11 @@ class MainView(View):
|
|||||||
GLADE = os.path.join(utils.globals.GLADE_DIR, "main.glade")
|
GLADE = os.path.join(utils.globals.GLADE_DIR, "main.glade")
|
||||||
def __init__(self, ctrl):
|
def __init__(self, ctrl):
|
||||||
View.__init__(self, ctrl, self.GLADE)
|
View.__init__(self, ctrl, self.GLADE)
|
||||||
self.details = None
|
|
||||||
|
# hide v2.0 features
|
||||||
|
self['separatormenuitem4'].hide()
|
||||||
|
self['list1'].hide()
|
||||||
|
self['thumbnails1'].hide()
|
||||||
return
|
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
|
pass # end of class
|
||||||
|
|||||||
Reference in New Issue
Block a user