Exemple #1
0
    def expand(self):
        if self.is_expanded:
            return
        self.is_expanded = True
        self.setAcceptDrops(False)
        self.content.hide()
        expanded = self.frame.sizeHint()
        self.setMinimumSize(expanded)
        self.content.setCurrentWidget(self.frame)
        self.content.show()
        self.resize(expanded)

        # on OSX the window will not automatically stay inside the screen like on Linux
        # we have to do it manually
        screen_rect = QDesktopWidget().screenGeometry()
        window_rect = self.frameGeometry()
        intersection = window_rect & screen_rect
        dx = window_rect.width() - intersection.width()
        dy = window_rect.height() - intersection.height()
        unseen = window_rect & intersection
        if dx != 0 or dy != 0:
            if window_rect.left() > screen_rect.left():
                dx = dx * -1
            if window_rect.bottom() > screen_rect.bottom():
                dy = dy * -1
            self.move(window_rect.left() + dx, window_rect.top() + dy)
Exemple #2
0
    def initUI(self, parent):
        width = 450
        height = 140
        desktop = QDesktopWidget().availableGeometry()
        d_bottom = desktop.bottom()
        d_right = desktop.right()

        self.setGeometry(d_right-width-10, d_bottom-height-10, width, height)
        # Notification text of starting live.
        lblNotice = QLabel(self)
        lblNotice.setFont(QFont("Yu Gothic", 12))
        lblNotice.setGeometry(QRect(20, 10, width-25, 20))
        lblNotice.setText(parent.localized_text("started"))
        # Close Button
        btnClose = CloseButton(self)
        btnClose.setFlat(True)
        btnClose.clicked.connect(self.close)
        btnClose.setIcon(QIcon(QPixmap("./img/close_button.png")))
        btnClose.setIconSize(QSize(20, 20))
        btnClose.setGeometry(width-32, 4, 30, 30)
        # ListBox
        listView = VideoItemList(self, self.already_open_browser)
        listView.setGeometry(20, 40, width-55, 80)
        listView.itemClicked.connect(self.onItemClicked)

        for video in self.videos:
            # 動画情報アイテム
            item = VideoItem(video)
            listView.addItem(item)
            if not self.already_open_browser:
                listView.setToolTip('Click to open.')
        self.show()
def cv_resize_img(img_path):
    cv_img = cv2.imread(img_path)
    height, width, channel = cv_img.shape
    cv2.cvtColor(cv_img, cv2.COLOR_BGR2RGB, cv_img)
    cp = QDesktopWidget().availableGeometry()
    scale = height / cp.bottom() * 1.1
    cv_img = cv2.resize(cv_img, (int(width / scale), int(height / scale)))
    return cv_img, scale
Exemple #4
0
 def readSettings(self):
     self.settings.beginGroup("MainWindow")
     saved_anchor = self.settings.value("anchor", None)
     if saved_anchor != None:
         self.anchor = saved_anchor
     else:
         rect = QDesktopWidget().screenGeometry()
         mini = self.miniwin.sizeHint()
         self.anchor = QPoint(rect.right() - mini.width(),
                              rect.bottom() - mini.height())
     self.settings.endGroup()
Exemple #5
0
    def __init__(self):

        super(CollectDataWidget, self).__init__()
        screen = QDesktopWidget().screenGeometry()
        self.setGeometry(screen)
        self.setWindowTitle("Data Collection")

        self.scene = QGraphicsScene(self)
        self.scene.setSceneRect(0, 0,
                                screen.right() - self.margin,
                                screen.bottom() - self.margin)
        self.node = Node(self)
        self.scene.addItem(self.node)
        # aktualnie 3:24 z (dx,dy, lambda) = (10, 20, 20)
        text = "Keep your eyes on the blue circle - testing once begun takes ~2 min. - press <Space> to begin"
        self.text = QGraphicsTextItem(text)
        self.text.setPos(100, 0)
        self.scene.addItem(self.text)

        self.thread = CameraThread(self.node)
        self.setScene(self.scene)
        self.showFullScreen()
Exemple #6
0
    def initUI(self, parent):
        padding = 16
        item_height = 80
        title_height = 40
        list_height = min(len(self.videos), 3) * item_height
        width = 450
        height = title_height + list_height + padding
        desktop = QDesktopWidget().availableGeometry()
        d_bottom = desktop.bottom()
        d_right = desktop.right()

        self.setGeometry(d_right-width-10, d_bottom-height-10, width, height)
        # Notification text of starting live.
        lblNotice = QLabel(self)
        lblNotice.setFont(QFont("Yu Gothic", 12))
        lblNotice.setGeometry(padding, 11, width-title_height, 20)
        lblNotice.setText(parent.localized_text("started"))
        # Close Button
        btnClose = CloseButton(self)
        btnClose.setFlat(True)
        btnClose.clicked.connect(self.close)
        btnClose.setIcon(QIcon(QPixmap("./res/img/close_button.png")))
        btnClose.setIconSize(QSize(18, 18))
        btnClose.setGeometry(width-title_height, 0, title_height, title_height)
        # ListBox
        listView = VideoItemList(self, self.already_open_browser)
        listView.setGeometry(padding, title_height, width-padding*2, list_height)
        listView.itemClicked.connect(self.onItemClicked)

        for video in self.videos:
            # 動画情報アイテム
            item = VideoItem(video, item_height)
            listView.addItem(item)
            if not self.already_open_browser:
                listView.setToolTip('Click to open')
        self.show()