예제 #1
0
    def __init__(self, window, left, top, width, height):
        '''생성자'''
        super().__init__()
        self.setGeometry(left, top, width, height)

        # 메인 레이아웃
        mainLayout = QVBoxLayout()

        # 로고 이미지, 설명 문구
        logo = QLabel()
        logo.setPixmap(QPixmap(resource_path('logo.png')))
        logo.setAlignment(Qt.AlignCenter)
        message = QLabel()
        message.setAlignment(Qt.AlignCenter)

        loadingAnimation = QMovie(resource_path('loading.gif'))
        loading = QLabel()
        loading.setMovie(loadingAnimation)
        loading.setAlignment(Qt.AlignCenter)
        loadingAnimation.start()

        buttonLayout = QHBoxLayout()

        homeButton = QPushButton('처음으로')
        homeButton.clicked.connect(window.showMainWidget)
        openButton = QPushButton('결과 폴더 열기')
        openButton.clicked.connect(self.openResultPath)

        buttonLayout.addStretch(1)
        buttonLayout.addWidget(homeButton)
        buttonLayout.addWidget(openButton)
        buttonLayout.addStretch(1)

        mainLayout.addStretch(1)
        mainLayout.addWidget(logo)
        mainLayout.addSpacing(50)
        mainLayout.addWidget(loading)
        mainLayout.addSpacing(20)
        mainLayout.addWidget(message)
        mainLayout.addLayout(buttonLayout)
        mainLayout.addStretch(2)

        self.loading = loading
        self.message = message
        self.homeButton = homeButton
        self.openButton = openButton
        self.setLayout(mainLayout)
        self.setFixedSize(width, height)
예제 #2
0
    def __init__(self, app: QApplication, parent=None):

        super(MainWindow, self).__init__(parent)
        self.updateTimer = None
        self.app = app
        self.setWindowTitle(QCoreApplication.applicationName())
        self.setWindowIcon(QIcon(util.resource_path('../icon/logo.png')))
        self.enableq1 = False
        self.centralWidget = Central(app=app, tool=self)
        self.setCentralWidget(self.centralWidget)
        self.toolUI()
        self.updateTimer = QTimer(self)
        self.updateTimer.timeout.connect(self._update)
    def __init__(self, app, parent=None):
        super(DcycleWindow, self).__init__(parent)
        self.app = app
        self.setWindowTitle("Additional setting")
        self.setWindowIcon(QIcon(util.resource_path('../icon/error.png')))

        grid = QGridLayout()
        self.setLayout(grid)

        self.cycleBox = SettingGroupBox("Duty cycle periode", "min", 1, 30, 1)
        self.tspanBox = SettingGroupBox("Sample point", "points", 20, 30000, 1)

        grid.addWidget(self.cycleBox.gBox)
        grid.addWidget(self.tspanBox.gBox)

        self.cycleBox.setButton.clicked.connect(self.setCycle)
        self.cycleBox.resetButton.clicked.connect(self.resetCycle)
        self.tspanBox.setButton.clicked.connect(self.setSpan)
        self.tspanBox.resetButton.clicked.connect(self.resetSpan)
예제 #4
0
    def __init__(self, app, parent=None):
        super(portWindow, self).__init__(parent)
        self.app = app

        button_box = QDialogButtonBox(QDialogButtonBox.Ok
                                      | QDialogButtonBox.Cancel)
        button_box.accepted.connect(self.accept)
        button_box.rejected.connect(self.reject)

        self.setWindowTitle("Port Setting")
        self.setWindowIcon(QIcon(util.resource_path('../icon/port.png')))

        self.buttons = QGroupBox()

        grid = QGridLayout()
        self.setLayout(grid)

        portCbox = QComboBox()
        found_ports = []
        for port in list(list_ports.comports()):
            found_ports.append(port.device)
        portCbox.addItems(found_ports)
        grid.addWidget(QLabel("Port: "), 1, 0, 1, 2)
        grid.addWidget(portCbox, 1, 2, 1, 2)

        speedCbox = QComboBox()
        speedCbox.addItems(speed)
        grid.addWidget(QLabel("Baud Rate: "), 3, 0, 1, 2)
        grid.addWidget(speedCbox, 3, 2, 1, 2)

        #need to debug
        self.port = portCbox.currentText()
        self.speed = float(speedCbox.currentText())

        layout = QFormLayout()
        layout.addWidget(button_box)
        self.buttons.setLayout(layout)
        grid.addWidget(self.buttons, 4, 0, 1, 4)
 def __init__(self):
     super(ConfirmAccountWindow, self).__init__()
     self.form_widget = ConfirmAccountWidget(self)
     self.setCentralWidget(self.form_widget)
     self.setWindowIcon(QIcon(resource_path(join('assets', 'icon.png'))))
예제 #6
0
    def __init__(self, window, left, top, width, height, cpu_count):
        '''생성자

        Parameters
        ----------
        left : int, required
            좌측 여백
        top : int, required
            상단 여백
        width : int, required
            폭
        height : int, required
            높이
        cpu_count : int, required
            CPU 코어 수
        '''
        super().__init__()
        self.window = window
        self.setGeometry(left, top, width, height)
        self.chromeDriver = ''
        self.parserCount = 1
        self.downloaderCount = 1

        # 메인 레이아웃
        mainLayout = QVBoxLayout()

        # 로고 이미지, 설명 문구
        logo = QLabel()
        logo.setPixmap(QPixmap(resource_path('logo.png')))
        logo.setAlignment(Qt.AlignCenter)
        description = QLabel('싸이월드의 사진들로 추억을 간직하세요')
        description.setAlignment(Qt.AlignCenter)

        # 계정 정보 레이아웃
        accountForm = QFormLayout()
        emailLabel = QLabel('E-Mail')
        emailField = QLineEdit(self)
        self.emailField = emailField

        passwordLabel = QLabel('Password')
        passwordField = QLineEdit(self)
        passwordField.setEchoMode(QLineEdit.Password)
        self.passwordField = passwordField

        accountForm.addRow(emailLabel, emailField)
        accountForm.addRow(passwordLabel, passwordField)

        accountLayout = QHBoxLayout()
        accountLayout.addStretch(1)
        accountLayout.addLayout(accountForm)
        accountLayout.addStretch(1)

        # 설정 폼 레이아웃
        optionLayout = QVBoxLayout()

        # 크롬 드라이버 옵션 레이아웃
        chromeDriverLayout = QFormLayout()
        chromeDriverLabel = QLabel('Chrome Driver')
        chromeDriverButton = QPushButton('불러오기')
        chromeDriverButton.clicked.connect(self.onDriverSelect)

        chromeDriverLayout.addRow(chromeDriverLabel, chromeDriverButton)

        # 파서, 다운로더 옵션 영역 (#1)
        primaryOptionLayout = QFormLayout()
        parserLabel = QLabel('Parser')
        parserOption = QComboBox(self)
        for i in range(cpu_count):
            parserOption.addItem(str(i + 1))
        parserOption.currentIndexChanged.connect(self.onParserOption)
        parserOption.setCurrentIndex(int(cpu_count / 2) - 1)

        downloaderLabel = QLabel('Downloader')
        downloaderOption = QComboBox(self)
        for i in range(cpu_count):
            downloaderOption.addItem(str(i + 1))
        downloaderOption.currentIndexChanged.connect(self.onDownloaderOption)
        downloaderOption.setCurrentIndex(int(cpu_count / 2) - 1)

        primaryOptionLayout.addRow(parserLabel, parserOption)
        primaryOptionLayout.addRow(downloaderLabel, downloaderOption)

        # 네트워크 대기시간, 지연시간 옵션 영역 (#2)
        secondaryOptionLayout = QFormLayout()
        timeoutLabel = QLabel('Timeout')
        timeoutField = QLineEdit('10')
        timeoutField.setFixedWidth(50)
        self.timeoutField = timeoutField

        delayLabel = QLabel('Delay')
        delayField = QLineEdit('3')
        delayField.setFixedWidth(50)
        self.delayField = delayField

        secondaryOptionLayout.addRow(timeoutLabel, timeoutField)
        secondaryOptionLayout.addRow(delayLabel, delayField)
        secondaryOptionLayout.setContentsMargins(0, 2, 0, 0)

        mergeOptionLayout = QHBoxLayout()
        mergeOptionLayout.addStretch()
        mergeOptionLayout.addLayout(primaryOptionLayout)
        mergeOptionLayout.addLayout(secondaryOptionLayout)
        mergeOptionLayout.addStretch()

        chromeHLayout = QHBoxLayout()
        chromeHLayout.addStretch(1)
        chromeHLayout.addLayout(chromeDriverLayout)
        chromeHLayout.addStretch(1)

        optionLayout.addLayout(chromeHLayout)
        optionLayout.addLayout(mergeOptionLayout)

        # 개발자 및 깃허브 정보
        style = 'style="color: #888888; text-decoration: none;"'
        href_profile = 'href="https://github.com/leegeunhyeok"'
        developer = QLabel('<a {} {}>Developed by leegeunhyeok</a>'.format(
            style, href_profile))
        developer.setAlignment(Qt.AlignCenter)
        developer.setOpenExternalLinks(True)

        # 하단 레이아웃 (시작 버튼 영역)
        bottomLayout = QHBoxLayout()
        startButton = QPushButton('시작하기')
        startButton.clicked.connect(self.onStart)
        bottomLayout.setAlignment(Qt.AlignCenter)
        bottomLayout.addWidget(startButton)

        # 메인 레이아웃에 모든 요소 추가
        mainLayout.addWidget(logo)
        mainLayout.addWidget(description)
        mainLayout.addStretch(1)
        mainLayout.addLayout(accountLayout)
        mainLayout.addStretch(1)
        mainLayout.addLayout(optionLayout)
        mainLayout.addLayout(bottomLayout)
        mainLayout.addStretch(1)
        mainLayout.addWidget(developer)

        self.setLayout(mainLayout)
        self.setFixedSize(width, height)
예제 #7
0
    multiprocessing.set_start_method('spawn')
    logo = '''
                ,000,
                0   0
                '000'
                  0
                  0
           ,0000000000000,
        ,0'000000000000000'0,
      ,00000`           `00000,
     ,0000`  @         @  `0000,
     0000`   @   ,00   @   `0000
     0000       00          0000
     0000,       '00       ,0000
     '0000,   (_______)   ,0000'
      '00000,          ,00000'
        '0,000000000000000,0'
           '0000000000000'

                CyBot

          GUI VERSION 1.0.0
    '''
    print(logo, end='\n\n')
    print('알림: 잠시만 기다려주세요..')
    print('알림: 이 창은 절대 닫지 마세요!')
    app = QApplication([])
    app.setWindowIcon(QIcon(resource_path('icon.ico')))
    CyWorldBot = App()
    sys.exit(app.exec_())
예제 #8
0
  def _createActions(self):
    # https://realpython.com/python-menus-toolbars/ for menu stuff later
    self.exitAct = QAction(QIcon(resource_path('./assets/icons/exit.png')), '&Exit', self)
    self.exitAct.setShortcut('Ctrl+Q')
    self.exitAct.setStatusTip('Exit application')
    self.exitAct.triggered.connect(qApp.quit)

    self.copyAct = QAction(QIcon(resource_path('./assets/icons/copy.png')), '&Copy', self)
    self.copyAct.setShortcut('Ctrl+C')
    self.copyAct.setStatusTip('Copy entire board')
    self.copyAct.triggered.connect(self.copy)

    self.mainActs = QActionGroup(self)

    self.selectAct = QAction(QIcon(resource_path('./assets/icons/select.ico')), '&Select', self.mainActs)
    self.selectAct.setShortcut('Shift+S')
    self.selectAct.setStatusTip('Select board part for copying.')
    self.selectAct.setCheckable(True)
    self.selectAct.setEnabled(True)
    self.selectAct.toggled.connect(self.view.toggleBand)

    self.undoAct = QAction(QIcon(resource_path('./assets/icons/undo.ico')), '&Undo', self)
    self.undoAct.setShortcut('Ctrl+Z')
    self.undoAct.setStatusTip('Undo most recent action')
    self.undoAct.setEnabled(True)
    self.undoAct.triggered.connect(self.scene.undo)

    self.redoAct = QAction(QIcon(resource_path('./assets/icons/redo.ico')), '&Redo', self)
    self.redoAct.setShortcut('Ctrl+Y')
    self.redoAct.setStatusTip('Redo most recent action')
    self.redoAct.setEnabled(True)
    self.redoAct.triggered.connect(self.scene.redo)


    self.ccwAct = QAction(QIcon(), '&Counterclockwise')
    self.ccwAct.setShortcut('Q')
    self.ccwAct.setStatusTip('Rotate counterclockwise')
    self.ccwAct.setEnabled(False)
    self.ccwAct.triggered.connect(self.scene.cursor.ccw)

    self.cwAct = QAction(QIcon(), '&Clockwise')
    self.cwAct.setShortcut('W')
    self.cwAct.setStatusTip('Rotate clockwise')
    self.cwAct.setEnabled(False)
    self.cwAct.triggered.connect(self.scene.cursor.cw)

    pieceNames = ['T','J','Z','O','S','L','I']
    self.pieceActs = []
    for i in range(7):
      pieceAct = QAction(QIcon(resource_path(f'./assets/icons/icon{pieceNames[i]}.ico')), pieceNames[i], self.mainActs)
      pieceAct.setShortcut(pieceNames[i])
      pieceAct.setStatusTip(f'Draw the {pieceNames[i]} piece')
      pieceAct.setCheckable(True)
      # Ugly solution but it works
      pieceAct.triggered.connect(lambda x=False,i=i: self.scene.cursor.setType([i, 0]))
      pieceAct.triggered.connect(lambda : self.ccwAct.setEnabled(True))
      pieceAct.triggered.connect(lambda : self.cwAct.setEnabled(True))
      self.pieceActs.append(pieceAct)

    self.cellActs = []
    icons = [
      QIcon(QPixmap(resource_path('./assets/tile0.png')).scaled(16, 16)),
      QIcon(resource_path('./assets/icons/whiteCell.ico')),
      QIcon(resource_path('./assets/icons/darkCell.ico')),
      QIcon(resource_path('./assets/icons/lightCell.ico')),
      QIcon(resource_path('./assets/icons/stack.ico'))
    ]
    names = ['&Erase', '&White Cell', '&Dark Cell', '&Light Cell', '&Stack Mode']
    shortcuts = ['E', '1', '2', '3', 'C']
    tips = ['Erase cell', 'Paint the white cell', 'Paint the dark cell', 'Paint the light cell', 'Fill basic stack']

    for i in range(5):
      cellAct = QAction(icons[i], names[i], self.mainActs)
      cellAct.setShortcut(shortcuts[i])
      cellAct.setStatusTip(tips[i])
      cellAct.setCheckable(True)
      if i == 4:
        cellAct.triggered.connect(lambda : self.scene.setColCursor())
      else:
        cellAct.triggered.connect(lambda x=False,i=i : self.scene.setCellState(i))
      cellAct.triggered.connect(lambda : self.ccwAct.setEnabled(False))
      cellAct.triggered.connect(lambda : self.cwAct.setEnabled(False))
      self.cellActs.append(cellAct)

    self.cellActs[1].setChecked(True)

    self.transparentAct = QAction(QIcon(), '&Transparent')
    self.transparentAct.setShortcut('Ctrl+V')
    self.transparentAct.setStatusTip('Draw with transparent cells')
    self.transparentAct.setCheckable(True)
    self.transparentAct.triggered.connect(lambda x : self.scene.setTransparentDraw(x))

    self.rgbAct = QAction(QIcon(), '&Option Colors')
    self.rgbAct.setShortcut('Ctrl+A')
    self.rgbAct.setStatusTip('Tint drawn objects with varying colors')
    self.rgbAct.setCheckable(True)

    self.connectStatusAct = QAction(QIcon(), '&Enable/Disable', self)
    self.connectStatusAct.triggered.connect(self.enableTracking)

    self.toggleMirrorAct = QAction(QIcon(), '&Toggle Mirror', self)
    self.toggleMirrorAct.setShortcut('Ctrl+M')
    self.toggleMirrorAct.setEnabled(False)
    self.toggleMirrorAct.triggered.connect(self.toggleMirror)
예제 #9
0
def main():
  app = QApplication(sys.argv)
  app.setWindowIcon(QIcon(resource_path('./assets/mainIcon.png')))
  ex = StackMaker()
  sys.exit(app.exec_())
예제 #10
0
    def toolUI(self):
        portAction = QAction(QIcon(util.resource_path('../icon/port.png')), 'Port Setting', self)
        portAction.setStatusTip("Set the port to Arduino")

        dcycleAction = QAction(QIcon(util.resource_path('../icon/error.png')), 'More Setting', self)
        dcycleAction.setStatusTip("reset time period for duty cycle")
        self.dcycleWindow = cycledialog.DcycleWindow(app=self.app)

        rqrdToolBar = self.addToolBar('required setting')
        rqrdToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        rqrdToolBar.addAction(portAction)
        rqrdToolBar.addAction(dcycleAction)

        startstopAction = QAction(QIcon(util.resource_path('../icon/play.png')), 'Start/Stop', self)
        startstopAction.setStatusTip("Click to play/stop the DAQ system")


        startstopToolBar = self.addToolBar('play pause')
        startstopToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        startstopToolBar.addAction(startstopAction)
        self.startstopButton = startstopToolBar.widgetForAction(startstopAction)
        self.startstopButton.setEnabled(False)
        self.startstopButton.setCheckable(True)
        self.startstopButton.setChecked(False)

        mainAction = QAction(QIcon(util.resource_path('../icon/main.png')), 'On/Off Heater 1', self)
        mainAction.setStatusTip("Click to on/off main heater")

        mainToolBar = self.addToolBar('Q1 heater')
        mainToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        mainToolBar.addAction(mainAction)
        self.mainButton = mainToolBar.widgetForAction(mainAction)
        self.mainButton.setEnabled(False)
        self.mainButton.setCheckable(True)
        self.mainButton.setChecked(False)

        distAction = QAction(QIcon(util.resource_path('../icon/dist.png')), 'On/Off Heater 2', self)
        distAction.setStatusTip("click to on/off disturbance heater")


        distToolBar = self.addToolBar('Q2 heater')
        distToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        distToolBar.addAction(distAction)
        self.distButton = distToolBar.widgetForAction(distAction)
        self.distButton.setEnabled(False)
        self.distButton.setCheckable(True)
        self.distButton.setChecked(False)

        forceAction = QAction(QIcon(util.resource_path('../icon/stop.png')), 'Force Stop', self )
        forceAction.setStatusTip("Apply emergency stop")
        forceAction.setEnabled(False)

        forceToolBar = self.addToolBar("Emergency")
        forceToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        forceToolBar.addAction(forceAction)
        self.forceButton = forceToolBar.widgetForAction(forceAction)
        self.forceButton.setEnabled(False)
        self.forceButton.setCheckable(True)
        self.forceButton.setChecked(False)

        self.statusBar().show()

        portAction.triggered.connect(self.setport)
        dcycleAction.triggered.connect(self.dcycleWindow.show)
        startstopAction.triggered.connect(self.startstop)
        mainAction.triggered.connect(self.setmain)
        distAction.triggered.connect(self.setdist)
        forceAction.triggered.connect(self.forcestop)