示例#1
0
def load_ui(caller_filename, ui_relfilename, baseinstance=None):
    '''This is copied from mantidqt.utils.qt and should be deprecated as
    soon as possible.'''
    from qtpy.uic import loadUi, loadUiType  # noqa

    filepath = osp.join(osp.dirname(caller_filename), ui_relfilename)
    if not osp.exists(filepath):
        raise ImportError('File "{}" does not exist'.format(filepath))
    if not osp.isfile(filepath):
        raise ImportError('File "{}" is not a file'.format(filepath))
    if baseinstance is not None:
        return loadUi(filepath, baseinstance=baseinstance)
    else:
        return loadUiType(filepath)
示例#2
0
def load_ui(caller_filename, ui_relfilename, baseinstance=None):
    """Load a ui file assuming it is relative to a given callers filepath. If
    an existing instance is given then the this instance is set as the baseclass
    and the new Ui instance is returned otherwise the loaded Ui class is returned

    :param caller_filename: An absolute path to a file whose basename when
    joined with ui_relfilename gives the full path to the .ui file. Generally
    this called with __file__
    :param ui_relfilename: A relative filepath that when joined with the
    basename of caller_filename gives the absolute path to the .ui file.
    :param baseinstance: An instance of a widget to pass to uic.loadUi
    that becomes the base class rather than a new widget being created.
    :return: A new instance of the form class if baseinstance is given, otherwise
    return the form class
    """
    filepath = osp.join(osp.dirname(caller_filename), ui_relfilename)
    if baseinstance is not None:
        return loadUi(filepath, baseinstance=baseinstance)
    else:
        return loadUiType(filepath)
示例#3
0
import sys
import math

from qtpy import QtWidgets, QtGui, QtCore, uic
from qtpy.QtCore import Qt, QObject, QEvent, Signal
from qtpy.QtCore import QPoint, QRect, QSize
##----------------------------------------------------------------##
def _getModulePath( path ):
	import os.path
	return os.path.dirname( __file__ ) + '/' + path

TimelineForm,BaseClass = uic.loadUiType( _getModulePath('timeline.ui') )


##----------------------------------------------------------------##
_RULER_SIZE = 25
_TRACK_SIZE = 20


##----------------------------------------------------------------##
class TimelineRuler( QtWidgets.QFrame ):
	#BRUSHES
	_brushLine = QtGui.QBrush( QtGui.QColor.fromRgbF( 0,0,0 ) )

	#SIGNALS
	scrollPosChanged  = Signal( float )
	cursorPosChanged  = Signal( float )
	zoomChanged       = Signal( float )

	#BODY
	def __init__( self, parent, scale ):
示例#4
0
import logging
from qtpy import QtWidgets, QtGui, QtCore, uic
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QMessageBox

import threading


##----------------------------------------------------------------##
def _getModulePath(path):
    import os.path
    return os.path.dirname(__file__) + '/' + path


ProcessDialogForm, BaseClass = uic.loadUiType(
    _getModulePath('ProcessDialog.ui'))


class ProcessDialog(QtWidgets.QFrame):
    def __init__(self, *args, **kwargs):
        super(ProcessDialog, self).__init__(*args, **kwargs)
        self.ui = ProcessDialogForm()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Dialog)


def requestProcess(message, **options):
    dialog = ProcessDialog()
示例#5
0
from qtpy import QtWidgets

from qtpy.uic import loadUiType

from vitables.vtsite import ICONDIR
import vitables.utils


__docformat__ = 'restructuredtext'

translate = QtWidgets.QApplication.translate
# This method of the PyQt5.uic module allows for dynamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_SettingsDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__), 'settings_dlg.ui'))[0]


class Preferences(QtWidgets.QDialog, Ui_SettingsDialog):
    """
    Create the Settings dialog.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    """

    def __init__(self):
        """
示例#6
0
from qtpy import QtGui
from qtpy import QtWidgets

from qtpy.uic import loadUiType

import vitables.utils

__docformat__ = 'restructuredtext'

translate = QtWidgets.QApplication.translate
# This method of the PyQt5.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_LinkPropDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__), 'link_prop_dlg.ui'))[0]


class LinkPropDlg(QtWidgets.QDialog, Ui_LinkPropDialog):
    """
    Link properties dialog.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This class displays a simple dialog that shows some properties of
    the selected link: name, path, type and target.

    :Parameter info: a :meth:`vitables.nodeprops.nodeinfo.NodeInfo` instance
示例#7
0
import re

from polyleven import ratio

_SEARCHVIEW_ITEM_LIMIT = 100


# import difflib
##----------------------------------------------------------------##
def getModulePath(path):
    import os.path
    return os.path.dirname(__file__) + '/' + path


SearchViewForm, BaseClass = uic.loadUiType(getModulePath('SearchView.ui'))


##----------------------------------------------------------------##
def _sortMatchScore(e1, e2):
    diff = e2.matchScore - e1.matchScore
    if diff > 0: return 1
    if diff < 0: return -1
    if e2.name > e1.name: return 1
    if e2.name < e1.name: return -1
    return 0


def _keyFuncName(x):
    return x.name

try:
    _encoding = QtGui.QApplication.UnicodeUTF8

    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:

    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)


#qtCreatorFile = "E:/mainwindow.ui" # Enter UI file here.
qtCreatorFile = "mainwindow.ui"
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
# import fft2_py36 as fft


class MyApp(QtGui.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        #Menu and toolbar setting
        self.connect(self.importFile, QtCore.SIGNAL('triggered()'),
                     self.showDialog)
        self.connect(self.resultFile, QtCore.SIGNAL('triggered()'),
                     self.openResult)
        #self.connect(self.resultSave, QtCore.SIGNAL('triggered()'), self.saveFile)
        self.connect(self.exit, QtCore.SIGNAL('triggered()'),
示例#9
0
    if _mockInited:
        mockClass = _MOCK[mockClassName]
        registerObjectEditor(mockClass, editorClass)


@slot('mock.init')
def onMockInited():
    global _mockInited
    _mockInited = True
    for mockClassName, editorClass in list(_mockObjecteEditors.items()):
        mockClass = _MOCK[mockClassName]
        registerObjectEditor(mockClass, editorClass)


##----------------------------------------------------------------##
EntityHeaderBase, BaseClass = uic.loadUiType(getModulePath('EntityHeader.ui'))


def getProtoPath(obj):
    state = obj['PROTO_INSTANCE_STATE']
    return state['proto'] or state['sub_proto']


##----------------------------------------------------------------##
class SceneObjectEditor(CommonObjectEditor):
    def setTarget(self, target):
        introspector = self.getIntrospector()
        self.target = target
        self.grid.setTarget(target)
        if isMockInstance(target, 'Scene'):
            for mgr in list(target.getManagers(target).values()):
示例#10
0
#import numpy as np
from pylsl import StreamInlet, resolve_stream, local_clock
from DE_viewer_dialog import DialogDE
from qtpy import QtGui, QtCore, QtWidgets, uic
import numpy as np

import os

qtCreatorFile = "viewer.ui"  # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(
    os.path.join(os.path.dirname(__file__), qtCreatorFile))


def classifyStreamInlet(streams):
    listStreams = []
    for stream in streams:
        listStreams.append(StreamInlet(stream).info().name())
    return listStreams


class Viewer(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self, selectedStreams, streams, update_rate):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.comboBox_src.currentIndexChanged.connect(
            self.changeDisplayedStream)
        self.inlet = []
        self.storedData = []
        self.storedData.append([])  # All events list
        self.selectedStream = 0  # By default events from all sources are displayed
示例#11
0
    def __init__(self, appName, x86, argTemplate, account, server, ticket,
                 chatServer, language, runDir, wineProgram, wineDebug,
                 winePrefix, hiResEnabled, wineApp, osType, homeDir,
                 iconFileIn, rootDir, crashreceiver, DefaultUploadThrottleMbps,
                 bugurl, authserverurl, supporturl, supportserviceurl,
                 glsticketlifetime, realmName, accountText, parent):

        #Fixes binary path for 64-bit client
        if x86:
            appName = ("x64" + os.sep + appName)

        self.homeDir = homeDir
        self.winLog = QtWidgets.QDialog()
        self.osType = osType
        self.realmName = realmName
        self.accountText = accountText
        self.parent = parent

        uifile = resource_filename(__name__, 'ui' + os.sep + 'winLog.ui')

        self.winLog = QtWidgets.QDialog(parent, QtCore.Qt.FramelessWindowHint)
        Ui_winLog, base_class = uic.loadUiType(uifile)
        self.uiLog = Ui_winLog()
        self.uiLog.setupUi(self.winLog)

        if self.osType.usingWindows:
            self.winLog.setWindowTitle("Output")
        else:
            if wineApp == "Wine":
                self.winLog.setWindowTitle("Launch Game - Wine output")
            else:
                self.winLog.setWindowTitle("Launch Game - Crossover output")

        # self.uiLog.btnStart.setVisible(False)
        self.uiLog.btnStart.setText("Launcher")
        self.uiLog.btnStart.setEnabled(False)
        self.uiLog.btnSave.setText("Save")
        self.uiLog.btnSave.setEnabled(False)
        self.uiLog.btnStop.setText("Exit")
        self.uiLog.btnStart.clicked.connect(self.btnStartClicked)
        self.uiLog.btnSave.clicked.connect(self.btnSaveClicked)
        self.uiLog.btnStop.clicked.connect(self.btnStopClicked)

        self.aborted = False
        self.finished = False
        self.command = ""
        self.arguments = []

        gameParams = argTemplate.replace("{SUBSCRIPTION}", account).replace("{LOGIN}", server)\
            .replace("{GLS}", ticket).replace("{CHAT}", chatServer).replace("{LANG}", language)\
            .replace("{CRASHRECEIVER}", crashreceiver).replace("{UPLOADTHROTTLE}", DefaultUploadThrottleMbps)\
            .replace("{BUGURL}", bugurl).replace("{AUTHSERVERURL}", authserverurl)\
            .replace("{GLSTICKETLIFETIME}", glsticketlifetime).replace("{SUPPORTURL}", supporturl)\
            .replace("{SUPPORTSERVICEURL}", supportserviceurl)

        if not hiResEnabled:
            gameParams = gameParams + " --HighResOutOfDate"

        if wineDebug != "":
            os.environ["WINEDEBUG"] = wineDebug

        if winePrefix != "" and wineApp == "Wine":
            os.environ["WINEPREFIX"] = winePrefix

        self.process = QtCore.QProcess()
        self.process.readyReadStandardOutput.connect(self.readOutput)
        self.process.readyReadStandardError.connect(self.readErrors)
        self.process.finished.connect(self.resetButtons)

        if wineApp == "Native":
            self.command = appName
            self.process.setWorkingDirectory(runDir)

            os.chdir(runDir)

            for arg in gameParams.split(" "):
                self.arguments.append(arg)

        elif wineApp == "Wine":
            self.command = wineProgram
            self.process.setWorkingDirectory(runDir)

            self.arguments.append(appName)

            for arg in gameParams.split(" "):
                self.arguments.append(arg)

        elif wineApp == "CXGames":
            if not self.osType.startCXG():
                self.uiLog.txtLog.append(
                    "<b>Error: Couldn't start Crossover Games</b>")
                self.uiLog.btnSave.setEnabled(False)
                self.uiLog.btnStart.setEnabled(False)

            if self.osType.macPathCX == "":
                tempFile = "%s%s%s" % (self.osType.globalDir,
                                       self.osType.directoryCXG, wineProgram)

                if os.path.isfile(tempFile):
                    self.command = tempFile
                else:
                    tempFile = "%s%s%s" % (homeDir, self.osType.directoryCXG,
                                           wineProgram)

                    if os.path.isfile(tempFile):
                        self.command = tempFile
                    else:
                        self.command = wineProgram
            else:
                self.command = "%s%s" % (self.osType.macPathCX, wineProgram)

            self.process.setWorkingDirectory(runDir)

            tempArg = "--bottle %s --verbose -- %s %s" % (winePrefix, appName,
                                                          gameParams)
            for arg in tempArg.split(" "):
                self.arguments.append(arg)
        elif wineApp == "CXOffice":
            if not self.osType.startCXO():
                self.uiLog.txtLog.append(
                    "<b>Error: Couldn't start Crossover</b>")
                self.uiLog.btnSave.setEnabled(False)
                self.uiLog.btnStart.setEnabled(False)

            if self.osType.macPathCX == "":
                tempFile = "%s%s%s" % (self.osType.globalDir,
                                       self.osType.directoryCXO, wineProgram)

                if os.path.isfile(tempFile):
                    self.command = tempFile
                else:
                    tempFile = "%s%s%s" % (homeDir, self.osType.directoryCXO,
                                           wineProgram)

                    if os.path.isfile(tempFile):
                        self.command = tempFile
                    else:
                        self.command = wineProgram
            else:
                self.command = "%s%s" % (self.osType.macPathCX, wineProgram)

            self.process.setWorkingDirectory(runDir)

            tempArg = "--bottle %s --verbose -- %s %s" % (winePrefix, appName,
                                                          gameParams)
            for arg in tempArg.split(" "):
                self.arguments.append(arg)

        self.uiLog.txtLog.append("Connecting to server: " + realmName)
        self.uiLog.txtLog.append("Account: " + accountText)
        self.uiLog.txtLog.append("Game Directory: " + runDir)
        self.uiLog.txtLog.append("Game Client: " + appName)
示例#12
0
import numpy
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.uic import loadUiType


__docformat__ = 'restructuredtext'

translate = QtWidgets.QApplication.translate

# This method of the PyQt5.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_QueryDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__), 'query_dlg.ui'))[0]

log = logging.getLogger(__name__)


class QueryDlg(QtWidgets.QDialog, Ui_QueryDialog):
    """
    A dialog for filtering `tables.Table` nodes.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    The dialog layout looks like this::
示例#13
0
    def __init__(self, urlPatchServer, prodCode, language, runDir, patchClient,
                 wineProgram, hiResEnabled, iconFileIn, homeDir, winePrefix,
                 wineApp, osType, rootDir, parent):

        self.homeDir = homeDir
        self.winLog = QtWidgets.QDialog()
        self.osType = osType

        self.winLog = QtWidgets.QDialog(parent, QtCore.Qt.FramelessWindowHint)

        uifile = resource_filename(__name__, 'ui' + os.sep + 'winPatch.ui')
        Ui_winLog, base_class = uic.loadUiType(uifile)
        self.uiLog = Ui_winLog()
        self.uiLog.setupUi(self.winLog)

        if self.osType.usingWindows:
            self.winLog.setWindowTitle("Output")
        else:
            if wineApp == "Wine":
                self.winLog.setWindowTitle("Patch - Wine output")
            else:
                self.winLog.setWindowTitle("Patch - Crossover output")

        self.uiLog.btnSave.setText("Save Log")
        self.uiLog.btnSave.setEnabled(False)
        self.uiLog.progressBar.reset()
        self.uiLog.btnStop.setText("Launcher")
        self.uiLog.btnStart.setText("Patch")
        self.uiLog.btnSave.clicked.connect(self.btnSaveClicked)
        self.uiLog.btnStop.clicked.connect(self.btnStopClicked)
        self.uiLog.btnStart.clicked.connect(self.btnStartClicked)

        self.aborted = False
        self.finished = True
        self.lastRun = False
        self.command = ""
        self.arguments = []

        self.progressMonitor = ProgressMonitor(self.uiLog)

        if winePrefix != "" and wineApp == "Wine":
            os.environ["WINEPREFIX"] = winePrefix

        self.process = QtCore.QProcess()
        self.process.readyReadStandardOutput.connect(self.readOutput)
        self.process.readyReadStandardError.connect(self.readErrors)
        self.process.finished.connect(self.processFinished)

        if wineApp == "Native":
            patchParams = "%s,Patch %s --language %s --productcode %s" % (
                patchClient, urlPatchServer, language, prodCode)

            if hiResEnabled:
                patchParams = patchParams + " --highres"

            self.command = "rundll32.exe"
            self.process.setWorkingDirectory(runDir)

            for arg in patchParams.split(" "):
                self.arguments.append(arg)

        elif wineApp == "Wine":
            patchParams = "rundll32.exe %s,Patch %s --language %s --productcode %s" % (
                patchClient, urlPatchServer, language, prodCode)

            if hiResEnabled:
                patchParams = patchParams + " --highres"

            self.command = wineProgram
            self.process.setWorkingDirectory(runDir)

            for arg in patchParams.split(" "):
                self.arguments.append(arg)

        else:
            tempArg = ("--bottle %s --cx-app rundll32.exe --verbose " +
                       "%s,Patch %s --language %s --productcode %s") % (
                           winePrefix, patchClient, urlPatchServer, language,
                           prodCode)

            if hiResEnabled:
                tempArg = tempArg + " --highres"

            for arg in tempArg.split(" "):
                self.arguments.append(arg)

            self.process.setWorkingDirectory(runDir)

            if wineApp == "CXGames":
                if not self.osType.startCXG():
                    self.uiLog.txtLog.append(
                        "<b>Error: Couldn't start Crossover Games</b>")
                    self.uiLog.btnSave.setEnabled(False)
                    self.uiLog.btnStart.setEnabled(False)

                if self.osType.macPathCX == "":
                    tempFile = "%s%s%s" % (self.osType.globalDir,
                                           self.osType.directoryCXG,
                                           wineProgram)

                    if os.path.isfile(tempFile):
                        self.command = tempFile
                    else:
                        tempFile = "%s%s%s" % (
                            homeDir, self.osType.directoryCXG, wineProgram)

                        if os.path.isfile(tempFile):
                            self.command = tempFile
                        else:
                            self.command = wineProgram
                else:
                    self.command = "%s%s" % (self.osType.macPathCX,
                                             wineProgram)
            elif wineApp == "CXOffice":
                if not self.osType.startCXO():
                    self.uiLog.txtLog.append(
                        "<b>Error: Couldn't start Crossover</b>")
                    self.uiLog.btnSave.setEnabled(False)
                    self.uiLog.btnStart.setEnabled(False)

                if self.osType.macPathCX == "":
                    tempFile = "%s%s%s" % (self.osType.globalDir,
                                           self.osType.directoryCXO,
                                           wineProgram)

                    if os.path.isfile(tempFile):
                        self.command = tempFile
                    else:
                        tempFile = "%s%s%s" % (
                            homeDir, self.osType.directoryCXO, wineProgram)

                        if os.path.isfile(tempFile):
                            self.command = tempFile
                        else:
                            self.command = wineProgram
                else:
                    self.command = "%s%s" % (self.osType.macPathCX,
                                             wineProgram)

        self.file_arguments = self.arguments.copy()
        self.file_arguments.append("--filesonly")
示例#14
0
from qtpy import uic

order_ui = r'C:\Users\Attila\PycharmProjects\Restaurant_project\view\order.ui'
form_order, base_order = uic.loadUiType(order_ui)


class OrderWidnow(base_order, form_order):
    def __init__(self, order_list):
        super(base_order, self).__init__()
        self.order_list = order_list
        self.setupUi(self)
示例#15
0
from qtpy import QtWidgets, QtGui, QtCore, QtOpenGL, uic
from qtpy.QtCore import Qt, QObject, QEvent, Signal
from qtpy.QtCore import QPoint, QRect, QSize
from qtpy.QtCore import QPointF, QRectF, QSizeF
from qtpy.QtGui import QColor, QTransform, qRgb
from qtpy.QtWidgets import QStyle

from util.SearchFilter import *

##----------------------------------------------------------------##
def _getModulePath( path ):
	import os.path
	return os.path.dirname( __file__ ) + '/' + path

SearchFilterEdit,BaseClass = uic.loadUiType( _getModulePath('SearchFilterEdit.ui') )

##----------------------------------------------------------------##
class SearchFilterEditWindow( QtWidgets.QFrame ):
	changed   = Signal()
	cancelled = Signal()
	def __init__( self, *args ):
		super( SearchFilterEditWindow, self ).__init__( *args )
		self.ui = SearchFilterEdit()
		self.ui.setupUi( self )
		self.setWindowFlags( Qt.Popup )
		self.installEventFilter( self )

		self.ui.buttonCancel.clicked.connect( self.onButtonCancel )
		self.ui.buttonOK.clicked.connect( self.onButtonOK )
		self.ui.lineEditCiteria.installEventFilter( self )
示例#16
0
import os.path
try:
    import configparser
except ImportError:
    import ConfigParser as configparser

from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.uic import loadUiType

# This method of the PyQt4.uic module allows for dynamically loading user
# interfaces created by QtDesigner. See the PyQt4 Reference Guide for more
# info.
Ui_DBsTreeSortPage = \
    loadUiType(os.path.join(os.path.dirname(__file__),
                            'dbs_tree_sort_page.ui'))[0]


class AboutPage(QtWidgets.QWidget, Ui_DBsTreeSortPage):
    """
    Widget for describing and customizing the Sorting of DBs Tree plugin.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This widget is inserted as a page in the stacked widget of the
    Preferences dialog when the sorting of DBs Tree item is clicked in the
    selector tree.
示例#17
0
__docformat__ = 'restructuredtext'

import os.path

from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.uic import loadUiType

import vitables.utils

# This method of the PyQt4.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt4 Reference Guide for more
# info.
Ui_InputNodenameDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__),'nodename_dlg.ui'))[0]


class InputNodeName(QtWidgets.QDialog, Ui_InputNodenameDialog):
    """
    Dialog for interactively entering a name for a given node.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This dialog is called when a new group is being created and also when
    a node of any kind is being renamed.

    Regular Qt class QInputDialog is not used because, at least apparently,
示例#18
0
import scipy.ndimage as sp_ndimage
import skimage.draw as si_draw
import skimage.filters as si_filters
import skimage.morphology as si_morphology
import skimage.transform as si_transform
import skimage.util as si_util
import sys

# get main.py path
path = os.path.dirname(os.path.abspath(__file__))

# change current directory
os.chdir(path)

# loading GUi from main_window.ui
form_class = uic.loadUiType("mainwindow.ui")[0]

if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
    qtpy.QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling,
                                             True)

if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
    qtpy.QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps,
                                             True)


class QGraphicsView(QtWidgets.QGraphicsView):
    def __init__(self, parent):
        super(QGraphicsView, self).__init__(parent)

        # get reference to MainWindow and all the variables and functions
示例#19
0
from qtpy import QtGui
from qtpy import QtWidgets

from qtpy.uic import loadUiType

import vitables.utils

__docformat__ = 'restructuredtext'

translate = QtWidgets.QApplication.translate
# This method of the PyQt5.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_LinkPropDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__), 'link_prop_dlg.ui'))[0]


class LinkPropDlg(QtWidgets.QDialog, Ui_LinkPropDialog):
    """
    Link properties dialog.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This class displays a simple dialog that shows some properties of
    the selected link: name, path, type and target.

    :Parameter info: a :meth:`vitables.nodeprops.nodeinfo.NodeInfo` instance
示例#20
0
from qtpy import QtWidgets, QtGui, QtCore, QtOpenGL, uic
from qtpy.QtCore import Qt, QObject, QEvent, Signal
from qtpy.QtCore import QPoint, QRect, QSize
from qtpy.QtCore import QPointF, QRectF, QSizeF
from qtpy.QtWidgets import QMessageBox
from qtpy.QtGui import QColor, QTransform, qRgb
from qtpy.QtWidgets import QStyle, QMessageBox


##----------------------------------------------------------------##
def _getModulePath(path):
    import os.path
    return os.path.dirname(__file__) + '/' + path


ColorPickerForm, BaseClass = uic.loadUiType(_getModulePath('ColorPicker.ui'))


def requestConfirm(title, msg, level='normal'):
    f = None
    if level == 'warning':
        f = QMessageBox.warning
    elif level == 'critical':
        f = QMessageBox.critical
    else:
        f = QMessageBox.question
    res = f(None, title, msg,
            QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
    if res == QMessageBox.Yes: return True
    if res == QMessageBox.Cancel: return None
    if res == QMessageBox.No: return False
示例#21
0
import os
import sys
from qtpy import QtCore, QtGui, QtWidgets
from qtpy import uic

sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dbsgui'))
import dbsgui
# Note: If import dbsgui fails, then set the working directory to be this script's directory.

ui_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dbsgui', 'my_widgets', 'ui')
Ui_MainWindow, QtBaseClass = uic.loadUiType(os.path.join(ui_path, 'send_comments.ui'))


class MyGUI(QtWidgets.QMainWindow, Ui_MainWindow):

    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        # super(MyGUI, self).__init__()
        self.setupUi(self)

        # Connect signals & slots
        self.action_Connect.triggered.connect(self.on_connect)
        self.pushButton_Touch_Head.clicked.connect(lambda: self.on_button("Touch", "Head"))
        self.pushButton_Touch_Upper.clicked.connect(lambda: self.on_button("Touch", "Upper"))
        self.pushButton_Touch_Lower.clicked.connect(lambda: self.on_button("Touch", "Lower"))
        self.pushButton_Passive_Head.clicked.connect(lambda: self.on_button("Kinesthetic", "Head"))
        self.pushButton_Passive_Upper.clicked.connect(lambda: self.on_button("Kinesthetic", "Upper"))
        self.pushButton_Passive_Lower.clicked.connect(lambda: self.on_button("Kinesthetic", "Lower"))
        self.pushButton_Other_Head.clicked.connect(lambda: self.on_button("Other", "Head"))
        self.pushButton_Other_Upper.clicked.connect(lambda: self.on_button("Other", "Upper"))
示例#22
0
"""Default plugin about page."""

import os

from qtpy import QtGui
from qtpy import QtWidgets
from qtpy import uic

Ui_AboutPage = uic.loadUiType(os.path.join(os.path.dirname(
    os.path.abspath(__file__)), 'about_page.ui'))[0]


class AboutPage(QtWidgets.QWidget, Ui_AboutPage):
    def __init__(self, desc, parent=None):
        super(AboutPage, self).__init__(parent)
        self.setupUi(self)
        # fill gui elements
        self.version_text.setText(desc.get('version', ''))
        self.module_name_text.setText(desc.get('module_name', ''))
        self.folder_text.setText(desc.get('folder', ''))
        self.author_text.setText(desc.get('author', ''))
        self.desc_text.setText(desc.get('comment', ''))
示例#23
0
try:
    import configparser
except ImportError:
    import ConfigParser as configparser

from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.uic import loadUiType

__docformat__ = 'restructuredtext'

# This method of the PyQt5.uic module allows for dynamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_DBsTreeSortPage = \
    loadUiType(os.path.join(os.path.dirname(__file__),
                            'dbs_tree_sort_page.ui'))[0]


class AboutPage(QtWidgets.QWidget, Ui_DBsTreeSortPage):
    """
    Widget for describing and customizing the Sorting of DBs Tree plugin.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This widget is inserted as a page in the stacked widget of the
    Preferences dialog when the sorting of DBs Tree item is clicked in the
    selector tree.
示例#24
0
import os.path

from qtpy import QtGui
from qtpy import QtWidgets

from qtpy.uic import loadUiType

import vitables.utils

translate = QtWidgets.QApplication.translate
# This method of the PyQt4.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt4 Reference Guide for more
# info.
Ui_LeafPropPage = \
    loadUiType(os.path.join(os.path.dirname(__file__),'leaf_prop_page.ui'))[0]


class LeafPropPage(QtWidgets.QWidget, Ui_LeafPropPage):
    """
    Leaf properties page.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This class displays a tabbed dialog that shows some properties of
    the selected node. First tab, General, shows general properties like
    name, path, type etc. The second and third tabs show the system and
    user attributes in a tabular way.
示例#25
0
文件: config.py 项目: ZLLentz/atef
 def __init_subclass__(cls):
     """Read the file when the class is created"""
     super().__init_subclass__()
     cls.ui_form, _ = loadUiType(
         str(Path(__file__).parent.parent / 'ui' / cls.filename))
示例#26
0
import os.path

from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.uic import loadUiType

import vitables.utils

__docformat__ = 'restructuredtext'

# This method of the PyQt5.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_InputNodenameDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__), 'nodename_dlg.ui'))[0]


class InputNodeName(QtWidgets.QDialog, Ui_InputNodenameDialog):
    """
    Dialog for interactively entering a name for a given node.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This dialog is called when a new group is being created and also when
    a node of any kind is being renamed.

    Regular Qt class QInputDialog is not used because, at least apparently,
示例#27
0
    def __init__(self, hiRes, app, x86, wineProg, wineDebug, patchClient,
                 usingDND, winePrefix, gameDir, homeDir, osType, rootDir,
                 settings, LanguageConfig, parent):

        self.homeDir = homeDir
        self.osType = osType
        self.app = app
        self.winePrefix = winePrefix
        self.rootDir = rootDir
        self.settings = settings
        self.parent = parent

        self.winSettings = QtWidgets.QDialog(parent,
                                             QtCore.Qt.FramelessWindowHint)

        uifile = resource_filename(__name__, 'ui' + os.sep + 'winSettings.ui')

        Ui_dlgSettings, base_class = uic.loadUiType(uifile)
        self.uiSettings = Ui_dlgSettings()
        self.uiSettings.setupUi(self.winSettings)

        if not self.osType.usingWindows:
            self.uiSettings.cboApplication.addItem("Wine")
            self.uiSettings.cboApplication.addItem("Crossover Games")
            self.uiSettings.cboApplication.addItem("Crossover Office")
            self.uiSettings.txtPrefix.setText(winePrefix)
            self.uiSettings.txtDebug.setText(wineDebug)
            self.uiSettings.txtProgram.setText(wineProg)
            self.uiSettings.txtProgram.setVisible(False)
            self.uiSettings.lblProgram.setVisible(False)

            if app == "Wine":
                self.uiSettings.lblPrefix.setText("WINEPREFIX")
                self.uiSettings.txtPrefix.setVisible(True)
                self.uiSettings.cboBottle.setVisible(False)
                self.uiSettings.cboApplication.setCurrentIndex(0)
            else:
                self.uiSettings.lblPrefix.setText("Bottle")
                if app == "CXGames":
                    self.uiSettings.cboApplication.setCurrentIndex(1)
                else:
                    self.uiSettings.cboApplication.setCurrentIndex(2)
                self.uiSettings.txtPrefix.setVisible(False)
                self.uiSettings.cboBottle.setVisible(True)
                self.ShowBottles(winePrefix)
        else:
            self.uiSettings.tabWidget.removeTab(1)

        self.uiSettings.txtGameDir.setText(gameDir)
        self.uiSettings.cboGraphics.addItem("Enabled")
        self.uiSettings.cboGraphics.addItem("Disabled")
        self.uiSettings.chkAdvanced.setChecked(False)
        self.uiSettings.txtPatchClient.setText(patchClient)
        self.uiSettings.txtPatchClient.setVisible(False)
        self.uiSettings.lblPatchClient.setVisible(False)

        if hiRes:
            self.uiSettings.cboGraphics.setCurrentIndex(0)
        else:
            self.uiSettings.cboGraphics.setCurrentIndex(1)

        # Only enables and sets up check box if 64-bit client is available
        if (os.path.exists(gameDir + os.sep + "x64" + os.sep +
                           "lotroclient64.exe") and usingDND == False
                or usingDND and os.path.exists(gameDir + os.sep + "x64" +
                                               os.sep + "dndclient64.exe")):
            if x86:
                self.uiSettings.chkx86.setChecked(True)
            else:
                self.uiSettings.chkx86.setChecked(False)
        else:
            self.uiSettings.chkx86.setEnabled(False)

        self.uiSettings.btnEN.setIcon(
            QtGui.QIcon(
                resource_filename(__name__, "images" + os.sep + "EN.png")))

        self.uiSettings.btnDE.setIcon(
            QtGui.QIcon(
                resource_filename(__name__, "images" + os.sep + "DE.png")))

        self.uiSettings.btnFR.setIcon(
            QtGui.QIcon(
                resource_filename(__name__, "images" + os.sep + "FR.png")))

        #Sets up language buttons. Only buttons for available languages are enabled.
        for lang in LanguageConfig(self.settings.gameDir).langList:
            if lang == "EN":
                self.uiSettings.btnEN.setEnabled(True)
                self.uiSettings.btnEN.setToolTip("English")
            elif lang == "DE":
                self.uiSettings.btnDE.setEnabled(True)
                self.uiSettings.btnDE.setToolTip("Deutsch")
            elif lang == "FR":
                self.uiSettings.btnFR.setEnabled(True)
                self.uiSettings.btnFR.setToolTip("Français")

            if lang == self.settings.language:
                if lang == "EN":
                    self.uiSettings.btnEN.setChecked(True)
                elif lang == "DE":
                    self.uiSettings.btnDE.setChecked(True)
                elif lang == "FR":
                    self.uiSettings.btnFR.setChecked(True)

        self.uiSettings.btnSetupWizard.clicked.connect(
            self.btnSetupWizardClicked)
        self.uiSettings.btnGameDir.clicked.connect(self.btnGameDirClicked)
        self.uiSettings.txtGameDir.textChanged.connect(self.txtGameDirChanged)
        self.uiSettings.chkAdvanced.clicked.connect(self.chkAdvancedClicked)

        if not self.osType.usingWindows:
            if self.app == "Wine":
                self.uiSettings.btnCheckPrefix.setText("Check Prefix")
            else:
                self.uiSettings.btnCheckPrefix.setText("Check Bottle")

            self.uiSettings.btnCheckPrefix.clicked.connect(
                self.btnCheckPrefixClicked)
            self.uiSettings.btnPrefixDir.clicked.connect(
                self.btnPrefixDirClicked)
            self.uiSettings.txtPrefix.textChanged.connect(
                self.txtPrefixChanged)
            self.uiSettings.cboBottle.currentIndexChanged.connect(
                self.cboBottleChanged)
            self.uiSettings.cboBottle.currentIndexChanged.connect(
                self.cboBottleChanged)
            self.uiSettings.cboApplication.currentIndexChanged.connect(
                self.cboApplicationChanged)

        self.usingDND = usingDND
示例#28
0
from qtpy import QtGui
from qtpy import QtWidgets

from qtpy.uic import loadUiType

import vitables.utils

__docformat__ = 'restructuredtext'

translate = QtWidgets.QApplication.translate
# This method of the PyQt5.uic module allows for dinamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_GroupPropPage = \
    loadUiType(os.path.join(os.path.dirname(__file__),'group_prop_page.ui'))[0]



class GroupPropPage(QtWidgets.QWidget, Ui_GroupPropPage):
    """
    Group properties page.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This class displays a tabbed dialog that shows some properties of
    the selected node. First tab, General, shows general properties like
    name, path, type etc. The second and third tabs show the system and
示例#29
0
# Sirius server
REDIS_HOST = "10.0.38.59"

room_names = {
    "All": "",
    "Others": "Outros",
    "TL": "LTs",
    "Connectivity": "Conectividade",
    "Power Supplies": "Fontes",
    "RF": "RF",
}
# "LTs", "Conectividade", "Fontes", "RF", "Outros"
for i in range(20):
    room_names["IA-{:02d}".format(i + 1)] = "Sala{:02d}".format(i + 1)

Ui_MainWindow, QtBaseClass = uic.loadUiType(BEAGLEBONES_MAIN_UI)
Ui_MainWindow_config, QtBaseClass_config = uic.loadUiType(CHANGE_BBB_UI)
Ui_MainWindow_info, QtBaseClass_info = uic.loadUiType(INFO_BBB_UI)
Ui_MainWindow_logs, QtBaseClass_logs = uic.loadUiType(LOGS_BBB_UI)


class UpdateNodesThread(QtCore.QThread):
    finished = QtCore.Signal(tuple)

    def __init__(self, server):
        QtCore.QThread.__init__(self)
        self.server = server

    def __del__(self):
        self.wait()
示例#30
0
from qtpy import QtWidgets

from qtpy.uic import loadUiType

from vitables.vtsite import ICONDIR
import vitables.utils


__docformat__ = 'restructuredtext'

translate = QtWidgets.QApplication.translate
# This method of the PyQt5.uic module allows for dynamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_SettingsDialog = \
    loadUiType(os.path.join(os.path.dirname(__file__), 'settings_dlg.ui'))[0]


class Preferences(QtWidgets.QDialog, Ui_SettingsDialog):
    """
    Create the Settings dialog.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    """

    def __init__(self):
        """
示例#31
0
except ImportError:
    import ConfigParser as configparser

from qtpy import QtGui
from qtpy import QtCore
from qtpy import QtWidgets
from qtpy.uic import loadUiType


__docformat__ = 'restructuredtext'

# This method of the PyQt5.uic module allows for dynamically loading user
# interfaces created by QtDesigner. See the PyQt5 Reference Guide for more
# info.
Ui_TimeFormatterPage = \
    loadUiType(os.path.join(os.path.dirname(__file__),
                            'timeformatter_page.ui'))[0]


class AboutPage(QtWidgets.QWidget, Ui_TimeFormatterPage):
    """
    Widget for describing and customizing the Time series plugin.

    By loading UI files at runtime we can:

        - create user interfaces at runtime (without using pyuic)
        - use multiple inheritance, MyParentClass(BaseClass, FormClass)

    This widget is inserted as a page in the stacked widget of the
    Preferences dialog when the Time series item is clicked in the
    selector tree.