mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Centralize APP_UID definitions
This commit is contained in:
parent
f8202dc3e3
commit
2353d5926e
@ -1,8 +1,10 @@
|
||||
from future_builtins import map
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from future_builtins import map
|
||||
import sys, locale, codecs, os, importlib, collections
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
__appname__ = u'calibre'
|
||||
numeric_version = (2, 78, 0)
|
||||
__version__ = u'.'.join(map(unicode, numeric_version))
|
||||
@ -12,7 +14,6 @@ __author__ = u"Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
Various run time constants.
|
||||
'''
|
||||
|
||||
import sys, locale, codecs, os, importlib, collections
|
||||
|
||||
_plat = sys.platform.lower()
|
||||
iswindows = 'win32' in _plat or 'win64' in _plat
|
||||
@ -34,7 +35,9 @@ isworker = 'CALIBRE_WORKER' in os.environ or 'CALIBRE_SIMPLE_WORKER' in os.envir
|
||||
if isworker:
|
||||
os.environ.pop('CALIBRE_FORCE_ANSI', None)
|
||||
FAKE_PROTOCOL, FAKE_HOST = 'https', 'calibre-internal.invalid'
|
||||
|
||||
VIEWER_APP_UID = 'com.calibre-ebook.viewer'
|
||||
EDITOR_APP_UID = 'com.calibre-ebook.edit-book'
|
||||
MAIN_APP_UID = 'com.calibre-ebook.main-gui'
|
||||
try:
|
||||
preferred_encoding = locale.getpreferredencoding()
|
||||
codecs.lookup(preferred_encoding)
|
||||
|
@ -1,5 +1,6 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -15,7 +16,7 @@ from PyQt5.Qt import QCoreApplication, QIcon, QObject, QTimer
|
||||
from calibre import force_unicode, plugins, prints
|
||||
from calibre.constants import (
|
||||
DEBUG, __appname__, filesystem_encoding, get_portable_base, islinux, isosx,
|
||||
iswindows
|
||||
iswindows, MAIN_APP_UID
|
||||
)
|
||||
from calibre.gui2 import (
|
||||
Application, choose_dir, error_dialog, gprefs, initialize_file_icon_provider,
|
||||
@ -532,7 +533,7 @@ def main(args=sys.argv):
|
||||
# launched from within calibre, as both use calibre-parallel.exe
|
||||
import ctypes
|
||||
try:
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('com.calibre-ebook.main-gui')
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(MAIN_APP_UID)
|
||||
except Exception:
|
||||
pass # Only available on windows 7 and newer
|
||||
|
||||
|
@ -1,28 +1,36 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import (unicode_literals, division, absolute_import,
|
||||
print_function)
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import importlib
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from PyQt5.Qt import QIcon
|
||||
|
||||
from calibre.constants import EDITOR_APP_UID, islinux, iswindows
|
||||
from calibre.gui2 import (
|
||||
Application, decouple, set_gui_prefs, setup_gui_option_parser
|
||||
)
|
||||
from calibre.ptempfile import reset_base_dir
|
||||
from calibre.utils.config import OptionParser
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import sys, os, importlib, time
|
||||
|
||||
from PyQt5.Qt import QIcon
|
||||
|
||||
from calibre.constants import islinux, iswindows
|
||||
from calibre.gui2 import Application, setup_gui_option_parser, decouple, set_gui_prefs
|
||||
from calibre.ptempfile import reset_base_dir
|
||||
from calibre.utils.config import OptionParser
|
||||
|
||||
|
||||
def option_parser():
|
||||
parser = OptionParser(_('''\
|
||||
parser = OptionParser(
|
||||
_(
|
||||
'''\
|
||||
%prog [opts] [path_to_ebook] [name_of_file_inside_book ...]
|
||||
|
||||
Launch the calibre edit book tool. You can optionally also specify the names of
|
||||
files inside the book which will be opened for editing automatically.
|
||||
'''))
|
||||
'''
|
||||
)
|
||||
)
|
||||
setup_gui_option_parser(parser)
|
||||
return parser
|
||||
|
||||
@ -51,7 +59,9 @@ def _run(args, notify=None):
|
||||
# launched from within calibre, as both use calibre-parallel.exe
|
||||
import ctypes
|
||||
try:
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('com.calibre-ebook.edit-book')
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||
EDITOR_APP_UID
|
||||
)
|
||||
except Exception:
|
||||
pass # Only available on windows 7 and newer
|
||||
|
||||
@ -93,6 +103,6 @@ def _run(args, notify=None):
|
||||
def main(args=sys.argv):
|
||||
_run(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
@ -1,29 +1,38 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import traceback, os, sys, functools
|
||||
import functools
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
from functools import partial
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QApplication, Qt, QIcon, QTimer, QByteArray, QSize, QTime, QObject,
|
||||
QPropertyAnimation, QInputDialog, QAction, QModelIndex, pyqtSignal)
|
||||
QAction, QApplication, QByteArray, QIcon, QInputDialog, QModelIndex, QObject,
|
||||
QPropertyAnimation, QSize, Qt, QTime, QTimer, pyqtSignal
|
||||
)
|
||||
|
||||
from calibre.gui2.viewer.ui import Main as MainWindow
|
||||
from calibre.gui2.viewer.toc import TOC
|
||||
from calibre.gui2.widgets import ProgressIndicator
|
||||
from calibre.gui2 import (
|
||||
Application, choose_files, info_dialog, error_dialog,
|
||||
open_url, setup_gui_option_parser)
|
||||
from calibre.ebooks.oeb.iterator.book import EbookIterator
|
||||
from calibre.constants import islinux, filesystem_encoding, DEBUG, iswindows
|
||||
from calibre.utils.config import Config, StringConfig, JSONConfig
|
||||
from calibre.customize.ui import available_input_formats
|
||||
from calibre import as_unicode, force_unicode, isbytestring, prints
|
||||
from calibre.constants import (
|
||||
DEBUG, VIEWER_APP_UID, filesystem_encoding, islinux, iswindows
|
||||
)
|
||||
from calibre.customize.ui import available_input_formats
|
||||
from calibre.ebooks.oeb.iterator.book import EbookIterator
|
||||
from calibre.gui2 import (
|
||||
Application, choose_files, error_dialog, info_dialog, open_url,
|
||||
setup_gui_option_parser
|
||||
)
|
||||
from calibre.gui2.viewer.toc import TOC
|
||||
from calibre.gui2.viewer.ui import Main as MainWindow
|
||||
from calibre.gui2.widgets import ProgressIndicator
|
||||
from calibre.ptempfile import reset_base_dir
|
||||
from calibre.utils.ipc import viewer_socket_address, RC
|
||||
from calibre.utils.config import Config, JSONConfig, StringConfig
|
||||
from calibre.utils.ipc import RC, viewer_socket_address
|
||||
from calibre.utils.localization import canonicalize_lang, get_lang, lang_as_iso639_1
|
||||
from calibre.utils.zipfile import BadZipfile
|
||||
from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1, get_lang
|
||||
|
||||
try:
|
||||
from calibre.utils.monotonic import monotonic
|
||||
except RuntimeError:
|
||||
@ -1240,7 +1249,7 @@ def main(args=sys.argv):
|
||||
# launched from within calibre, as both use calibre-parallel.exe
|
||||
import ctypes
|
||||
try:
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('com.calibre-ebook.viewer')
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(VIEWER_APP_UID)
|
||||
except Exception:
|
||||
pass # Only available on windows 7 and newer
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user