More pylint improvements
This commit is contained in:
parent
3c7e357bd1
commit
3255904acc
@ -35,23 +35,7 @@ import time
|
||||
import copy
|
||||
import subprocess
|
||||
from urllib.parse import urlparse
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# set up logging
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import logging
|
||||
LOG = logging.getLogger(".DbManager")
|
||||
|
||||
from gramps.gen.constfunc import win
|
||||
if win():
|
||||
_RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
|
||||
if _RCS_FOUND and "TZ" not in os.environ:
|
||||
# RCS requires the "TZ" variable be set.
|
||||
os.environ["TZ"] = str(time.timezone)
|
||||
else:
|
||||
_RCS_FOUND = os.system("rcs -V >/dev/null 2>/dev/null") == 0
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -68,8 +52,6 @@ from gi.repository import Pango
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from gramps.gen.plug import BasePluginManager
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gui.display import display_help
|
||||
from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE
|
||||
from .user import User
|
||||
@ -83,16 +65,33 @@ from .glade import Glade
|
||||
from gramps.gen.db.exceptions import DbException
|
||||
from gramps.gen.config import config
|
||||
from gramps.gui.listmodel import ListModel
|
||||
from gramps.gen.constfunc import win
|
||||
from gramps.gen.plug import BasePluginManager
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
_RETURN = Gdk.keyval_from_name("Return")
|
||||
_KP_ENTER = Gdk.keyval_from_name("KP_Enter")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# set up logging
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
LOG = logging.getLogger(".DbManager")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if win():
|
||||
_RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
|
||||
if _RCS_FOUND and "TZ" not in os.environ:
|
||||
# RCS requires the "TZ" variable be set.
|
||||
os.environ["TZ"] = str(time.timezone)
|
||||
else:
|
||||
_RCS_FOUND = os.system("rcs -V >/dev/null 2>/dev/null") == 0
|
||||
|
||||
_RETURN = Gdk.keyval_from_name("Return")
|
||||
_KP_ENTER = Gdk.keyval_from_name("KP_Enter")
|
||||
|
||||
WIKI_HELP_PAGE = _('%s_-_Manage_Family_Trees') % URL_MANUAL_PAGE
|
||||
WIKI_HELP_SEC = _('Family_Trees_manager_window')
|
||||
|
||||
@ -227,15 +226,14 @@ class DbManager(CLIDbManager):
|
||||
self.top.connect('drag_data_received', self.__drag_data_received)
|
||||
self.top.connect('drag_motion', drag_motion)
|
||||
self.top.connect('drag_drop', drop_cb)
|
||||
self.define_help_button(self.glade.get_object('help'),
|
||||
WIKI_HELP_PAGE, WIKI_HELP_SEC)
|
||||
self.define_help_button(
|
||||
self.glade.get_object('help'), WIKI_HELP_PAGE, WIKI_HELP_SEC)
|
||||
|
||||
if _RCS_FOUND:
|
||||
self.rcs.connect('clicked', self.__rcs)
|
||||
|
||||
def define_help_button(self, button, webpage='', section=''):
|
||||
button.connect('clicked', lambda x: display_help(webpage,
|
||||
section))
|
||||
button.connect('clicked', lambda x: display_help(webpage, section))
|
||||
|
||||
def __button_press(self, obj, event):
|
||||
"""
|
||||
@ -433,7 +431,7 @@ class DbManager(CLIDbManager):
|
||||
If skippath given, the name of skippath is not considered
|
||||
"""
|
||||
iter = self.model.get_iter_first()
|
||||
while (iter):
|
||||
while iter:
|
||||
path = self.model.get_path(iter)
|
||||
if path == skippath:
|
||||
pass
|
||||
@ -598,11 +596,12 @@ class DbManager(CLIDbManager):
|
||||
node = self.model.get_iter(path)
|
||||
filename = self.model.get_value(node, FILE_COL)
|
||||
if self.existing_name(new_text, skippath=path):
|
||||
DbManager.ERROR(_("Could not rename the Family Tree."),
|
||||
DbManager.ERROR(
|
||||
_("Could not rename the Family Tree."),
|
||||
_("Family Tree already exists, choose a unique name."))
|
||||
return
|
||||
old_text, new_text = self.rename_database(filename, new_text)
|
||||
if not (old_text is None):
|
||||
if old_text is not None:
|
||||
rename_filename(old_text, new_text)
|
||||
self.model.set_value(node, NAME_COL, new_text)
|
||||
#scroll to new position
|
||||
@ -858,8 +857,7 @@ class DbManager(CLIDbManager):
|
||||
#First ask user if he is really sure :-)
|
||||
yes_no = QuestionDialog2(
|
||||
_("Repair Family Tree?"),
|
||||
_(
|
||||
"If you click %(bold_start)sProceed%(bold_end)s, Gramps will "
|
||||
_("If you click %(bold_start)sProceed%(bold_end)s, Gramps will "
|
||||
"attempt to recover your Family Tree from the last good "
|
||||
"backup. There are several ways this can cause unwanted "
|
||||
"effects, so %(bold_start)sbackup%(bold_end)s the "
|
||||
@ -934,7 +932,7 @@ class DbManager(CLIDbManager):
|
||||
"""
|
||||
self.msg.set_label(msg)
|
||||
self.top.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
|
||||
while (Gtk.events_pending()):
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
|
||||
def __end_cursor(self):
|
||||
@ -1051,9 +1049,9 @@ def find_revisions(name):
|
||||
continue
|
||||
match = date.match(line)
|
||||
if match:
|
||||
date_str = time.strftime('%x %X',
|
||||
time.strptime(match.groups()[0], '%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
date_str = time.strftime(
|
||||
'%x %X', time.strptime(match.groups()[0],
|
||||
'%Y-%m-%d %H:%M:%S'))
|
||||
get_next = True
|
||||
continue
|
||||
if get_next:
|
||||
@ -1114,8 +1112,7 @@ def check_in(dbase, filename, user, cursor_func = None):
|
||||
|
||||
if not os.path.isfile(archive_name):
|
||||
cmd = init + [archive_name]
|
||||
proc = subprocess.Popen(cmd,
|
||||
stderr = subprocess.PIPE)
|
||||
proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||
status = proc.wait()
|
||||
message = "\n".join(proc.stderr.readlines())
|
||||
proc.stderr.close()
|
||||
@ -1141,8 +1138,7 @@ def check_in(dbase, filename, user, cursor_func = None):
|
||||
cursor_func(_("Saving archive..."))
|
||||
|
||||
cmd = ci_cmd + ['-m%s' % comment, filename, archive_name]
|
||||
proc = subprocess.Popen(cmd,
|
||||
stderr = subprocess.PIPE)
|
||||
proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||
|
||||
status = proc.wait()
|
||||
message = "\n".join(proc.stderr.readlines())
|
||||
|
Loading…
x
Reference in New Issue
Block a user