[pybliographer] Make tab/spaces consistent
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer] Make tab/spaces consistent
- Date: Tue, 30 Jul 2013 23:14:16 +0000 (UTC)
commit 3dbb3226c9edc46f5d8a93512411149236beeba1
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Tue Apr 23 20:35:00 2013 -0700
Make tab/spaces consistent
Remove trailing spaces and make everything space
Signed-off-by: Germán Poo-Caamaño <gpoo gnome org>
Pyblio/GnomeUI/Index.py | 180 +++++++++++++++++++++++-----------------------
1 files changed, 90 insertions(+), 90 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Index.py b/Pyblio/GnomeUI/Index.py
index ab9d2bb..66c36fc 100644
--- a/Pyblio/GnomeUI/Index.py
+++ b/Pyblio/GnomeUI/Index.py
@@ -1,23 +1,23 @@
# This file is part of pybliographer
-#
+#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry pybliographer org
-#
+#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
+# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
+# GNU General Public License for more details.
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#
+#
+#
# TO FIX
@@ -53,12 +53,12 @@ _safechar = ''.join (_safechar)
class Index (Connector.Publisher):
''' Graphical index of an iterator '''
-
+
def __init__ (self, fields = None, popup = None):
''' Creates a new list of entries '''
self._w_popup = popup
-
+
fields = fields or Config.get ('gnome/columns').data
self.fields = map (lower, fields)
@@ -70,16 +70,16 @@ class Index (Connector.Publisher):
self.selinfo = self.list.get_selection ()
self.selinfo.set_mode (gtk.SELECTION_MULTIPLE)
- i = 0
+ i = 0
self.gvpixbuf = gtk.gdk.pixbuf_new_from_file(
- os.path.join (version.datadir, 'pixmaps', 'pybliographic-viewer.png'))
- if True:
- rend = gtk.CellRendererPixbuf ()
- col = gtk.TreeViewColumn ('P', rend, pixbuf = len(fields))
- col.set_fixed_width (22)
- self.list.append_column (col)
- i += 1
-
+ os.path.join (version.datadir, 'pixmaps', 'pybliographic-viewer.png'))
+ if True:
+ rend = gtk.CellRendererPixbuf ()
+ col = gtk.TreeViewColumn ('P', rend, pixbuf = len(fields))
+ col.set_fixed_width (22)
+ self.list.append_column (col)
+ i += 1
+
i, self.prefix_columns = 0, i
for f in fields:
@@ -90,19 +90,19 @@ class Index (Connector.Publisher):
f = self.fields [i]
f = f.translate (_safechar)
-
+
k = '/apps/pybliographic/columns/%s' % f
-
+
w = Utils.config.get_int (k)
if w:
col.set_sizing (gtk.TREE_VIEW_COLUMN_FIXED)
col.set_fixed_width (w)
col.connect ('clicked', self.click_column, i)
-
+
self.list.append_column (col)
i = i + 1
-
+
self.w = gtk.ScrolledWindow ()
self.w.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
@@ -117,31 +117,31 @@ class Index (Connector.Publisher):
self.list.connect ('button-press-event', self.button_press)
# DnD configuration
-
+
targets = (
(Mime.SYM_KEY, 0, Mime.KEY),
(Mime.SYM_ENTRY, 0, Mime.ENTRY),
(Mime.SYM_STRING, 0, Mime.STRING),
(Mime.SYM_TEXT , 0, Mime.STRING),
)
-
+
accept = (
(Mime.SYM_ENTRY, 0, Mime.ENTRY),
)
-
+
self.list.drag_dest_set (gtk.DEST_DEFAULT_ALL, accept,
gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.list.connect ("drag_data_received", self.drag_received)
-
-
+
+
self.list.drag_source_set (gtk.gdk.BUTTON1_MASK | gtk.gdk.BUTTON3_MASK,
targets, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.list.connect ('drag_data_get', self.dnd_drag_data_get)
-
+
# Copy/Paste configuration
-
+
self.selection_buffer = None
-
+
self.list.connect ('selection_received', self.selection_received)
self.list.connect ('selection_get', self.selection_get)
self.list.connect ('selection_clear_event', self.selection_clear)
@@ -149,15 +149,15 @@ class Index (Connector.Publisher):
# We handle three selections: one specific to the application,
# the clipboard, and the primary. Therefore, we should be able
# to paste into every kind of editor/application.
-
+
self.list.selection_add_target ("PRIMARY",
Mime.SYM_STRING,
Mime.STRING)
-
+
self.list.selection_add_target ("CLIPBOARD",
Mime.SYM_STRING,
Mime.STRING)
-
+
self.list.selection_add_target (Mime.SYM_APP,
Mime.SYM_ENTRY,
Mime.ENTRY)
@@ -168,13 +168,13 @@ class Index (Connector.Publisher):
self.selection_buffer = None
return
-
+
def selection_received (self, widget, selection, info):
-
+
data = selection.data
-
+
if not data: return
-
+
entries = pickle.loads (data)
self.issue ('drag-received', entries)
return
@@ -185,12 +185,12 @@ class Index (Connector.Publisher):
if not self.selection_buffer: return
if info == Mime.ENTRY:
-
+
text = pickle.dumps (self.selection_buffer)
selection.set (Mime.SYM_ENTRY, 8, text)
elif info == Mime.STRING:
-
+
if Config.get ('gnome/paste-key').data:
# if we want the keys, return the keys !
keys = []
@@ -202,7 +202,7 @@ class Index (Connector.Publisher):
text = join (map (str, self.selection_buffer), '\n\n')
selection.set ("STRING", 8, text)
-
+
return
@@ -211,7 +211,7 @@ class Index (Connector.Publisher):
self.list.selection_owner_set (Mime.SYM_APP)
self.list.selection_owner_set ("PRIMARY")
self.list.selection_owner_set ("CLIPBOARD")
-
+
self.selection_buffer = entries
return
@@ -221,7 +221,7 @@ class Index (Connector.Publisher):
self.list.selection_convert (Mime.SYM_APP, Mime.SYM_ENTRY)
return
-
+
def drag_received (self, * arg):
selection = arg [4]
info = arg [5]
@@ -232,7 +232,7 @@ class Index (Connector.Publisher):
return
-
+
def dnd_drag_data_get (self, list, context, selection, info, time):
''' send the selected entries as dnd data '''
@@ -249,28 +249,28 @@ class Index (Connector.Publisher):
else:
# else, return the full entries
text = join (map (str, entries), '\n\n')
-
+
selection.set (selection.target, 8, text)
return
-
+
if info == Mime.KEY:
# must return a set of keys
data = join (map (lambda e: str (e.key.base or '') + '\0' +
str (e.key.key), entries), '\n')
selection.set (selection.target, 8, data)
-
+
elif info == Mime.ENTRY:
data = pickle.dumps (entries)
selection.set (selection.target, 8, data)
else:
return
-
+
if context.action == gtk.gdk.ACTION_MOVE:
self.issue ('drag-moved', entries)
-
+
return
-
+
# --------------------------------------------------
def __len__ (self):
@@ -280,12 +280,12 @@ class Index (Connector.Publisher):
def get_item_position (self, item):
- try:
+ try:
return self.access.index (item)
except ValueError:
return -1
-
+
def select_item (self, item):
if type (item) is not type (1):
item = self.get_item_position (item)
@@ -293,33 +293,33 @@ class Index (Connector.Publisher):
if item == -1 or item >= len (self.access): return
path = (item,)
-
+
self.selinfo.select_path (path)
self.list.scroll_to_cell (path)
self.issue ('select-entry', self.access [item])
return
-
-
+
+
def set_scroll (self, item):
if type (item) is not type (1):
item = self.get_item_position (item)
if item == -1: return
-
+
self.list.scroll_to_cell ((item,),
use_align = True,
row_align = .5)
return
-
+
def display (self, iterator):
# clear the access table
self.access = []
Utils.set_cursor (self.w, 'clock')
-
+
self.model.clear ()
for entry in iterator:
@@ -330,49 +330,49 @@ class Index (Connector.Publisher):
for f in self.fields:
row.append (i)
i = i + 1
-
+
if f == '-key-':
row.append ((str (entry.key.key)).decode ('latin-1'))
-
+
elif f == '-type-':
row.append (str (entry.type.name)) ## ascii
-
+
elif f == '-author/editor-':
row.append (userformat.author_editor_format
- (entry).decode ('latin-1'))
+ (entry).decode ('latin-1'))
elif f == '-author/title-':
row.append (userformat.author_title_format
- (entry).decode ('latin-1'))
-
+ (entry).decode ('latin-1'))
+
elif entry.has_key (f):
-
+
if Types.get_field (f).type == Fields.AuthorGroup:
text = join (map (lambda a: str (a.last), entry [f]), ', ')
elif Types.get_field (f).type == Fields.Date:
text = str (entry [f].year)
else:
text = str (entry [f])
-
+
row.append (text.decode ('latin-1'))
else:
row.append ('')
- if True:
- row.append (i)
- if Resource.is_viewable (entry):
- row.append (self.gvpixbuf)
- else:
- row.append (None)
-
+ if True:
+ row.append (i)
+ if Resource.is_viewable (entry):
+ row.append (self.gvpixbuf)
+ else:
+ row.append (None)
+
iter = self.model.append ()
apply (self.model.set, [iter] + row)
-
+
self.access.append (entry)
entry = iterator.next ()
-
+
Utils.set_cursor (self.w, 'normal')
return
@@ -385,7 +385,7 @@ class Index (Connector.Publisher):
q = lower (query)
l = len (q)
i = 0
-
+
for e in self.access:
if not e.has_key (f): continue
@@ -400,17 +400,17 @@ class Index (Connector.Publisher):
# we must be after the entry...
self.set_scroll (i)
return 0
-
+
i = i + 1
# well, show the user its entry must be after the bounds
self.set_scroll (i)
return 0
-
-
+
+
def click_column (self, listcol, column):
''' handler for column title selection '''
-
+
self.issue ('click-on-field', self.fields [column])
return
@@ -419,7 +419,7 @@ class Index (Connector.Publisher):
''' handler for row selection '''
entries = self.selection ()
-## print 'ROW_SELECTED:', [x.key.key for x in entries]
+## print 'ROW_SELECTED:', [x.key.key for x in entries]
if len (entries) > 1:
self.issue ('select-entries', entries)
return
@@ -436,33 +436,33 @@ class Index (Connector.Publisher):
def selection (self):
''' returns the current selection '''
-
+
entries = []
def retrieve (model, path, iter):
entries.append (self.access [path [0]])
self.selinfo.selected_foreach (retrieve)
-
+
return entries
def select_all (self):
''' select all the lines of the index '''
-
+
self.clist.select_all ()
return
-
+
def button_press (self, clist, event, *arg):
''' handler for double-click and right mouse button '''
if not (event.type == gtk.gdk.BUTTON_PRESS and
event.button == 3): return
- self._w_popup.popup (None, None, None, event.button, event.time)
- return
-
+ self._w_popup.popup (None, None, None, event.button, event.time)
+ return
+
def entry_new (self, * arg):
self.issue ('new-entry')
return
@@ -477,7 +477,7 @@ class Index (Connector.Publisher):
def entry_delete (self, * arg):
sel = self.selection ()
if not sel: return
-
+
self.issue ('delete-entry', sel)
return
@@ -491,4 +491,4 @@ class Index (Connector.Publisher):
k = '/apps/pybliographic/columns/%s' % f
Utils.config.set_int (k, w)
- return
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]