GEPS008: Moved constfunc module
svn: r19810
This commit is contained in:
parent
aabc6c05c2
commit
9595af1324
@ -14,7 +14,6 @@ gdirdir=$(prefix)/share/gramps
|
||||
|
||||
gdir_PYTHON = \
|
||||
const.py\
|
||||
constfunc.py\
|
||||
gramps.py\
|
||||
ImgManip.py\
|
||||
LdsUtils.py \
|
||||
|
@ -41,7 +41,7 @@ import locale
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
from constfunc import mac
|
||||
from gen.constfunc import mac
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Public Constants
|
||||
|
12
src/Utils.py
12
src/Utils.py
@ -53,7 +53,7 @@ from gen.locale import codeset
|
||||
import gen.datehandler
|
||||
|
||||
from const import TEMP_DIR, USER_HOME, GRAMPS_UUID, IMAGE_DIR
|
||||
import constfunc
|
||||
from gen.constfunc import mac, win
|
||||
from gen.ggettext import sgettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -134,7 +134,7 @@ def fix_encoding(value, errors='strict'):
|
||||
return unicode(value)
|
||||
except:
|
||||
try:
|
||||
if constfunc.mac():
|
||||
if mac():
|
||||
codeset = locale.getlocale()[1]
|
||||
else:
|
||||
codeset = locale.getpreferredencoding()
|
||||
@ -279,7 +279,7 @@ def encodingdefs():
|
||||
"""
|
||||
pass
|
||||
|
||||
if constfunc.win():
|
||||
if win():
|
||||
# python encoding is ascii, but C functions need to receive the
|
||||
# windows codeset, so convert over to it
|
||||
conv_utf8_tosrtkey = lambda x: locale.strxfrm(x.decode("utf-8").encode(
|
||||
@ -379,7 +379,7 @@ def get_unicode_path_from_file_chooser(path):
|
||||
if not (isinstance(path, str)):
|
||||
return path
|
||||
|
||||
if constfunc.win():
|
||||
if win():
|
||||
# in windows filechooser returns officially utf-8, not filesystemencoding
|
||||
try:
|
||||
return unicode(path)
|
||||
@ -406,7 +406,7 @@ def get_unicode_path_from_env_var(path):
|
||||
if not (isinstance(path, str)):
|
||||
return path
|
||||
|
||||
if constfunc.win():
|
||||
if win():
|
||||
# In Windows path/filename returned from a environment variable is in filesystemencoding
|
||||
try:
|
||||
new_path = unicode(path, sys.getfilesystemencoding())
|
||||
@ -475,7 +475,7 @@ def search_for(name):
|
||||
name = name.split('"')[1]
|
||||
else:
|
||||
name = name.split()[0]
|
||||
if constfunc.win():
|
||||
if win():
|
||||
for i in os.environ['PATH'].split(';'):
|
||||
fname = os.path.join(i, name)
|
||||
if os.access(fname, os.X_OK) and not os.path.isdir(fname):
|
||||
|
@ -55,7 +55,7 @@ LOG = logging.getLogger(".clidbman")
|
||||
import gen.db
|
||||
from gen.plug import BasePluginManager
|
||||
from gen.config import config
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
@ -436,7 +436,7 @@ def time_val(dirpath):
|
||||
if os.path.isfile(meta):
|
||||
tval = os.stat(meta)[9]
|
||||
# This gives creation date in Windows, but correct date in Linux
|
||||
if constfunc.win():
|
||||
if win():
|
||||
# Try to use last modified date instead in Windows
|
||||
# and check that it is later than the creation date.
|
||||
tval_mod = os.stat(meta)[8]
|
||||
|
@ -23,6 +23,7 @@ pkgpythondir = $(datadir)/@PACKAGE@/gen
|
||||
pkgpython_PYTHON = \
|
||||
__init__.py \
|
||||
config.py \
|
||||
constfunc.py \
|
||||
dbstate.py \
|
||||
errors.py \
|
||||
ggettext.py \
|
||||
|
@ -47,14 +47,14 @@ log = logging.getLogger(".gen.datehandler")
|
||||
#-------------------------------------------------------------------------
|
||||
from _dateparser import DateParser
|
||||
from _datedisplay import DateDisplay, DateDisplayEn
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if not constfunc.win():
|
||||
if not win():
|
||||
LANG = locale.getlocale(locale.LC_TIME)[0]
|
||||
else:
|
||||
LANG = locale.getdefaultlocale(locale.LC_TIME)[0]
|
||||
|
@ -64,7 +64,7 @@ from gen.db.dbconst import *
|
||||
from gen.utils.callback import Callback
|
||||
from gen.updatecallback import UpdateCallback
|
||||
from gen.errors import DbError
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
|
||||
_LOG = logging.getLogger(DBLOGNAME)
|
||||
LOG = logging.getLogger(".citation")
|
||||
@ -2004,7 +2004,7 @@ def write_lock_file(name):
|
||||
if not os.path.isdir(name):
|
||||
os.mkdir(name)
|
||||
f = open(os.path.join(name, DBLOCKFN), "w")
|
||||
if constfunc.win():
|
||||
if win():
|
||||
user = os.environ['USERNAME']
|
||||
try:
|
||||
host = os.environ['USERDOMAIN']
|
||||
|
@ -21,7 +21,7 @@
|
||||
# $Id$
|
||||
|
||||
import locale
|
||||
import constfunc
|
||||
from gen.constfunc import mac, win
|
||||
|
||||
"""
|
||||
Some OS environments do not support the locale.nl_langinfo() method
|
||||
@ -132,7 +132,7 @@ try:
|
||||
except:
|
||||
import time
|
||||
|
||||
if constfunc.win() or constfunc.mac():
|
||||
if win() or mac():
|
||||
codeset = locale.getlocale()[1]
|
||||
else:
|
||||
codeset = locale.getpreferredencoding()
|
||||
|
@ -47,7 +47,7 @@ import Utils
|
||||
from gen.plug.docgen import BaseDoc
|
||||
from gen.plug.menu import NumberOption, TextOption, EnumeratedListOption, \
|
||||
BooleanOption
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -87,7 +87,7 @@ _RATIO = [ { 'name' : _("Minimal size"), 'value': "compress" },
|
||||
_NOTELOC = [ { 'name' : _("Top"), 'value' : "t" },
|
||||
{ 'name' : _("Bottom"), 'value' : "b" }]
|
||||
|
||||
if constfunc.win():
|
||||
if win():
|
||||
_DOT_FOUND = Utils.search_for("dot.exe")
|
||||
|
||||
if Utils.search_for("gswin32c.exe") == 1:
|
||||
|
@ -49,7 +49,7 @@ from subprocess import Popen, PIPE
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.mime import mime_type_is_defined
|
||||
import TransUtils
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Load internationalization setup
|
||||
@ -88,7 +88,7 @@ if hasattr(os, "uname"):
|
||||
else:
|
||||
operating_system = sys.platform
|
||||
|
||||
if constfunc.win(): # Windows
|
||||
if win(): # Windows
|
||||
TransUtils.setup_windows_gettext()
|
||||
elif operating_system == 'FreeBSD':
|
||||
try:
|
||||
@ -289,7 +289,7 @@ def show_settings():
|
||||
dotversion_str = 'Graphviz not in system PATH'
|
||||
|
||||
try:
|
||||
if constfunc.win():
|
||||
if win():
|
||||
gsversion_str = Popen(['gswin32c', '--version'], stdout=PIPE).communicate(input=None)[0]
|
||||
else:
|
||||
gsversion_str = Popen(['gs', '--version'], stdout=PIPE).communicate(input=None)[0]
|
||||
|
@ -52,7 +52,7 @@ from gui.display import display_help
|
||||
from gui.managedwindow import ManagedWindow
|
||||
from gen.ggettext import sgettext as _
|
||||
from TransUtils import trans_objclass
|
||||
from constfunc import mac
|
||||
from gen.constfunc import mac
|
||||
from gui.glade import Glade
|
||||
from gui.ddtargets import DdTargets
|
||||
from gui.makefilter import make_filter
|
||||
|
@ -47,8 +47,8 @@ from gui.user import User
|
||||
import logging
|
||||
LOG = logging.getLogger(".DbManager")
|
||||
|
||||
import constfunc
|
||||
if constfunc.win():
|
||||
from 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.
|
||||
|
@ -21,7 +21,7 @@
|
||||
# $Id$
|
||||
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import is_quartz
|
||||
from gen.config import config
|
||||
import locale
|
||||
import os
|
||||
@ -93,7 +93,7 @@ def run_file(file):
|
||||
Open a file or url with the default application. This should work
|
||||
on GNOME, KDE, XFCE, ... as we use a freedesktop application
|
||||
"""
|
||||
if constfunc.is_quartz():
|
||||
if is_quartz():
|
||||
prog = find_binary('open')
|
||||
else:
|
||||
prog = find_binary('xdg-open')
|
||||
|
@ -58,7 +58,7 @@ from gen.errors import WindowActiveError
|
||||
import gen.mime
|
||||
from gui.ddtargets import DdTargets
|
||||
from buttontab import ButtonTab
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
import const
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -487,7 +487,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
self.handle_extra_type(mytype, obj)
|
||||
except pickle.UnpicklingError:
|
||||
#modern file managers provide URI_LIST. For Windows split sel_data.data
|
||||
if constfunc.win():
|
||||
if win():
|
||||
files = sel_data.data.split('\n')
|
||||
else:
|
||||
files = sel_data.get_uris()
|
||||
|
@ -58,7 +58,7 @@ import gobject
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.config import config
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import has_display, win
|
||||
import Utils
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -75,7 +75,7 @@ def register_stock_icons ():
|
||||
from gui.pluginmanager import base_reg_stock_icons
|
||||
|
||||
#iconpath to the base image. The front of the list has highest priority
|
||||
if constfunc.win():
|
||||
if win():
|
||||
iconpaths = [
|
||||
(os.path.join(const.IMAGE_DIR, '48x48'), '.png'),
|
||||
(const.IMAGE_DIR, '.png'),
|
||||
@ -288,7 +288,7 @@ def __startgramps(errors, argparser):
|
||||
try:
|
||||
quit_now = False
|
||||
exit_code = 0
|
||||
if constfunc.has_display():
|
||||
if has_display():
|
||||
Gramps(argparser)
|
||||
else:
|
||||
print("Gramps terminated because of no DISPLAY")
|
||||
|
@ -44,7 +44,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.utils
|
||||
from gen.plug import BasePluginManager, PluginRegister
|
||||
from constfunc import win
|
||||
from gen.constfunc import win
|
||||
from gen.config import config
|
||||
import const
|
||||
|
||||
|
@ -32,7 +32,6 @@ Utility functions that depend on GUI components or for GUI components
|
||||
import os
|
||||
import sys
|
||||
from gen.ggettext import gettext as _
|
||||
import constfunc
|
||||
# gtk is not included here, because this file is currently imported
|
||||
# by code that needs to run without the DISPLAY variable (eg, in
|
||||
# the cli only).
|
||||
@ -49,7 +48,7 @@ import constfunc
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import constfunc
|
||||
from gen.constfunc import has_display, is_quartz, mac, win
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -143,7 +142,7 @@ class ProgressMeter(object):
|
||||
else:
|
||||
self.__cancel_callback = self.handle_cancel
|
||||
|
||||
if constfunc.has_display():
|
||||
if has_display():
|
||||
self.__dialog = gtk.Dialog()
|
||||
else:
|
||||
self.__dialog = CLIDialog()
|
||||
@ -334,13 +333,13 @@ def open_file_with_default_application( file_path ):
|
||||
ErrorDialog(_("Error Opening File"), _("File does not exist"))
|
||||
return
|
||||
|
||||
if constfunc.win():
|
||||
if win():
|
||||
try:
|
||||
os.startfile(norm_path)
|
||||
except WindowsError, msg:
|
||||
ErrorDialog(_("Error Opening File"), str(msg))
|
||||
else:
|
||||
if constfunc.mac():
|
||||
if mac():
|
||||
utility = '/usr/bin/open'
|
||||
else:
|
||||
utility = 'xdg-open'
|
||||
@ -375,7 +374,7 @@ def is_right_click(event):
|
||||
import gtk
|
||||
|
||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
||||
if constfunc.is_quartz():
|
||||
if is_quartz():
|
||||
if (event.button == 3
|
||||
or (event.button == 1 and event.state & gtk.gdk.CONTROL_MASK)):
|
||||
return True
|
||||
|
@ -79,7 +79,7 @@ from gui.pluginmanager import GuiPluginManager
|
||||
from gen.relationship import get_relationship_calculator
|
||||
from gui.displaystate import DisplayState, RecentDocsMenu
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import is_quartz
|
||||
from gen.config import config
|
||||
from gen.errors import WindowActiveError
|
||||
from gui.dialog import (ErrorDialog, WarningDialog, QuestionDialog2,
|
||||
@ -103,7 +103,7 @@ from gen.utils.configmanager import safe_eval
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if constfunc.is_quartz():
|
||||
if is_quartz():
|
||||
try:
|
||||
import gtk_osxapplication as QuartzApp
|
||||
_GTKOSXAPPLICATION = True
|
||||
|
@ -49,7 +49,7 @@ import gtk
|
||||
from gui.views.pageview import PageView
|
||||
from gen.ggettext import sgettext as _
|
||||
from Utils import navigation_label
|
||||
from constfunc import mod_key
|
||||
from gen.constfunc import mod_key
|
||||
|
||||
DISABLED = -1
|
||||
MRU_SIZE = 10
|
||||
|
@ -38,14 +38,14 @@ _LOG = logging.getLogger(".widgets.expandcollapsearrow")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import constfunc
|
||||
from gen.constfunc import has_display
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if constfunc.has_display():
|
||||
if has_display():
|
||||
HAND_CURSOR = gtk.gdk.Cursor(gtk.gdk.HAND2)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -47,14 +47,14 @@ import pango
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import constfunc
|
||||
from gen.constfunc import has_display, win
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if constfunc.has_display():
|
||||
if has_display():
|
||||
HAND_CURSOR = gtk.gdk.Cursor(gtk.gdk.HAND2)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -208,7 +208,7 @@ class GenderLabel(gtk.Label):
|
||||
def __init__(self, text):
|
||||
gtk.Label.__init__(self, text)
|
||||
self.set_alignment(0, 0.5)
|
||||
if constfunc.win():
|
||||
if win():
|
||||
pangoFont = pango.FontDescription('Arial')
|
||||
self.modify_font(pangoFont)
|
||||
self.show()
|
||||
|
@ -60,7 +60,7 @@ from gui.widgets.springseparator import SpringSeparatorAction
|
||||
from gui.spell import Spell
|
||||
from gui.display import display_url
|
||||
from gen.config import config
|
||||
from constfunc import has_display
|
||||
from gen.constfunc import has_display
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -43,7 +43,7 @@ LOG = logging.getLogger(".grampsqml")
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import constfunc
|
||||
from gen.constfunc import has_display
|
||||
from gen.config import config
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -136,7 +136,7 @@ def startqml(errors, argparser):
|
||||
quit_now = False
|
||||
openGL = True
|
||||
exit_code = 0
|
||||
if constfunc.has_display():
|
||||
if has_display():
|
||||
GrampsQML(argparser)
|
||||
else:
|
||||
print("Gramps terminated because of no DISPLAY")
|
||||
|
@ -62,7 +62,7 @@ import gtk
|
||||
from gui.plug.export import WriterOptionBox
|
||||
from ExportXml import XmlWriter
|
||||
import Utils
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -217,7 +217,7 @@ class PackageWriter(object):
|
||||
tarinfo = tarfile.TarInfo('data.gramps')
|
||||
tarinfo.size = len(g.getvalue())
|
||||
tarinfo.mtime = time.time()
|
||||
if not constfunc.win():
|
||||
if not win():
|
||||
tarinfo.uid = os.getuid()
|
||||
tarinfo.gid = os.getgid()
|
||||
g.seek(0)
|
||||
|
@ -61,7 +61,7 @@ import gen.lib
|
||||
from gen.updatecallback import UpdateCallback
|
||||
from gen.db.exceptions import DbWriteFailure
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
from gui.plug.export import WriterOptionBox
|
||||
import libgrampsxml
|
||||
|
||||
@ -1198,7 +1198,7 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
elif self.strip_photos == 2 and (len(path)>0 and os.path.isabs(path)):
|
||||
drive, path = os.path.splitdrive(path)
|
||||
path = path[1:]
|
||||
if constfunc.win():
|
||||
if win():
|
||||
# Always export path with \ replaced with /. Otherwise import
|
||||
# from Windows to Linux of gpkg's path to images does not work.
|
||||
path = path.replace('\\','/')
|
||||
|
@ -52,7 +52,6 @@ from gui.views.navigationview import NavigationView
|
||||
from libformatting import FormattingHelper
|
||||
from gen.errors import WindowActiveError
|
||||
import const
|
||||
import constfunc
|
||||
from gui.managedwindow import ManagedWindow
|
||||
from gen.config import config
|
||||
from gui.editors import EditPlace, EditEvent, EditFamily, EditPerson
|
||||
|
@ -60,7 +60,7 @@ import gtk
|
||||
from gui.views.navigationview import NavigationView
|
||||
from gui.views.bookmarks import PersonBookmarks
|
||||
import Utils
|
||||
import constfunc
|
||||
from gen.constfunc import lin, mac, win
|
||||
from gen.config import config
|
||||
from const import TEMP_DIR
|
||||
|
||||
@ -71,11 +71,11 @@ from const import TEMP_DIR
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
def get_identity():
|
||||
if constfunc.lin():
|
||||
if lin():
|
||||
platform = "X11"
|
||||
elif constfunc.win():
|
||||
elif win():
|
||||
platform = "Windows"
|
||||
elif constfunc.mac():
|
||||
elif mac():
|
||||
platform = "Macintosh"
|
||||
else:
|
||||
platform = "Unknown"
|
||||
|
@ -53,7 +53,7 @@ from gui.utils import open_file_with_default_application
|
||||
from gui.views.listview import ListView
|
||||
from gui.views.treemodels import MediaModel
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
from gen.config import config
|
||||
import Utils
|
||||
from gui.views.bookmarks import MediaBookmarks
|
||||
@ -174,7 +174,7 @@ class MediaView(ListView):
|
||||
if not sel_data:
|
||||
return
|
||||
#modern file managers provide URI_LIST. For Windows split sel_data.data
|
||||
if constfunc.win():
|
||||
if win():
|
||||
files = sel_data.data.split('\n')
|
||||
else:
|
||||
files = sel_data.get_uris()
|
||||
|
@ -62,7 +62,7 @@ import cPickle as pickle
|
||||
from gen.config import config
|
||||
from gui.views.bookmarks import PersonBookmarks
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import is_quartz, win
|
||||
from gui.dialog import RunDatabaseRepair, ErrorDialog
|
||||
import gui.utils
|
||||
|
||||
@ -71,7 +71,7 @@ import gui.utils
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if constfunc.is_quartz():
|
||||
if is_quartz():
|
||||
CAIRO_AVAILABLE = False
|
||||
else:
|
||||
try:
|
||||
@ -176,7 +176,7 @@ class PersonBoxWidgetCairo(_PersonWidgetBase):
|
||||
self.maxlines = maxlines
|
||||
self.hightlight = False
|
||||
self.connect("expose_event", self.expose)
|
||||
if not constfunc.win():
|
||||
if not win():
|
||||
self.connect("realize", self.realize)
|
||||
self.text = ""
|
||||
if self.person:
|
||||
@ -257,7 +257,7 @@ class PersonBoxWidgetCairo(_PersonWidgetBase):
|
||||
witout text.
|
||||
"""
|
||||
# pylint: disable-msg=E1101
|
||||
if constfunc.win():
|
||||
if win():
|
||||
self.context = self.window.cairo_create()
|
||||
self.textlayout = self.context.create_layout()
|
||||
self.textlayout.set_font_description(self.get_style().font_desc)
|
||||
|
@ -89,7 +89,7 @@ from gen.plug.report import utils as ReportUtils
|
||||
from gen.plug.report import MenuReportOptions
|
||||
|
||||
import Utils
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
from gui.thumbnails import get_thumbnail_path, run_thumbnailer
|
||||
import ImgManip
|
||||
import gen.mime
|
||||
@ -5767,7 +5767,7 @@ class IndividualPage(BasePage):
|
||||
newpath = copy_thumbnail(self.report, photo_handle, photo, region)
|
||||
# TODO. Check if build_url_fname can be used.
|
||||
newpath = "/".join(['..']*3 + [newpath])
|
||||
if constfunc.win():
|
||||
if win():
|
||||
newpath = newpath.replace('\\',"/")
|
||||
thumbnailUrl = newpath
|
||||
#snapshot += self.media_link(photo_handle, newpath, '', uplink = True)
|
||||
@ -5775,7 +5775,7 @@ class IndividualPage(BasePage):
|
||||
else:
|
||||
(photoUrl, thumbnailUrl) = self.report.prepare_copy_media(photo)
|
||||
thumbnailUrl = "/".join(['..']*3 + [thumbnailUrl])
|
||||
if constfunc.win():
|
||||
if win():
|
||||
thumbnailUrl = thumbnailUrl.replace('\\',"/")
|
||||
url = self.report.build_url_fname_html(person.handle, "ppl", True)
|
||||
boxbg += self.person_link(url, person, name_style = True, thumbnailUrl = thumbnailUrl)
|
||||
@ -7509,7 +7509,7 @@ class NavWebReport(Report):
|
||||
if up:
|
||||
subdirs = ['..']*3 + subdirs
|
||||
nname = "/".join(subdirs + [fname])
|
||||
if constfunc.win():
|
||||
if win():
|
||||
nname = nname.replace('\\',"/")
|
||||
return nname
|
||||
|
||||
@ -7577,7 +7577,7 @@ class NavWebReport(Report):
|
||||
if not fname:
|
||||
return ""
|
||||
|
||||
if constfunc.win():
|
||||
if win():
|
||||
fname = fname.replace('\\',"/")
|
||||
subdirs = self.build_subdirs(subdir, fname, up)
|
||||
return "/".join(subdirs + [fname])
|
||||
@ -7622,7 +7622,7 @@ class NavWebReport(Report):
|
||||
tarinfo = tarfile.TarInfo(self.cur_fname)
|
||||
tarinfo.size = len(string_io.getvalue())
|
||||
tarinfo.mtime = time.time()
|
||||
if not constfunc.win():
|
||||
if not win():
|
||||
tarinfo.uid = os.getuid()
|
||||
tarinfo.gid = os.getgid()
|
||||
string_io.seek(0)
|
||||
|
@ -51,7 +51,7 @@ log = logging.getLogger(".WebPage")
|
||||
#------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import const
|
||||
import constfunc
|
||||
from gen.constfunc import win
|
||||
from gen.plug.report import Report
|
||||
from gen.plug.report import utils as ReportUtils
|
||||
from gen.plug.report import MenuReportOptions
|
||||
@ -1006,7 +1006,7 @@ class WebCalReport(Report):
|
||||
Imagine we run gramps on Windows (heaven forbits), we don't want to
|
||||
see backslashes in the URL.
|
||||
"""
|
||||
if (constfunc.win()):
|
||||
if win():
|
||||
fname = fname.replace('\\',"/")
|
||||
subdirs = self.build_subdirs(subdir, fname)
|
||||
return (prefix or '') + "/".join(subdirs + [fname])
|
||||
|
Loading…
Reference in New Issue
Block a user