Python PyQt5.QtWidgets.QApplication.desktop() Examples

The following are 30 code examples of PyQt5.QtWidgets.QApplication.desktop(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets.QApplication , or try the search function .
Example #1
Source File: DyStockDataJaccardIndexPlotDlg.py    From DevilYuan with MIT License 6 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('选择哪些杰卡德指数可视化')
 
        # 控件
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._jaccardIndexWidget = DyTreeWidget([[x] for x in self._columns])

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._jaccardIndexWidget, 0, 0, 20, 2)
 
        grid.addWidget(okPushButton, 20, 1)
        grid.addWidget(cancelPushButton, 20, 0)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//6, QApplication.desktop().size().height()//2) 
Example #2
Source File: DyStockInfoDlg.py    From DevilYuan with MIT License 6 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('个股资料(F10)')
 
        # 控件
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._stockInfoWidget = DyTreeWidget(self.fields)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._stockInfoWidget, 0, 0, 20, 10)
 
        grid.addWidget(okPushButton, 0, 10)
        grid.addWidget(cancelPushButton, 1, 10)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2) 
Example #3
Source File: drag_files_do_event.py    From utils-for-python with MIT License 6 votes vote down vote up
def initUI(self):

        self.setWindowTitle('File Manager')
        self.resize(100, 100)

        desktop = QApplication.desktop()
        x = int(desktop.width()*0.9) - self.window().width()
        y = int(desktop.height()*0.1)
        self.move(x, y)

        self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint |   # 使能最小化按钮
                            QtCore.Qt.WindowCloseButtonHint |      # 使能关闭按钮
                            QtCore.Qt.FramelessWindowHint |        # 去掉边框
                            QtCore.Qt.WindowStaysOnTopHint)        # 窗体总在最前端
        self.setFixedSize(self.width(), self.height())             # 固定窗体大小

        # 设置拖拽事件
        self.setAcceptDrops(True)

        # 设置背景图片
        self.set_background() 
Example #4
Source File: DyStockInfoDlg.py    From DevilYuan with MIT License 6 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('个股资料(F10)')
 
        # 控件
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._stockInfoWidget = DyTreeWidget(self.fields)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._stockInfoWidget, 0, 0, 20, 10)
 
        grid.addWidget(okPushButton, 0, 10)
        grid.addWidget(cancelPushButton, 1, 10)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2) 
Example #5
Source File: DyStockSelectStockInfoDlg.py    From DevilYuan with MIT License 6 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('个股资料(F10)')
 
        # 控件
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._stockInfoWidget = DyTreeWidget(self.fields)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._stockInfoWidget, 0, 0, 20, 10)
 
        grid.addWidget(okPushButton, 0, 10)
        grid.addWidget(cancelPushButton, 1, 10)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2) 
Example #6
Source File: DyStockDataJaccardIndexPlotDlg.py    From DevilYuan with MIT License 6 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('选择哪些杰卡德指数可视化')
 
        # 控件
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._jaccardIndexWidget = DyTreeWidget([[x] for x in self._columns])

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._jaccardIndexWidget, 0, 0, 20, 2)
 
        grid.addWidget(okPushButton, 20, 1)
        grid.addWidget(cancelPushButton, 20, 0)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//6, QApplication.desktop().size().height()//2) 
Example #7
Source File: DyStockTableWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
def _limitUpRatioAct(self):
        colData = self.getColumnsData([self._rightClickHeaderItem.text()])

        limitUpNbr, nonLimitUpNbr = 0, 0
        for row in colData:
            if row is None:
                continue

            value = row[0]

            try:
                value = float(value)
            except Exception:
                continue

            if value >= DyStockCommon.limitUpPct:
                limitUpNbr += 1
            else:
                nonLimitUpNbr += 1

        totalNbr = limitUpNbr + nonLimitUpNbr

        table = DyTableWidget(readOnly=True, index=False)
        table.setColNames(['涨停', '非涨停', '涨停占比(%)'])
        table.appendRow([limitUpNbr, nonLimitUpNbr, limitUpNbr/totalNbr*100])

        table.setWindowTitle('涨停比')
        table.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//3)
        table.show()

        self._windows.append(table) 
Example #8
Source File: CColorStraw.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def mouseMoveEvent(self, event):
        super(CColorStraw, self).mouseMoveEvent(event)
        # 得到鼠标在屏幕中的位置
        pos = event.globalPos()
        # 截取一部分放大图效果
        image = QApplication.primaryScreen().grabWindow(
            int(QApplication.desktop().winId()),
            pos.x() - 6, pos.y() - 6, 13, 13).toImage()
        color = image.pixelColor(6, 6)
        if color.isValid():
            self.colorChanged.emit(color)
        self._scaleWindow.updateImage(pos, image.scaled(130, 130)) 
Example #9
Source File: loading_dialog.py    From CvStudio with MIT License 5 votes vote down vote up
def center(self, host: QWidget = None):
        if host:
            hostGeometry: QRect = host.geometry()
            # dialogGeometry : QRect = self.geometry()
            centerPoint: QPoint = hostGeometry.center()
            centerPoint = host.mapToGlobal(centerPoint)
            offset = 30
            targetPoint = QPoint(centerPoint.x() - offset, centerPoint.y() - offset)
            self.move(targetPoint)
        else:
            screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
            centerPoint = QApplication.desktop().screenGeometry(screen).center()
            self.move(centerPoint)
        return self 
Example #10
Source File: WeltHideWindow.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(WeltHideWindow, self).__init__(*args, **kwargs)
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
        self.resize(800, 600)
        self._width = QApplication.desktop().availableGeometry(self).width()
        layout = QVBoxLayout(self)
        layout.addWidget(QPushButton("关闭窗口", self, clicked=self.close)) 
Example #11
Source File: DyDataFrameWindow.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title):
        self.setWindowTitle(title)
        self.setWindowFlags(Qt.Window)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//2)

        self.show()

        self.move((QApplication.desktop().size().width() - self.width())//2, (QApplication.desktop().size().height() - self.height())//2) 
Example #12
Source File: DyStockTableColumnOperateDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, colNames):
        self.setWindowTitle('列运算')
 
        # 控件
        table = DyTableWidget(parent=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
        table.setColNames(['列名', '表达式'])
        rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
        table.fastAppendRows(rows)

        descriptionLabel = QLabel('列运算表达式(Pandas语法)')
        self._expressionTextEdit = QTextEdit()

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(table, 0, 0, 22, 1)

        grid.addWidget(descriptionLabel, 0, 1)

        grid.addWidget(self._expressionTextEdit, 1, 1, 20, 20)
 
        grid.addWidget(okPushButton, 0, 21)
        grid.addWidget(cancelPushButton, 1, 21)
 
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3) 
Example #13
Source File: DyStockTableFilterDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, colNames):
        self.setWindowTitle('过滤')
 
        # 控件
        table = DyTableWidget(parent=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
        table.setColNames(['列名', '表达式'])
        rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
        table.fastAppendRows(rows)

        descriptionLabel = QLabel('行过滤表达式(Python语法)')
        self._filterTextEdit = QTextEdit()
        self._newWindowCheckBox = QCheckBox('新窗口')
        self._newWindowCheckBox.setChecked(True)
        self._highlightCheckBox = QCheckBox('原窗口高亮')
        self._highlightCheckBox.setChecked(False)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(table, 0, 0, 22, 1)
        grid.addWidget(self._newWindowCheckBox, 0, 1)
        grid.addWidget(self._highlightCheckBox, 0, 2)

        grid.addWidget(descriptionLabel, 1, 1)

        grid.addWidget(self._filterTextEdit, 2, 1, 20, 20)
 
        grid.addWidget(okPushButton, 0, 21)
        grid.addWidget(cancelPushButton, 1, 21)
 
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3) 
Example #14
Source File: DyStockVolatilityDistDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('波动分布[{0}]'.format(name))
 
        # 控件
        forwardNTDaysLabel = QLabel('基准日期[{0}]向前N日(不包含基准日期)'.format(baseDate))
        self._forwardNTDaysLineEdit = QLineEdit('30')

        # 自身波动和绝对波动
        # 个股绝对波动 = 个股自身波动 + 大盘波动
        selfVolatilityRadioButton = QRadioButton('自身波动'); selfVolatilityRadioButton.setChecked(True)
        selfVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        absoluteVolatilityRadioButton = QRadioButton('绝对波动')
        absoluteVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        # 添加到QButtonGroup
        self._volatilityButtonGroup = QButtonGroup()
        self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1); 
        self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(selfVolatilityRadioButton, 1, 0)
        grid.addWidget(absoluteVolatilityRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #15
Source File: DyStockTableAddColumnsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title, backward):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join([str(x) for x in self._data['days']]) if self._data else '2,3,4,5,10' )

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后');
        if backward:
            backwardRadioButton.setChecked(True)
        else:
            forwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #16
Source File: DyStockIndustryCompareDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('行业对比[{0}]-基准日期[{1}]'.format(name, baseDate))
 
        # 控件
        forwardNTDaysLabel = QLabel('向前N日涨幅(%)')
        self._forwardNTDaysLineEdit = QLineEdit('30')

        self._industry2CheckBox = QCheckBox('行业二级分级')
        #self._industry2CheckBox.setChecked(True)

        self._industry3CheckBox = QCheckBox('行业三级分级')
        self._industry3CheckBox.setChecked(True)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(self._industry2CheckBox, 1, 0)
        grid.addWidget(self._industry3CheckBox, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #17
Source File: DyStockTableWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
def _stockInfoAct(self):
        code, name = self.getRightClickCodeName()
        if code is None: return

        browser = DyWebView()
        url = 'http://basic.10jqka.com.cn/32/{0}/'.format(code[:-3])
        browser.load(QUrl(url))

        browser.setWindowTitle(name)
        
        rect = QApplication.desktop().availableGeometry()
        taskBarHeight = QApplication.desktop().height() - rect.height()

        browser.resize(rect.width()//3 * 2, rect.height() - taskBarHeight)
        browser.move((rect.width() - browser.width())//2, 0)

        browser.show()

        self._windows.append(browser) 
Example #18
Source File: sparrowdialogs.py    From sparrow-wifi with GNU General Public License v3.0 5 votes vote down vote up
def center(self):
        # Get our geometry
        qr = self.frameGeometry()
        # Find the desktop center point
        cp = QDesktopWidget().availableGeometry().center()
        # Move our center point to the desktop center point
        qr.moveCenter(cp)
        # Move the top-left point of the application window to the top-left point of the qr rectangle, 
        # basically centering the window
        self.move(qr.topLeft()) 
Example #19
Source File: DyStockTableWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
def _upDownRatioAct(self):
        colData = self.getColumnsData([self._rightClickHeaderItem.text()])

        upNbr, downNbr, noChangeNbr = 0, 0, 0
        for row in colData:
            if row is None:
                continue
            value = row[0]

            try:
                value = float(value)
            except Exception:
                continue

            if value > 0:
                upNbr += 1
            elif value < 0:
                downNbr += 1
            else:
                noChangeNbr += 1

        totalNbr = upNbr + downNbr + noChangeNbr

        table = DyTableWidget(readOnly=True, index=False)
        table.setColNames(['涨', '跌', '平', '上涨占比(%)', '下跌占比(%)', '平占比(%)'])
        table.appendRow([upNbr, downNbr, noChangeNbr, upNbr/totalNbr*100, downNbr/totalNbr*100, noChangeNbr/totalNbr*100])

        table.setWindowTitle('涨跌比')
        table.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//3)
        table.show()

        self._windows.append(table) 
Example #20
Source File: DyStockSelectIndustryCompareDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('行业对比[{0}]-基准日期[{1}]'.format(name, baseDate))
 
        # 控件
        forwardNTDaysLabel = QLabel('向前N日涨幅(%)')
        self._forwardNTDaysLineEdit = QLineEdit('30')

        self._industry2CheckBox = QCheckBox('行业二级分级')
        #self._industry2CheckBox.setChecked(True)

        self._industry3CheckBox = QCheckBox('行业三级分级')
        self._industry3CheckBox.setChecked(True)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(self._industry2CheckBox, 1, 0)
        grid.addWidget(self._industry3CheckBox, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #21
Source File: DyStockSelectAddColumnsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join(self._data['days']) if self._data else '2,3,4,5,10' )

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后'); backwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #22
Source File: DyStockSelectVolatilityDistDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('波动分布[{0}]'.format(name))
 
        # 控件
        forwardNTDaysLabel = QLabel('基准日期[{0}]向前N日(不包含基准日期)'.format(baseDate))
        self._forwardNTDaysLineEdit = QLineEdit('30')

        # 自身波动和绝对波动
        # 个股绝对波动 = 个股自身波动 + 大盘波动
        selfVolatilityRadioButton = QRadioButton('自身波动'); selfVolatilityRadioButton.setChecked(True)
        selfVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        absoluteVolatilityRadioButton = QRadioButton('绝对波动')
        absoluteVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        # 添加到QButtonGroup
        self._volatilityButtonGroup = QButtonGroup()
        self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1); 
        self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(selfVolatilityRadioButton, 1, 0)
        grid.addWidget(absoluteVolatilityRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #23
Source File: DyStockSelectSaveAsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, strategyName):
        self.setWindowTitle('[{0}]另存为'.format(strategyName))
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #24
Source File: DyStockSelectFilterDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, colNames):
        self.setWindowTitle('过滤')
 
        # 控件
        table = DyTableWidget(parant=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
        table.setColNames(['列名', '表达式'])
        rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
        table.fastAppendRows(rows)

        descriptionLabel = QLabel('过滤表达式(Python语法)')
        self._filterTextEdit = QTextEdit()
        self._newWindowCheckBox = QCheckBox('新窗口')
        self._newWindowCheckBox.setChecked(True)
        self._highlightCheckBox = QCheckBox('原窗口高亮')
        self._highlightCheckBox.setChecked(True)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(table, 0, 0, 22, 1)
        grid.addWidget(self._newWindowCheckBox, 0, 1)
        grid.addWidget(self._highlightCheckBox, 0, 2)

        grid.addWidget(descriptionLabel, 1, 1)

        grid.addWidget(self._filterTextEdit, 2, 1, 20, 20)
 
        grid.addWidget(okPushButton, 0, 21)
        grid.addWidget(cancelPushButton, 1, 21)
 
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3) 
Example #25
Source File: DyStockSelectStrategyRegressionResultWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
def mergePeriod(self, name):
        # get all rows by period sequence
        allRows = []
        autoColName = None

        periods = sorted(self._strategyPeriodWidgets)
        for period in periods:
            periodWidget = self._strategyPeriodWidgets[period]

            allRows.extend(periodWidget.getAll())
            autoColName = periodWidget.getAutoColName()

        window = DyStockSelectStrategyRegressionResultWidget(self._eventEngine, self._strategyCls, self._paramWidget)
        tabName = '{0},{1}'.format(periods[0][:11], periods[-1][-11:])

        widget = DyStockSelectStrategyRegressionPeriodResultWidget(self._eventEngine, tabName, self._strategyCls, self._paramWidget)

        # set column names with period widget's column names
        widget.rawSetColNames(self._getColNames())
            
        # append to new statistic table widget
        widget.rawAppend(allRows, autoColName)

        window.addTab(tabName, widget)

        # show window
        window.setWindowTitle(self._strategyCls.chName)
        window.setWindowFlags(Qt.Window)
        window.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//2)
        window.show()

        window.move((QApplication.desktop().size().width() - widget.width())//2, (QApplication.desktop().size().height() - widget.height())//2)

        self._windows.append(window) 
Example #26
Source File: DyStockDataStrategyDataPrepareDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('生成策略准备数据')
 
        # 控件
        dateLable = QLabel('日期')
        self._dateLineEdit = QLineEdit(datetime.now().strftime("%Y-%m-%d"))

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._strategies = {}
        self._strategyWidget = DyTreeWidget(self._getFields())

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._strategyWidget, 0, 0, 20, 10)
 
        grid.addWidget(dateLable, 0, 10, 1, 2)
        grid.addWidget(self._dateLineEdit, 1, 10, 1, 2)

        grid.addWidget(okPushButton, 2, 11)
        grid.addWidget(cancelPushButton, 2, 10)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2) 
Example #27
Source File: functions.py    From ETS2Autopilot with MIT License 5 votes vote down vote up
def get_screen_bbox():
    screen_id = Settings().get_value(Settings.SCREEN)
    if screen_id is None:
        screen_id = 0
    screen_res = QApplication.desktop().screenGeometry(int(screen_id))
    return screen_res.left(), screen_res.top(), screen_res.right(), screen_res.bottom() 
Example #28
Source File: settings.py    From ETS2Autopilot with MIT License 5 votes vote down vote up
def select_screen(self):
        screen_id = self.ui.cb_screen.currentIndex()
        screen_res = QApplication.desktop().screenGeometry(screen_id)

        Settings().set_value(Settings.SCREEN, screen_id)

        self.ui.slider_left.setMaximum(screen_res.width())
        self.ui.slider_right.setMaximum(screen_res.width())
        self.ui.slider_top.setMaximum(screen_res.height())
        self.ui.slider_bottom.setMaximum(screen_res.height()) 
Example #29
Source File: DyStockSelectVolatilityDistDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('波动分布[{0}]'.format(name))
 
        # 控件
        forwardNTDaysLabel = QLabel('基准日期[{0}]向前N日(不包含基准日期)'.format(baseDate))
        self._forwardNTDaysLineEdit = QLineEdit('30')

        # 自身波动和绝对波动
        # 个股绝对波动 = 个股自身波动 + 大盘波动
        selfVolatilityRadioButton = QRadioButton('自身波动'); selfVolatilityRadioButton.setChecked(True)
        selfVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        absoluteVolatilityRadioButton = QRadioButton('绝对波动')
        absoluteVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        # 添加到QButtonGroup
        self._volatilityButtonGroup = QButtonGroup()
        self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1); 
        self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(selfVolatilityRadioButton, 1, 0)
        grid.addWidget(absoluteVolatilityRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #30
Source File: DyDataFrameWindow.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title):
        self.setWindowTitle(title)
        self.setWindowFlags(Qt.Window)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//2)

        self.show()

        self.move((QApplication.desktop().size().width() - self.width())//2, (QApplication.desktop().size().height() - self.height())//2)