[pybliographer/wip/gtk3] gnomeui: pyflakes
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer/wip/gtk3] gnomeui: pyflakes
- Date: Tue, 10 Oct 2017 18:06:36 +0000 (UTC)
commit e4635e60524f99da14419da0a207d8dc29e33242
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Tue Oct 10 14:00:55 2017 -0300
gnomeui: pyflakes
Pyblio/GnomeUI/Common.py | 3 +--
Pyblio/GnomeUI/Config.py | 6 +++---
Pyblio/GnomeUI/Document.py | 6 +++---
Pyblio/GnomeUI/Editor.py | 16 +++++-----------
Pyblio/GnomeUI/Entry.py | 23 +++++++++--------------
Pyblio/GnomeUI/Fields.py | 6 +++---
Pyblio/GnomeUI/FileSelector.py | 11 ++++-------
Pyblio/GnomeUI/Format.py | 4 +---
Pyblio/GnomeUI/Index.py | 4 ++--
Pyblio/GnomeUI/OpenURL.py | 6 ++----
Pyblio/GnomeUI/Search.py | 10 +++-------
Pyblio/GnomeUI/Sort.py | 5 ++---
12 files changed, 38 insertions(+), 62 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Common.py b/Pyblio/GnomeUI/Common.py
index ff8f14e..2c00dc7 100644
--- a/Pyblio/GnomeUI/Common.py
+++ b/Pyblio/GnomeUI/Common.py
@@ -36,8 +36,8 @@ Class filechooserdialog subclasses Gtk.FileChooserDialog and
RESPONSE_COPY = 1
RESPONSE_VIEW = 2
+from gettext import gettext as _
from gi.repository import GObject, Gtk, Gdk, Pango
-import sys
from Pyblio import Fields, Resource
@@ -53,7 +53,6 @@ class filechooserbutton (Gtk.Button):
def __init__ (self, URL=None, action='enter/edit', parent=None):
GObject.GObject.__init__ (self)
- g_error = GObject.GError ()
self.parent_widget = parent
self.url = URL or Fields.URL ()
self.newuri = None
diff --git a/Pyblio/GnomeUI/Config.py b/Pyblio/GnomeUI/Config.py
index 4926395..4d22c2a 100644
--- a/Pyblio/GnomeUI/Config.py
+++ b/Pyblio/GnomeUI/Config.py
@@ -23,13 +23,13 @@
# TO DO:
# List view troubles
+from gettext import gettext as _
from gi.repository import GObject, Gtk
-import copy, os.path, re, string
+import copy, re, string
from Pyblio.GnomeUI import Utils
-from Pyblio import Config, version
-from Pyblio.Utils import format
+from Pyblio import Config
_map = string.maketrans ('\t\n', ' ')
_cpt = re.compile ('\s+')
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 63afb37..8a1e399 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -34,13 +34,13 @@ from Pyblio.GnomeUI import Index, OpenURL, Search, Utils
from Pyblio.GnomeUI.Sort import SortDialog
from Pyblio.GnomeUI.Medline import MedlineUI
-from Pyblio import Base, Config, Connector, Exceptions, Fields, Open
-from Pyblio import Query, Resource, Selection, Sort, Types, version
+from Pyblio import Config, Connector, Exceptions, Fields, Open
+from Pyblio import Query, Resource, Selection, Sort, version
from Pyblio import Search as SearchCls
import Pyblio.Style.Utils
-import os, string, copy, types, sys, traceback, stat
+import os, string, types, sys, traceback, stat
import cPickle as pickle
diff --git a/Pyblio/GnomeUI/Editor.py b/Pyblio/GnomeUI/Editor.py
index 094041f..7ef2768 100644
--- a/Pyblio/GnomeUI/Editor.py
+++ b/Pyblio/GnomeUI/Editor.py
@@ -24,13 +24,13 @@
# entry editor for more than 50 chars
# added: Note taking widget
-from gettext import gettext as _
+import copy, re, string
+from gettext import gettext as _
from gi.repository import GObject, Gtk, Gdk
-import copy, re, string
-from Pyblio import Base, Config, Connector, Exceptions, Fields, Key, Types
-from Pyblio.GnomeUI import Common, FieldsInfo, FileSelector, Mime, Utils
+from Pyblio import Config, Connector, Exceptions, Fields, Key, Types
+from Pyblio.GnomeUI import FieldsInfo, FileSelector, Mime, Utils
key_re = re.compile("^[\w:_+-.()/]+$")
@@ -650,12 +650,8 @@ class RealEditor (Connector.Publisher):
liststore = self.menu.get_model()
liststore.clear()
- i = 0
- history = 0
for entry in entry_list:
- if entry == self.entry.type: history = i
liststore.append ((entry.name, entry))
- i = i + 1
self.menu.set_model(liststore)
return
@@ -664,8 +660,6 @@ class RealEditor (Connector.Publisher):
self.entry = new
self.update_notebook ()
- return
-
def apply_cb (self, * args):
self.issue ('apply')
@@ -1168,7 +1162,7 @@ class Editor(Connector.Publisher):
if self.native_mode:
return
n = self.editor.notebook
- box = n.get_nth_page(n.get_current_page())
+ n.get_nth_page(n.get_current_page())
def save_size(self):
if not self.editor:
diff --git a/Pyblio/GnomeUI/Entry.py b/Pyblio/GnomeUI/Entry.py
index 967c6c6..61a5b32 100644
--- a/Pyblio/GnomeUI/Entry.py
+++ b/Pyblio/GnomeUI/Entry.py
@@ -19,12 +19,11 @@
#
#
-from gi.repository import Gdk, Gtk, Pango, GObject
-
import string
-from Pyblio.GnomeUI import Utils
-from Pyblio import Config, recode, Fields
+from gettext import gettext as _
+from gi.repository import Gdk, Gtk, Pango, GObject
+from Pyblio import Fields
class Entry:
@@ -100,19 +99,15 @@ class Entry:
def url_open (w, url):
try:
Gtk.show_uri(None, url, Gdk.CURRENT_TIME)
-
except GObject.GError, msg:
-
- d = MessageDialog (None,
- DIALOG_MODAL |
- DIALOG_DESTROY_WITH_PARENT,
- MESSAGE_ERROR,
- BUTTONS_CLOSE,
- _('Cannot open URL:\n%s') % msg)
+ d = Gtk.MessageDialog(None,
+ Gtk.DialogFlags.MODAL |
+ Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
+ _('Cannot open URL:\n%s') % msg)
d.run ()
d.destroy ()
-
- return
button.connect ('clicked', url_open, field.get_url ())
diff --git a/Pyblio/GnomeUI/Fields.py b/Pyblio/GnomeUI/Fields.py
index 384c289..e93c1ae 100644
--- a/Pyblio/GnomeUI/Fields.py
+++ b/Pyblio/GnomeUI/Fields.py
@@ -27,12 +27,13 @@ bibliography '''
# adapt menu item for this dialog
# cleaning up
+from gettext import gettext as _
from gi.repository import GObject, Gtk
-import copy, os, re, string
+import copy, string
-from Pyblio import Config, Fields, Types, version
+from Pyblio import Config, Fields, Types
from Pyblio.GnomeUI import Utils
_typename = {
@@ -183,7 +184,6 @@ class FieldsDialog (Utils.GladeWindow):
m, iter = sel.get_selected()
if iter:
p = self.sfm.convert_iter_to_child_iter(iter)
- data = self.fm[p]
self.name1.set_text(self.fm[p][0])
try:
self.menu1.set_active(self.menu_items.index(self.fm[p][3].type))
diff --git a/Pyblio/GnomeUI/FileSelector.py b/Pyblio/GnomeUI/FileSelector.py
index 978c471..6a54730 100644
--- a/Pyblio/GnomeUI/FileSelector.py
+++ b/Pyblio/GnomeUI/FileSelector.py
@@ -19,15 +19,12 @@
#
#
-import string, os, urlparse
-import gettext
-_ = gettext.gettext
+import os
-from gi.repository import Gtk, GObject, Gdk
+from gettext import gettext as _
+from gi.repository import Gtk, Gdk
-from Pyblio import Open, Types, Base, Fields, Config, Autoload
-
-from Pyblio.GnomeUI import Utils
+from Pyblio import Autoload
class URLFileSelection (Gtk.FileChooserDialog):
diff --git a/Pyblio/GnomeUI/Format.py b/Pyblio/GnomeUI/Format.py
index f45bdbc..860ba18 100644
--- a/Pyblio/GnomeUI/Format.py
+++ b/Pyblio/GnomeUI/Format.py
@@ -24,9 +24,7 @@
''' Defines a Dialog to format a subset of entries as a bibliography '''
-from gi.repository import Gtk
-
-import string, os
+import os
from Pyblio import Connector, version, Autoload
from Pyblio.GnomeUI import Utils
diff --git a/Pyblio/GnomeUI/Index.py b/Pyblio/GnomeUI/Index.py
index 6e12bd4..f7305ae 100644
--- a/Pyblio/GnomeUI/Index.py
+++ b/Pyblio/GnomeUI/Index.py
@@ -38,9 +38,9 @@ from gi.repository import GObject, Gtk, Gdk, GdkPixbuf, Pango
import os.path
-from Pyblio.GnomeUI import FieldsInfo, Mime, Utils
+from Pyblio.GnomeUI import Mime, Utils
-from string import *
+from string import ascii_letters, digits, join, lower
import cPickle
diff --git a/Pyblio/GnomeUI/OpenURL.py b/Pyblio/GnomeUI/OpenURL.py
index ebe75fc..58f91c1 100644
--- a/Pyblio/GnomeUI/OpenURL.py
+++ b/Pyblio/GnomeUI/OpenURL.py
@@ -22,10 +22,8 @@
''' Defines a Dialog to open URL '''
-from gi.repository import GObject
-from gi.repository import Gtk
-
-import string, os
+from gettext import gettext as _
+from gi.repository import Gtk, GObject
from Pyblio import Connector, Autoload
from Pyblio.GnomeUI import Utils
diff --git a/Pyblio/GnomeUI/Search.py b/Pyblio/GnomeUI/Search.py
index 0ddd15d..b6d6371 100644
--- a/Pyblio/GnomeUI/Search.py
+++ b/Pyblio/GnomeUI/Search.py
@@ -22,16 +22,12 @@
""" This module implements the Search dialog """
+import string, re, sys, traceback
-import os
-
+from gettext import gettext as _
from gi.repository import Gdk, Gtk, GObject
-import string, re, sys, traceback, copy
-
-from Pyblio import Types, Search, Config, \
- Connector, TextUI, version
-
+from Pyblio import Types, Search, Config, Connector, TextUI
from Pyblio.GnomeUI import Utils
diff --git a/Pyblio/GnomeUI/Sort.py b/Pyblio/GnomeUI/Sort.py
index a83e7dd..a95a410 100644
--- a/Pyblio/GnomeUI/Sort.py
+++ b/Pyblio/GnomeUI/Sort.py
@@ -22,11 +22,10 @@
''' This module implements a Dialog to define Sort criterions '''
-import os, string
-
+from gettext import gettext as _
from gi.repository import Gtk, GObject, GdkPixbuf
-from Pyblio import Connector, Sort, Config, version
+from Pyblio import Connector, Sort, Config
from Pyblio.GnomeUI import Utils
import cPickle
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]