Пример #1
0
def main():
	app = QApplication([])
	styles.dark(app)

	g = windows.ModernWindow(Processing_Agent())
	# g.resize(350,100)
	g.move(50,270)
	g.setWindowTitle('Neuropixels Surgery/Experiment Notes')
	g.show()
	app.exec_()
Пример #2
0
    def __init__(self):
        # Create Application
        self.app = qt.QApplication(sys.argv)

        # Initialize parent class
        super().__init__()

        # High DPI App
        self.app.setAttribute(core.Qt.AA_UseHighDpiPixmaps)

        # Set Modern Style of App
        mstyle.dark(self.app)
Пример #3
0
def main():
    print(str(QStyleFactory.keys()))

    app = QApplication(sys.argv)

    dark(app)

    stylesheet = """
                    QTableWidget { 
                        background-color: rgb(80, 80, 80);
                    }
    
                    QPushButton { 
                        background-color: rgb(90,70,0); 
                    }
                    QCheckBox::indicator  {
                        width: 15px;
                        height: 15px;
                        margin: 4px;
                        border-radius: 5px;
                        border: 3px solid rgb(120,90,0); 
                    }
                    QCheckBox::indicator::unchecked  {
                        background-color: transparent rgb(80, 80, 80);
                    }
                    QCheckBox::indicator::checked {
                        background-color: rgb(150,120,0);
                    }
                    """

    app.setStyleSheet(stylesheet)

    window = MainWindow()
    window.setWindowFlags(QtCore.Qt.CustomizeWindowHint
                          | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool)
    window.move(0, 0)
    window.setGeometry(QtCore.QRect(300, 300, 640,
                                    480))  # arbitrary size/location

    #    sizegrip = QtWidgets.QSizeGrip(window)
    #    window.horizontalLayout_2.addWidget(sizegrip, 0, QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight)

    mw = ModernWindow(window)

    mw.show()
    #    main_window.show()

    #    main_window.show()
    sys.exit(app.exec_())
Пример #4
0
    def __init__(self, arguments):
        super().__init__()

        # build the entire interface
        self.__create_interface(arguments)

        self.show()

        # import a graph from the get-go, if it's provided
        if arguments.import_path is not None:
            self.canvas.import_graph(arguments.import_path)

        # set to light by default (unless there is an argument to set it to dark)
        if arguments.dark:
            styles.dark(QApplication.instance())
        else:
            styles.light(QApplication.instance())
def main():
    """
    Boilerplate PyQT init
    :return:
    """
    visual_behavior.init_log()
    app = QApplication(sys.argv)
    main_window = StageUI()
    main_window.setFixedWidth(600)
    main_window.setFixedHeight(575)
    hostname = socket.gethostname()
    main_window.setWindowTitle(f'Stage Controller ({hostname})')
    styles.dark(app)
    styled_window = windows.ModernWindow(main_window)
    styled_window.show()
    app.exec_()
    sys.exit()
Пример #6
0
def init():
    QCoreApplication.setApplicationName(__title__)
    QCoreApplication.setOrganizationName('Ketsu8')
    QCoreApplication.setApplicationVersion(__version__)
    app = QApplication([])

    from warnings import filterwarnings
    filterwarnings('ignore')

    from qtmodern.styles import dark
    dark(app)

    from resources import __resourcesDirectory__
    from os.path import join
    splashPicture = QPixmap(join(__resourcesDirectory__, 'splash.png'))
    splashScreen = QSplashScreen(splashPicture, Qt.WindowStaysOnTopHint)
    splashScreen.setWindowFlags(Qt.WindowStaysOnTopHint
                                | Qt.FramelessWindowHint)
    splashScreen.setEnabled(False)

    progressBar = QProgressBar(splashScreen)
    progressBar.setMaximum(10)
    progressBar.setTextVisible(False)
    progressBar.setGeometry(160, 250, 200, 20)
    splashScreen.show()

    from time import time
    for i in range(1, 2):
        progressBar.setValue(i)
        t = time()
        while time() < t + 0.2:
            app.processEvents()

    from updates import checkUpdatesAvailable
    if checkUpdatesAvailable() == True: print('Update available.')

    window = MainWindow()
    window.setMinimumSize(300, 400)
    window.resize(740, 512)
    window.show()
    splashScreen.finish(window)

    app.exec_()
Пример #7
0
    def __create_interface(self, arguments):
        """A method that creates the entire interface."""
        # Canvas (main widget)
        self.line_edit = QLineEdit(self)

        self.canvas = Canvas(self.line_edit, self, self.update_ui)
        self.canvas.setMinimumSize(100, 200)  # reasonable minimum size
        self.setCentralWidget(self.canvas)

        # Top menu bar
        self.menubar = self.menuBar()

        ## menu bar separator
        self.sep = QAction()
        self.sep.setSeparator(True)

        ## file menu
        self.file_menu = self.menubar.addMenu("&File")
        self.file_menu.addActions([
            QAction("&Import",
                    self,
                    triggered=lambda: self.canvas.import_graph()),
            QAction("&Export",
                    self,
                    triggered=lambda: self.canvas.export_graph()),
            self.sep,
            QAction("&Quit", self, triggered=exit),
        ])

        ## preference menu
        self.preferences_menu = self.menubar.addMenu("&Preferences")
        self.preferences_menu.addAction(
            QAction(
                "&Dark Theme",
                self,
                checkable=True,
                checked=arguments.dark,
                triggered=partial(
                    lambda x, y: styles.dark(x) if y else styles.light(x),
                    QApplication.instance(),
                ),
            ))

        ## algorithm menu
        self.help_menu = self.menubar.addMenu("&Algorithms")
        self.help_menu.addAction(
            QAction("&Run", self, triggered=self.canvas.run_algorithm))

        ## help menu
        self.help_menu = self.menubar.addMenu("&Help")
        self.help_menu.addActions([
            QAction(
                "&About",
                self,
                triggered=lambda: QMessageBox.information(
                    self,
                    "About",
                    "This application was created as a semester project for a "
                    "programming class at <a href='https://www.mff.cuni.cz/en'>MFF UK</a> "
                    "by Tomáš Sláma. It's open source (see the tab below) and licensed "
                    "under MIT, so do as you please with the code and anything else "
                    "related to the project.",
                ),
            ),
            QAction(
                "&Source Code",
                self,
                triggered=partial(
                    # TODO: make non-blocking
                    webbrowser.open,
                    "https://github.com/xiaoxiae/Grafatko",
                ),
            ),
        ])

        # dock
        self.dock_menu = QDockWidget("Settings", self)
        self.dock_menu.setAllowedAreas(Qt.BottomDockWidgetArea)
        self.dock_menu.setFeatures(QDockWidget.DockWidgetFloatable)

        layout = QGridLayout()

        ## widgets
        self.directed_checkbox = QCheckBox("directed",
                                           self,
                                           toggled=self.set_directed)

        self.weighted_checkbox = QCheckBox(
            "weighted",
            self,
            toggled=lambda value: self.canvas.get_graph().set_weighted(value),
        )

        self.reorient_pushbutton = QPushButton(
            "reorient",
            self,
            pressed=lambda: self.canvas.get_graph().reorient())

        self.pause_pushbutton = QPushButton(
            "pause",
            self,
            pressed=lambda: self.canvas.get_graph().pause_animations(),
        )

        self.resume_pushbutton = QPushButton(
            "resume",
            self,
            pressed=lambda: self.canvas.get_graph().resume_animations(),
        )

        self.clear_pushbutton = QPushButton(
            "clear",
            self,
            pressed=self.clear_animations,
        )

        self.labels_checkbox = QCheckBox(
            "labels",
            self,
            toggled=lambda value: self.canvas.get_graph().set_show_labels(value
                                                                          ),
            checked=True,
        )

        self.gravity_checkbox = QCheckBox(
            "gravity",
            self,
            toggled=lambda value: self.canvas.set_forces(value),
            checked=True,
        )

        self.complement_pushbutton = QPushButton(
            "complement",
            self,
            pressed=lambda: self.canvas.get_graph().complement())

        widgets = {
            (0, 0): QLabel(self, text="Graph"),
            (1, 0): self.directed_checkbox,
            (2, 0): self.weighted_checkbox,
            (0, 1): QLabel(self, text="Visual"),
            (1, 1): self.labels_checkbox,
            (2, 1): self.gravity_checkbox,
            (0, 2): QLabel(self, text="Actions"),
            (1, 2): self.complement_pushbutton,
            (2, 2): self.reorient_pushbutton,
            (0, 3, 1, 2): QLabel(self, text="Animations"),
            (1, 3, 1, 1): self.pause_pushbutton,
            (1, 4, 1, 1): self.resume_pushbutton,
            (2, 3, 1, 2): self.clear_pushbutton,
            (3, 0, 1, -1): self.line_edit,
        }

        ## add all widgets to the dock
        for k, v in widgets.items():
            layout.addWidget(v, *k)

        self.dock_widget = QWidget()
        self.dock_widget.setLayout(layout)

        ### Set the dock menu as the dock widget for the app
        self.dock_menu.setWidget(self.dock_widget)
        self.addDockWidget(Qt.BottomDockWidgetArea, self.dock_menu)

        self.setWindowIcon(QIcon("icon.ico"))
        self.setWindowTitle("Grafátko")
        self.update_ui()
Пример #8
0
def setModern():
    styles.dark(QApplication.instance())
Пример #9
0
        print(value)

    def slotPenWidth(self, value):
        self.image_viewer.setPendWidth(value)
        print(value)

    def slotPenColor(self):
        color = QColorDialog.getColor(Qt.black)
        self.penColorFrame.setPalette(QPalette(color))
        self.image_viewer.setPenColor(color)
        print(color)

    def cutImgClicked(self):
        self.image_viewer.cutImage()

    def enlarge(self):
        self.image_viewer.enlarge()

    def narrow(self):
        self.image_viewer.narrow()

    def reduction(self):
        self.image_viewer.reduction()


app = QApplication(sys.argv)
dark(app)
window = DefectDetect()
window.setWindowTitle("缺陷检测")
window.show()
sys.exit(app.exec_())
Пример #10
0
def setModern():
    styles.dark(QApplication.instance())
    QApplication.instance().setStyleSheet(pyqtgraph_parametertree_fixes)
Пример #11
0
        for i, p in enumerate(self.points[:-1]):
            next_point = self.points[i + 1]
            if ((p.x() != -1 and p.y() != -1)
                    and (next_point.x() != -1 and next_point.y() != -1)):
                self.painter.drawLine(p.x(), p.y(), next_point.x(),
                                      next_point.y())

    def fill_grid(self):
        self.grid.addWidget(self.save_img, 0, 0)
        self.grid.addWidget(self.clean_pixmap, 1, 0)
        self.grid.addWidget(self.fill_by_image_box, 1, 1)
        self.grid.addWidget(self.choose_img, 2, 0)
        self.grid.addWidget(self.choose_color, 2, 1)
        self.grid.addWidget(self.label, 0, 2, 3, 1)

    def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())


if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = MainWindow()
    styles.dark(app)
    mw = windows.ModernWindow(win)
    mw.show()
    # win.show()
    sys.exit(app.exec_())