Exemple #1
0
def main():
    app = QtWidgets.QApplication([])
    widget = BoolWidget("tests", True)
    widget.show()
    sys.exit(app.exec_())
Exemple #2
0
            datetime.date(int(year), int(month), int(day))
        except ValueError:
            self.lEditResult.setText('出生年月日格式错误')
            return

        if year + month + day > datetime.datetime.now().strftime(
                '%Y%m%d') or year < '1900':
            self.lEditResult.setText('出生年月日错误')
            return
        self.lEditBirth.setText(year + '年' + month + '月' + day + '日')

        # 性别
        gender = sfz[16:17]
        if int(gender) % 2 == 0:
            self.lEditGender.setText('女')
        else:
            self.lEditGender.setText('男')

        self.lEditResult.setText('身份证校验正确')

    def lEditNumTextChanged(self):
        preRegex = QtCore.QRegExp('^\d{17}[0-9xX]$')  # 身份证正则预校验
        preValidator = QtGui.QRegExpValidator(preRegex, self.lEditNum)
        self.lEditNum.setValidator(preValidator)


if __name__ == '__main__':
    app = QtWidgets.QApplication()
    MainWindow = SfzDialog()
    MainWindow.show()
    sys.exit(app.exec_())
def main():
    app = QtWidgets.QApplication([])
    widget = PathTraceBouncerDemoWidget()
    widget.show()
    app.exec_()
Exemple #4
0
            QWidget function closeEvent() run when window [X] clicked,
            is subclassed here to prevent default closing of window and app - see below
            """
            self.close()  # see below

        def eventFilter(self, obj, event):  #pylint: disable = no-self-use
            """use a generic eventFilter() like glb.show_most_events(obj, event) from _support.py,
            or write a custom global one here for project"""
            glb.show_most_events(obj, event)
            return False


if "project main script":
    glb.green(__doc__)

    app = W.QApplication()

    if "project global variables":
        """project global variables use the prefix glb.<variable>
        As in any python variable,  they are dynamic
            and can be initialized/updated at anytime/anywhere in a project.
        """
        glb.icons = "/usr/share/icons/oxygen/base/32x32"  # my prefered icon set

        if "set default window placement parameters":
            glb.screen_size = C.QSize(1920, 1050)  # default screen_size
            glb.win_placement = C.QRect(
                800, 80, 500, 800)  # default window placement and size

        if "database variables":
            glb.db_name = "test.db"  # assumes is a sqlite database
Exemple #5
0
def main():
    app = QtWidgets.QApplication([])
    w = QuadTreeDemoWidget()
    w.show()
    app.exec_()
Exemple #6
0
def show_dialog():
    app = QtWidgets.QApplication(sys.argv)
    d = MyDialog()
    d.label1.setText("HELLO!!!")
    print(d.label1.text())
    d.exec_()  # blocking call
Exemple #7
0

class Panel(qtw.QWidget):
    def __init__(self):
        super(Panel, self).__init__()

        list_widget = qtw.QListWidget()
        shots = ['004', '001', '003', '002', '005']

        for i, shot in enumerate(shots):
            item = qtw.QListWidgetItem(shot)
            item.setToolTip('shot {}'.format(i))
            item.setIcon(qtg.QIcon('shot.png'))

            item.setBackgroundColor(qtg.QColor(152, 106, 232))
            list_widget.addItem(item)

        # we can sort stuff
        list_widget.sortItems()
        list_widget.setAlternatingRowColors(True)
        list_widget.setSelectionMode(qtw.QAbstractItemView.ExtendedSelection)

        master_layour = qtw.QVBoxLayout()
        master_layour.addWidget(list_widget)
        self.setLayout(master_layour)


app = qtw.QApplication()
panel = Panel()
panel.show()
app.exec_()
Exemple #8
0
def main():
    app = QtWidgets.QApplication([])
    widget = TenPrintDemoWidget()
    widget.show()
    app.exec_()
        self.colb1.clicked.connect(self.b3_fd)
        self.colb2.clicked.connect(self.b4_fd)

    def b1_fd(self):  # First color dialog function
        self.color_fd(le=self.bgle1)  # with first line edit field.

    def b2_fd(self):  # Second color dialog function
        self.color_fd(le=self.bgle2)  # with second line edit field.

    def b3_fd(self):  # Third color dialog function
        self.color_fd(le=self.colle1)  # with third line edit field.

    def b4_fd(self):  # Fourth color dialog function
        self.color_fd(le=self.colle2)  # with fourth line edit field.

    def color_fd(self, le=None):  # Function to run color dialog
        fd = QtWidgets.QColorDialog()  # with functions above. If the
        fd.setWindowIcon(QtGui.QIcon("Icons/python1.png"))
        if fd.exec_() == QtWidgets.QDialog.Accepted:
            fc = fd.selectedColor()  # dialog is accepted returns
            color = "rgba(%s,%s,%s,%s)" % (fc.red(), fc.green(), fc.blue(),
                                           fc.alpha())
            le.setText(color)  # color, adds string to field.


if __name__ == "__main__":  # If file run, name is main.
    import sys  # Import sys python stdlib.
    sapp = QtWidgets.QApplication(sys.argv)  # Create application.
    uset = USets()  # Main class instance.
    uset.show()  # Show the widget when start.
    sys.exit(sapp.exec_())  # Executes the application.
Exemple #10
0
        email = self.email_field.text().strip()
        if not email: email = None

        self.cursor.execute(INSERT_CLIENTE,
                            (nome, cognome, data, phone, email))

        self.conn.commit()
        self.accept()

    def _show_error(self, msg=''):
        dialog = QMessageBox()
        dialog.setWindowTitle('ERRORE')
        dialog.setText(msg)
        dialog.exec_()


if __name__ == '__main__':
    application = QtWidgets.QApplication([])

    pwd = input('Password: '******'postgres',
                            user='******',
                            password=pwd,
                            port=5433)

    widget = ClienteForm(conn)
    widget.resize(850, 480)
    widget.show()

    sys.exit(application.exec_())
Exemple #11
0
import exception

import smh

logger = logging.getLogger(__name__)
logger.addHandler(smh.handler)

from ui_mainwindow import *

if __name__ == '__main__':

    import sys

    # Create the app and clean up any style bugs.
    try:
        app = QtGui.QApplication(sys.argv)

    except RuntimeError:
        # For development.
        None

    if sys.platform == "darwin":
            
        # See http://successfulsoftware.net/2013/10/23/fixing-qt-4-for-mac-os-x-10-9-mavericks/
        substitutes = [
            (".Lucida Grande UI", "Lucida Grande"),
            (".Helvetica Neue DeskInterface", "Helvetica Neue")
        ]
        for substitute in substitutes:
            QtGui2.QFont.insertSubstitution(*substitute)
Exemple #12
0
# -*- coding:utf-8 -*-
"""
https://docs.python.org/3/library/unittest.html#assert-methods
"""

import unittest
import numpy as np
from PySide2 import QtGui, QtWidgets
from secv_guis.utils import RandomColorGenerator
from secv_guis.utils import rgb_arr_to_rgb_pixmap, bool_arr_to_rgba_pixmap, \
    pixmap_to_arr

APP = QtWidgets.QApplication(["SECV UTEST GUI"])


class RandomColorGeneratorTestCase(unittest.TestCase):
    """
    """
    def setUp(self):
        """
        """
        self.rcg = RandomColorGenerator()

    def test_rgb_arrays(self) -> None:
        """
        """
        for r, g, b in self.rcg.generate(form="rgbArray", count=1000):
            self.assertTrue(0 <= r <= 255)
            self.assertTrue(0 <= g <= 255)
            self.assertTrue(0 <= b <= 255)
            self.assertIsInstance(r, int)
Exemple #13
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    gui = LayoutApp()
    gui.show()
    sys.exit(app.exec_())
Exemple #14
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    a = Side()
    a.show()
    sys.exit(app.exec_())
Exemple #15
0
 def testBug(self):
     app = QtWidgets.QApplication([])
     w = BuggyWidget()
     w.setup()
     w.show()
     self.assertTrue(True)
    # Great Lakes
    LEOFS = 30  # RG = True     # Format is GoMOFS
    LHOFS = 31  # RG = False
    LMOFS = 32  # RG = False
    LOOFS = 33  # RG = False
    LSOFS = 34  # RG = False

    # Pacific Coast
    CREOFS = 40  # RG = True     # Format is GoMOFS
    SFBOFS = 41  # RG = True     # Format is GoMOFS


# Choose Model
switch = ModelOptions.CBOFS  # Choose a ModelOptions Value to test

app = QtWidgets.QApplication([])  # PySide stuff (start)
mw = QtWidgets.QMainWindow()
mw.show()

lib = SoundSpeedLibrary(progress=QtProgress(parent=mw),
                        callbacks=QtCallbacks(parent=mw))

# Choose test location
tests = [

    # (-19.1, 74.16, dt.utcnow()),              # Indian Ocean
    # (72.852028, -67.315431, dt.utcnow())      # Baffin Bay
    # (18.2648113, 16.1761115, dt.utcnow()),    # in land -> middle of Africa
    # (39.725989, -104.967745, dt.utcnow())     # in land -> Denver, CO
    (37.985427, -76.311156, dt.utcnow()),  # Chesapeake Bay
    # (39.162802, -75.278057, dt.utcnow()),     # Deleware Bay
Exemple #17
0
def main():
    app = QtWidgets.QApplication(argv)
    game = MainGame()
    app.exec_()
Exemple #18
0
def run():
    app = QtWidgets.QApplication(sys.argv)
    form = GuiWidgetBimTester()
    form.show()
    sys.exit(app.exec_())
Exemple #19
0
            round(Decimal(self.optDict[textToExclude]), 2))
        self.value_available_label.setText(strToWrite)

    def numberEntered(self):
        self.count_change += 1
        if self.count_change < 2:
            currText = self.valueEdit.text()
            shiftedText = funs.shift(currText)
            self.valueEdit.setText(shiftedText)
            if shiftedText == currText:
                self.count_change -= 1
        else:
            self.count_change = 0

    def getInputs(self):
        self.inputs['srcName'] = self.sourceCombo.currentText()
        self.inputs['dstName'] = self.destCombo.currentText()
        self.inputs['Date'] = self.dateEdit.date().toString('dd/MM/yyyy')
        self.inputs['Value'] = float(self.valueEdit.text())
        self.accept()


if __name__ == "__main__":
    financHelper = QtWidgets.QApplication([])
    parent = QtWidgets.QFrame()
    accTotal = {"Todas": 30, "Debit1": 10, "Debit2": 20}
    wind = Create(parent, accTotal)
    if wind.exec_():
        print(wind.inputs)
    wind.show()
    financHelper.exec_()
Exemple #20
0
def main():

    app = QtWidgets.QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
Exemple #21
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    ex = ViewController()
    sys.exit(app.exec_())
Exemple #22
0
def main():
    app = QtWidgets.QApplication()
    MainWindow().run(app)
Exemple #23
0
        self.textItem.setPos(x + dx, y)

    def start_clicked(self):
        if not self.textItem:
            self.textItem = QtWidgets.QGraphicsTextItem()
            self.textItem.setPos(
                0,
                self.centralwidget.frameGeometry().height() // 2)
            self.textItem.setPlainText('<-- @ _ @ -->')
            self.textItem.setTextWidth(200)
            self.sceneView.addItem(self.textItem)

        if not self.timer.isActive():
            self.timer.start(10)

    def stop_clicked(self):
        if self.timer.isActive():
            self.timer.stop()


class MainWindow(widgets.QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)


if __name__ == '__main__':
    app = widgets.QApplication(sys.argv)
    frame = MainWindow()
    frame.show()
    sys.exit(app.exec_())
Exemple #24
0
        # Add image
        logo = qtg.QPixmap('logo.png')
        heading.setPixmap(logo)
        if logo.width() > 400:
            logo = logo.scaledToWidth(400, qtc.Qt.SmoothTransformation)

        # Create images
        go_pixmap = qtg.QPixmap(qtc.QSize(32, 32))
        stop_pixmap = qtg.QPixmap(qtc.QSize(32, 32))
        go_pixmap.fill(qtg.QColor('green'))
        stop_pixmap.fill(qtg.QColor('red'))

        # Create icon
        connect_icon = qtg.QIcon()
        connect_icon.addPixmap(go_pixmap, qtg.QIcon.Active)
        connect_icon.addPixmap(stop_pixmap, qtg.QIcon.Disabled)

        self.submit.setIcon(connect_icon)
        self.submit.setDisabled(True)
        inputs['Server'].textChanged.connect(
            lambda x: self.submit.setDisabled(x == '')
        )

        self.show()


if __name__ == '__main__':
    app = qtw.QApplication(sys.argv)
    mw = MainWindow()
    sys.exit(app.exec_())
Exemple #25
0
                        self.textEdit.toPlainText() + "\n")
        elif self.listWidget.item(3).isSelected():
            pippo.write("source leaprc.water.opc \n")
            pippo.write("solvatebox " + self.textEdit_name.toPlainText() +
                        " " + self.listWidget.currentItem().text() + " " +
                        self.textEdit.toPlainText() + "\n")

        if self.checkBox_charge.isChecked():
            pippo.write("charge " + self.textEdit_name.toPlainText() + "\n")

        if self.checkBox_params.isChecked():
            pippo.write("check " + self.textEdit_name.toPlainText() + "\n")

        pippo.write("saveamberparm " + self.textEdit_name.toPlainText() + " " +
                    self.textEdit_name.toPlainText() + ".parm7 " +
                    self.textEdit_name.toPlainText() + ".inpcrd\n")

        pippo.close()


###########################################

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    aaWindow = QtWidgets.QMainWindow()
    ui = Ui_aaWindow()
    ui.setupUi(aaWindow)
    aaWindow.show()
    sys.exit(app.exec_())
Exemple #26
0
def main():
    app = QtWidgets.QApplication(["test_app"])
    mg = MyGui()
    mg.show()
    app.exec_()
def main():
    app = qw.QApplication([]) if not qw.QApplication.instance() else None
    VirusOp()
    app.exec_() if app else None
def main():
    app = QtWidgets.QApplication([])
    w = Demo()
    w.show()
    app.exec_()
Exemple #29
0
def main():
    app = QtWidgets.QApplication(sys.argv)  # Новый экземпляр QApplication
    window = ExampleApp()  # Создаём объект класса ExampleApp
    window.show()  # Показываем окно
    app.exec_()  # и запускаем приложение
Exemple #30
0
def window():
    app = QtWidgets.QApplication(sys.argv)
    win = MyWindow()
    win.show()
    sys.exit(app.exec_())