mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
* Added widget for so called "tag cloud".
This commit is contained in:
6
README
6
README
@@ -21,7 +21,6 @@ pyGTKtalog is written in python with following dependencies:
|
|||||||
|
|
||||||
- pygtk <http://www.pygtk.org>
|
- pygtk <http://www.pygtk.org>
|
||||||
- pysqlite2 <http://pysqlite.org/> (unnecessary, if python 2.5 is used)
|
- pysqlite2 <http://pysqlite.org/> (unnecessary, if python 2.5 is used)
|
||||||
# - mx.DateTime <http://www.egenix.com>
|
|
||||||
|
|
||||||
Optional modules:
|
Optional modules:
|
||||||
|
|
||||||
@@ -57,6 +56,11 @@ For version 1.0 following aims have to be done:
|
|||||||
|
|
||||||
- searching database
|
- searching database
|
||||||
- tagging files
|
- tagging files
|
||||||
|
- filetypes handling
|
||||||
|
- movies
|
||||||
|
- images
|
||||||
|
- archives
|
||||||
|
- documents
|
||||||
- file details:
|
- file details:
|
||||||
- files properties
|
- files properties
|
||||||
x thumbnail
|
x thumbnail
|
||||||
|
|||||||
@@ -68,11 +68,6 @@ def check_requirements():
|
|||||||
except:
|
except:
|
||||||
print "pyGTKtalog uses SQLite DB.\nYou'll need to get it and the python bindings as well.\nhttp://www.sqlite.org\nhttp://initd.org/tracker/pysqlite"
|
print "pyGTKtalog uses SQLite DB.\nYou'll need to get it and the python bindings as well.\nhttp://www.sqlite.org\nhttp://initd.org/tracker/pysqlite"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
#try:
|
|
||||||
# import mx.DateTime
|
|
||||||
#except:
|
|
||||||
# print "pyGTKtalog uses Egenix mx.DateTime.\nYou can instal it from your distribution repositry,\nor get it at: http://www.egenix.com"
|
|
||||||
# sys.exit(1)
|
|
||||||
|
|
||||||
if conf.confd['exportxls']:
|
if conf.confd['exportxls']:
|
||||||
try:
|
try:
|
||||||
@@ -93,7 +88,7 @@ def get_parameters():
|
|||||||
"""Determine application command line options, return db full pathname"""
|
"""Determine application command line options, return db full pathname"""
|
||||||
import sys, os
|
import sys, os
|
||||||
# if we've got two arguments, shell script passed through command line
|
# if we've got two arguments, shell script passed through command line
|
||||||
# options: current path and probably filename of compressed db
|
# options: current path and probably filename of compressed collection
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
return os.path.join(sys.argv[1],sys.argv[2])
|
return os.path.join(sys.argv[1],sys.argv[2])
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -429,6 +429,11 @@
|
|||||||
<widget class="GtkVBox" id="vbox2">
|
<widget class="GtkVBox" id="vbox2">
|
||||||
<property name="visible">True</property>
|
<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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVPaned" id="vpaned2">
|
||||||
|
<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>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -448,6 +453,10 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="resize">True</property>
|
||||||
|
<property name="shrink">True</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkExpander" id="keywords">
|
<widget class="GtkExpander" id="keywords">
|
||||||
@@ -462,12 +471,13 @@
|
|||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="tags">
|
<widget class="GtkTextView" id="keyword_textview">
|
||||||
<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>
|
||||||
<property name="headers_clickable">True</property>
|
<property name="editable">False</property>
|
||||||
<property name="rules_hint">True</property>
|
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||||
|
<property name="cursor_visible">False</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -484,14 +494,15 @@
|
|||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="resize">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="shrink">False</property>
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">True</property>
|
||||||
<property name="shrink">True</property>
|
<property name="shrink">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
@@ -589,11 +600,8 @@
|
|||||||
<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>
|
||||||
<property name="border_width">3</property>
|
|
||||||
<property name="editable">False</property>
|
<property name="editable">False</property>
|
||||||
<property name="wrap_mode">GTK_WRAP_CHAR</property>
|
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||||
<property name="left_margin">3</property>
|
|
||||||
<property name="right_margin">3</property>
|
|
||||||
<property name="cursor_visible">False</property>
|
<property name="cursor_visible">False</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@@ -669,4 +669,30 @@ class MainController(Controller):
|
|||||||
else:
|
else:
|
||||||
self.view['thumb'].hide()
|
self.view['thumb'].hide()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def __tag_cloud(self):
|
||||||
|
"""generate tag cloud"""
|
||||||
|
# TODO: checkit!
|
||||||
|
def tag_cloud_click(tag, textview, event, iter, e):
|
||||||
|
"""react on click on connected tag items"""
|
||||||
|
if event.type == gtk.gdk.BUTTON_RELEASE:
|
||||||
|
print tag.get_property('name')
|
||||||
|
|
||||||
|
def insert_blank(b, iter):
|
||||||
|
if b.is_end() and b.is_start():
|
||||||
|
iter = b.get_end_iter()
|
||||||
|
else:
|
||||||
|
b.insert(iter, " ")
|
||||||
|
iter = b.get_end_iter()
|
||||||
|
return iter
|
||||||
|
|
||||||
|
if len(self.model.tag_cloud) > 0:
|
||||||
|
buff = self.view['keyword_textview'].get_buffer()
|
||||||
|
for cloud in self.model.tag_cloud:
|
||||||
|
iter = insert_blank(buff, buff.get_end_iter())
|
||||||
|
tag = buff.create_tag(cloud['id'])
|
||||||
|
tag.set_property('size-points', cloud['size'])
|
||||||
|
tag.connect('event', foo, tag)
|
||||||
|
buff.insert_with_tags(iter, cloud['name'], tag)
|
||||||
|
self.view['keyword_textview'].set_buffer(buff)
|
||||||
pass # end of class
|
pass # end of class
|
||||||
|
|||||||
@@ -259,10 +259,7 @@ class MainModel(ModelMT):
|
|||||||
gobject.TYPE_UINT64,
|
gobject.TYPE_UINT64,
|
||||||
gobject.TYPE_STRING, gobject.TYPE_INT,
|
gobject.TYPE_STRING, gobject.TYPE_INT,
|
||||||
gobject.TYPE_STRING, str)
|
gobject.TYPE_STRING, str)
|
||||||
# Tag list: id, name, count
|
self.tag_cloud = []
|
||||||
self.tags_list = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING,
|
|
||||||
gobject.TYPE_UINT64, str)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
@@ -475,16 +472,9 @@ class MainModel(ModelMT):
|
|||||||
|
|
||||||
# private class functions
|
# private class functions
|
||||||
def __clear_trees(self):
|
def __clear_trees(self):
|
||||||
self.__clear_tags_tree()
|
|
||||||
self.__clear_files_tree()
|
self.__clear_files_tree()
|
||||||
self.__clear_discs_tree()
|
self.__clear_discs_tree()
|
||||||
|
|
||||||
def __clear_tags_tree(self):
|
|
||||||
try:
|
|
||||||
self.tags_list.clear()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __clear_discs_tree(self):
|
def __clear_discs_tree(self):
|
||||||
try:
|
try:
|
||||||
self.discs_tree.clear()
|
self.discs_tree.clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user