Ejemplo n.º 1
0
def SendToInstance(files):
    config = BaseConfigStore('instance')
    port = config.get('server', 'port')
    if not port:
        return False
    try:
        sock = socket.create_connection(('127.0.0.1', int(port)), timeout=1000)
    except ConnectionRefusedError:
        return False
    for path in files:
        data = os.path.abspath(path).encode('utf-8') + b'\n'
        sock.sendall(data)
    sock.close()
    return True
Ejemplo n.º 2
0
 def __init__(self, *arg, **kw):
     super(InstanceServer, self).__init__(*arg, **kw)
     config = BaseConfigStore('instance')
     self.newConnection.connect(self.new_connection)
     if not self.listen(QtNetwork.QHostAddress.LocalHost):
         logger.error('Failed to start instance server:',
                      self.errorString())
         return
     config.set('server', 'port', self.serverPort())
     config.save()
Ejemplo n.º 3
0
import logging
import sys

from photini.configstore import BaseConfigStore

logger = logging.getLogger(__name__)

# workaround for Qt bug affecting QtWebEngine
# https://bugreports.qt.io/browse/QTBUG-67537
if sys.platform.startswith('linux'):
    import ctypes
    import ctypes.util
    ctypes.CDLL(ctypes.util.find_library('GL'), ctypes.RTLD_GLOBAL)

# temporarily open config file to get any over-rides
config = BaseConfigStore('editor')
config.delete('pyqt', 'using_pyqt5')
using_pyside2 = config.get('pyqt', 'using_pyside2', 'auto')
using_qtwebengine = config.get('pyqt', 'using_qtwebengine', 'auto')

if using_pyside2 == 'auto':
    using_pyside2 = False
    try:
        from PyQt5 import QtCore
    except ImportError:
        try:
            from PySide2 import QtCore
            using_pyside2 = True
        except ImportError:
            pass
else:
Ejemplo n.º 4
0
##  General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program.  If not, see
##  <http://www.gnu.org/licenses/>.

from __future__ import unicode_literals

from collections import namedtuple
import re
import six

from photini.configstore import BaseConfigStore

# temporarily open config file to get any over-rides
config = BaseConfigStore('editor')
using_pyqt5 = config.get('pyqt', 'using_pyqt5', 'auto') != 'False'
using_qtwebengine = config.get('pyqt', 'using_qtwebengine', 'auto') != 'False'
config.save()
del config

if using_pyqt5:
    try:
        from PyQt5 import QtCore
    except ImportError:
        using_pyqt5 = False

if using_pyqt5:
    from PyQt5 import QtGui, QtWidgets
    from PyQt5.QtCore import Qt
    from PyQt5.QtNetwork import QNetworkProxy
Ejemplo n.º 5
0
from collections import namedtuple
from contextlib import contextmanager
from functools import wraps
import importlib
import logging
import os
import re
import sys

from photini.configstore import BaseConfigStore

logger = logging.getLogger(__name__)

# temporarily open config file to get any over-rides
config = BaseConfigStore('editor')
config.delete('pyqt', 'using_pyqt5')
using_pyside = config.get('pyqt', 'using_pyside2')
config.delete('pyqt', 'using_pyside2')
using_qtwebengine = config.get('pyqt', 'using_qtwebengine', 'auto')
qt_lib = config.get('pyqt', 'qt_lib', 'auto')
if qt_lib == 'auto' and isinstance(using_pyside, bool):
    # copy old config
    qt_lib = ('PyQt5', 'PySide2')[using_pyside]
    config.set('pyqt', 'qt_lib', qt_lib)
qt_scale_factor = config.get('pyqt', 'scale_factor', 1)
if qt_scale_factor != 1:
    os.environ['QT_SCALE_FACTOR'] = str(qt_scale_factor)

# choose Qt package
if qt_lib == 'auto':