Ejemplo n.º 1
3
 def mouseReleaseEvent(self, ev: QtGui.QMouseEvent):
     if ev.button() == QtCore.Qt.LeftButton:
         self.is_pan = False
         self.setCursor(QtCore.Qt.ArrowCursor)
         ev.accept()
     else:
         ev.ignore()
Ejemplo n.º 2
0
 def mousePressEvent(self, ev: QtGui.QMouseEvent):
     if ev.button() == QtCore.Qt.LeftButton:
         self.is_pan = True
         self.setCursor(QtCore.Qt.ClosedHandCursor)
         self.coords = ev.x(), ev.y()
         ev.accept()
     else:
         ev.ignore()
Ejemplo n.º 3
0
    def mousePressEvent(self, event: QMouseEvent):
        """
        Click on mouse button

        :param event: mouse event
        """
        if event.button() == Qt.LeftButton:
            # trigger scene signal
            self.scene().node_clicked.emit(self.metadata)
Ejemplo n.º 4
0
 def mouseReleaseEvent(self, event: QMouseEvent):
     button = event.button()
     if button == Qt.LeftButton:
         if self._mouse_over_planet_name:
             # logger.debug('planet name click')
             self.setCursor(Qt.ArrowCursor)  # sometimes cursor is not restored to arrow
             self.requestOpenPlanet.emit(self._planet.planet_id)
         elif self._mouse_over_planet_coords:
             # logger.debug('planet coords click')
             self.setCursor(Qt.ArrowCursor)  # sometimes cursor is not restored to arrow
             self.requestOpenGalaxy.emit(self._planet.coords)
Ejemplo n.º 5
0
 def _redirectEvent(self, event, callback, transmuteMouseEvent=False):
     if transmuteMouseEvent:
         # construct a new event with pos in canvas coordinates
         canvasPos = self.mapToCanvas(event.localPos())
         event = QMouseEvent(
             event.type(),
             canvasPos,
             event.windowPos(),
             event.screenPos(),
             event.button(),
             event.buttons(),
             event.modifiers()
         )
     callback(event)
Ejemplo n.º 6
0
 def mouseReleaseEvent(self, a0: QtGui.QMouseEvent):
     # print("main release at {}".format(a0.pos()))
     if a0.button() == Qt.LeftButton:
         # print("click on pos {}".format(self.mousePos))
         row, col = self.mousePos
         if 0 <= row <= 9 and 0 <= col <= 8:
             # if click again, cancel selecting
             if self.mousePos == self.src:
                 self.src = None
             elif self.src is None:
                 if self.controller.gameMdl.get(self.mousePos):
                     self.src = self.mousePos
             elif self.des is None:
                 self.des = self.mousePos
                 print("move pieces")
                 self.controller.moveTo(self.src, self.des)
                 self.resetFlags()
         else:
             self.resetFlags()
    def mouseDoubleClickEvent(self, event: QMouseEvent):
        """Process a double click. We use double click to deselect a
        unit.

        Parameters
        ----------
        event : QMouseEvent
        """
        if event.button() == Qt.LeftButton:
            unit, position = self._unitAtDisplayPosition(event.pos())
            if unit == self._unit:
                if self._position is None or self._position == position:
                    # double click: deactivate the unit
                    self.setUnit(None)
                else:
                    self.setPosition(position)
            else:
                self.setUnit(unit)
                self.setPosition(position)
Ejemplo n.º 8
0
    def mousePressEvent(self, evt: QtGui.QMouseEvent) -> None:
        if evt.button() == Qt.LeftButton:
            self.__dragging = True
            self.__drag_pos = self.mapToGlobal(evt.pos())

            if not evt.modifiers() & Qt.ShiftModifier:
                if self.orientation() == Qt.Horizontal:
                    self.setValue(
                        self.denormalize(
                            (evt.pos().x() - 2) / (self.width() - 5)))
                else:
                    self.setValue(
                        self.denormalize(1.0 - (evt.pos().y() - 2) /
                                         (self.height() - 5)))

            evt.accept()
            return

        super().mousePressEvent(evt)
Ejemplo n.º 9
0
    def mouseReleaseEvent(self, mouse_event: QMouseEvent):
        # if a right click occurred, open context menu
        if mouse_event.button() == Qt.RightButton:
            menu = QMenu()
            save_image = menu.addAction("Export texture")
            action = menu.exec_(mouse_event.globalPos())
            if action == save_image:
                img = self._get_texture()
                filename, _ = QFileDialog.getSaveFileName(
                    self,
                    "Save Texture",
                    filter="Image File (*.png)",
                    directory="texture.png")
                if filename:
                    img.save(filename)

        # When the mouse is released, reset the last mouse positions
        self._last_mouse_x = -1
        self._last_mouse_y = -1
Ejemplo n.º 10
0
 def mousePressEvent(self, event: QMouseEvent) -> None:
     super().mousePressEvent(event)
     if event.button() == Qt.RightButton:
         item = self.itemAt(event.pos())
         menu = QMenu()
         if isinstance(item, TriggerGroup):
             menu.addAction("New Trigger", self.menuAddNewTriggerClicked)
             menu.addAction("New Group", self.menuAddNewGroupClicked)
             if isinstance(item.container, TriggerPackage):
                 menu.addAction("Delete Package", self.menuDeletePackageClicked)
             else:
                 menu.addAction("Delete Group", self.menuDeleteGroupClicked)
         elif isinstance(item, TriggerItem):
             menu.addAction("Edit Trigger", self.menuEditTriggerClicked)
             menu.addAction("Delete Trigger", self.menuDeleteTriggerClicked)
         elif isinstance(item, type(None)):
             menu.addAction("New Package", self.menuAddNewPackageClicked)
         menu.exec(event.globalPos())
         menu.deleteLater()
Ejemplo n.º 11
0
 def mousePressEvent(self, a0: QMouseEvent) -> None:
     if a0.button() == Qt.LeftButton:
         self.dragPosition = a0.globalPos() - self.frameGeometry().topLeft()
         print(a0.localPos())
         if self.time_slider.isInside(a0.localPos().x(), a0.localPos().y()):
             print("paused")
             self.pom_timer.pause()
         if self.stop_button.isInside(a0.localPos().x(), a0.localPos().y()):
             print("Stop.")
             self.pom_timer.stop()
             self.time_slider.setPosition(0.0)
             print(self.pom_timer.state)
         if self.start_button.isInside(a0.localPos().x(),
                                       a0.localPos().y()):
             print("Start.")
             self.pom_timer.start()
             print(self.pom_timer.state)
         a0.accept()
     return super().mousePressEvent(a0)
Ejemplo n.º 12
0
    def event1(_, event, model=None, option=None, index=None):
        if not model:
            return True
        print(model, type(model.data(index)))
        print('rightbut')
        item = model.data(index)
        if event.type() == QEvent.MouseButtonPress and index.isValid():
            mouseEvent = QMouseEvent(event)
            if mouseEvent:
                if mouseEvent.button() == Qt.RightButton:
                    print('rightbut')

                    _.contextMenu.exec(
                        _.contextMenu.mapToGlobal(mouseEvent.pos()))

                    if type(item) is FunctionItem:
                        item.perform_call()
                    return True
        return False
Ejemplo n.º 13
0
 def mousePressEvent(self, event: QMouseEvent):
     if event.button() == Qt.LeftButton:
         idx = self.indexAt(event.pos())
         if idx.isValid() and idx.column() == HistoryColumns.TX_GROUP:
             tx_item = idx.internalPointer()
             txid = tx_item.get('txid')
             is_parent = ('group_label' in tx_item)
             if is_parent:
                 if txid not in self.hm.expanded_groups:
                     self.expand_tx_group(txid)
                 else:
                     self.collapse_tx_group(txid)
                 event.ignore()
                 return
             group_txid = tx_item.get('group_txid')
             if group_txid:
                 self.collapse_tx_group(group_txid)
                 event.ignore()
                 return
     super().mousePressEvent(event)
Ejemplo n.º 14
0
    def mouseReleaseEvent(self, event: QtGui.QMouseEvent) -> None:
        if event.button() == QtCore.Qt.LeftButton:
            self.settings.x2 = event.pos().x()
            self.settings.y2 = event.pos().y()

        if self.settings.x1 > self.settings.x2:
            self.settings.x2, self.settings.x1 = (
                self.settings.x1,
                self.settings.x2,
            )
        if self.settings.y1 > self.settings.y2:
            self.settings.y2, self.settings.y1 = (
                self.settings.y1,
                self.settings.y2,
            )

        self.settings.changed.emit()

        self.drag = DragMode.none
        self.update()
Ejemplo n.º 15
0
    def mouseMoveEvent(self, ev: QMouseEvent):
        if self.l_click:
            if (ev.button() == Qt.Vertical):
                n_val = self.minimum() + (
                    (self.maximum() - self.minimum() *
                     (self.height() - ev.y())) / self.height())
            else:
                n_val = self.minimum() + (
                    (self.maximum() - self.minimum()) * ev.x()) / self.width()

            if self.invertedAppearance() is True:
                self.setValue(self.maximum() - n_val)
                self.slider_moved.emit()
            else:
                self.setValue(n_val)
                self.slider_moved.emit()

            n_val = None
            ev.accept()
        self.update_slider_info()
    def eventFilter(self, watched, event):
        if watched == self.geoicolabel:
            if event.type() == QEvent.MouseButtonPress:
                mouseEvent = QMouseEvent(event)
                self.clickcount += 1
                self.addresslabel.setText("你点击了图标" + str(self.clickcount) + "次")
                if mouseEvent.button() == Qt.LeftButton:
                    if self.clickcount == 4:
                        QMessageBox.information(self, "学长真言", "你似乎发现了彩蛋\n再点击5次即可查看", QMessageBox.Yes,
                                                QMessageBox.Yes)
                    if self.clickcount == 9:
                        reply = QMessageBox.information(self, "学长真言", "金锦花是傻逼\n点击确定查看九评金锦花", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
                        if (reply == QMessageBox.Yes):
                            QDesktopServices.openUrl(QUrl(SB_jjh))
                        if (reply == QMessageBox.No):
                            pass
                        self.addresslabel.setText("地址: 吉林省长春市建设街2199号   邮编:130061  电话:0431-88502278  传真:0431-88502055")
                        self.clickcount = 0

        return QDialog.eventFilter(self, watched, event)
Ejemplo n.º 17
0
    def mousePressEvent(self, a0: QtGui.QMouseEvent):
        if not self.rubberBandActive:
            super().mousePressEvent(a0)
            return

        child = self.childAt(a0.pos())
        if isinstance(child, QToolButton):
            if self.actionSet_Position in child.actions():
                self._onSetPositionClose()
                return

        if a0.button() != Qt.LeftButton:
            self.rubberBand = None
            return

        self.rubberBand = QRubberBand(QRubberBand.Rectangle)
        self.rubberBand.setGeometry(QRect())
        self.rubberBand.move(a0.globalPos())
        self.rubberBand.show()
        self.rubberBandStartPos = a0.globalPos()
Ejemplo n.º 18
0
 def _on_central_mouse_press(self, event: QtGui.QMouseEvent):
     # print("_on_central_mouse_press")
     # add to always request a stop any current GPU work to free it up for scrolling
     view_state_ = self._view_state
     button: QtCore.Qt.MouseButton = event.button()
     if button == QtCore.Qt.LeftButton:
         if view_state_.ready_to_pan:
             self._controller.stop_request()
             view_state_.pan_start = self._mouse_frame_point(event)
             view_state_.pan_end = view_state_.pan_start
             self._set_action(enums.ImageAction.PANNING)
     elif button == QtCore.Qt.MiddleButton:
         if view_state_.ready_to_rotate:
             self._controller.stop_request()
             view_state_.rotate_start = self._mouse_frame_point(event)
             # view_state_.mandel_shape = self._window.central.mandel.shape change
             self._set_action(enums.ImageAction.ROTATING)
     elif button == QtCore.Qt.RightButton:
         if view_state_.ready_to_zoom:
             self._controller.stop_request()
             self._zoom(scaling=2.0)
Ejemplo n.º 19
0
    def mousePressMeasureEvent(
            self, measure: measured_track_editor.BaseMeasureEditor, evt: QtGui.QMouseEvent) -> None:
        assert isinstance(measure, BeatMeasureEditor), type(measure).__name__

        if (evt.button() == Qt.LeftButton and evt.modifiers() == Qt.NoModifier):
            click_time = measure.xToTime(evt.pos().x())

            for beat in measure.measure.beats:
                if beat.time == click_time:
                    with self.project.apply_mutations('%s: Remove beat' % measure.track.name):
                        measure.measure.delete_beat(beat)
                    evt.accept()
                    return

            with self.project.apply_mutations('%s: Insert beat' % measure.track.name):
                measure.measure.create_beat(click_time)
            measure.track_editor.playNoteOn(measure.track.pitch)
            evt.accept()
            return

        super().mousePressMeasureEvent(measure, evt)
Ejemplo n.º 20
0
 def mouseReleaseEvent(self, event: QMouseEvent):
     """If panning, stop. If handles were pressed, release them."""
     if self._transform_enable:
         # QMouseEvent.button() returns the button that triggered the event
         which_button = event.button()
         if which_button in [self._button_pan, self._button_pan_alt]:
             self._panDisable()
         elif which_button == self._button_zoom:
             self._dolly_zoom_enable = False
         else:
             return QGraphicsView.mouseReleaseEvent(self, event)
     # end if
     else:
         if len(self._press_list):  # Notify any pressed items to release
             # event_pos = event.pos()
             for item in self._press_list:
                 item.customMouseRelease(event)
             self._press_list = []
         # end if
         if self._selection_lock:
             self._selection_lock.processPendingToAddList()
         return QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 21
0
 def mouseReleaseEvent(self, event: QMouseEvent):
     """If panning, stop. If handles were pressed, release them."""
     if self._transform_enable:
         # QMouseEvent.button() returns the button that triggered the event
         which_button = event.button()
         if which_button in [self._button_pan, self._button_pan_alt]:
             self._panDisable()
         elif which_button == self._button_zoom:
             self._dolly_zoom_enable = False
         else:
             return QGraphicsView.mouseReleaseEvent(self, event)
     # end if
     else:
         if len(self._press_list):  # Notify any pressed items to release
             # event_pos = event.pos()
             for item in self._press_list:
                 item.customMouseRelease(event)
             self._press_list = []
         # end if
         if self._selection_lock:
             self._selection_lock.processPendingToAddList()
         return QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 22
0
    def mousePressEvent(self, event: QMouseEvent) -> None:
        pos = self.mapToScene(event.localPos().toPoint())
        x = int(pos.x())
        y = int(pos.y())
        if self.status == 'line':
            self.temp_item = MyItem(self.temp_id, self.status, [[x, y], [x, y]], self.pen_color, self.pen_width, self.temp_algorithm)
            self.scene().addItem(self.temp_item)
        elif self.status == 'ellipse':
            self.temp_item = MyItem(self.temp_id, self.status, [[x, y], [x, y]], self.pen_color, self.pen_width)
            self.scene().addItem(self.temp_item)
        elif self.status in ['polygon', 'curve']:
            if self.temp_item is None:
                self.temp_item = MyItem(self.temp_id, self.status, [[x, y]], self.pen_color, self.pen_width, self.temp_algorithm)
                self.scene().addItem(self.temp_item)
            else:
                if event.button() == Qt.RightButton:
                    self.finish_draw()
                    self.temp_item = None
                else:
                    self.temp_item.p_list.append([x, y])

        elif self.status in ['translate', 'rotate', 'scale'] and self.selected_id in self.item_dict:
            if not (self.status == 'rotate' and self.item_dict[self.selected_id].item_type == 'ellipse'):
                self.temp_id = self.selected_id
                self.temp_item = self.item_dict[self.temp_id]
                self.flags[self.status] = True
                self.last_x, self.last_y = x, y

        elif self.status == 'clip' and self.selected_id in self.item_dict and \
                self.item_dict[self.selected_id].item_type == 'line':
            self.temp_id = self.selected_id
            self.temp_item = self.item_dict[self.temp_id]
            self.flags['clip'] = True
            self.last_x, self.last_y = x, y
            self.temp_rect = MyItem(self.temp_id, 'rect', [[x, y], [x, y]], Qt.blue, 1)
            self.scene().addItem(self.temp_rect)

        self.updateScene([self.sceneRect()])
        super().mousePressEvent(event)
Ejemplo n.º 23
0
    def mouse_release(self, e: QtGui.QMouseEvent):
        if e.button() != QtCore.Qt.LeftButton:
            return
        if not self.gameobject:
            return

        # проверяем, образовались ли ходы ?
        if not self.gameobject.steps:
            # откат
            self.gameobject.discard()
        else:
            # применение ходов
            self.gameobject.apply()
        # обновим картинку
        self.update_game_view()

        # усли осилили
        if self.gameobject.is_complete:
            self.msgbox("Уровень закончен !")

        # Сбрасываем выбранное когда-то
        self.cur_item_index = None
Ejemplo n.º 24
0
    def mousePressEvent(self, ev: QMouseEvent) -> None:
        # Change to for AI ->
        # if self.parent().playerTurnsRemaining[self.pieceCommander] == 1 and self.parent().turn == 0 and self.pieceColor == 0:
        # Make sure it is the right turn for the piece and that the commander has command points.
        # (self.parent().playerTurnsRemaining[self.pieceCommander] == 1 or
        # (self.parent().playerTurnsRemaining[self.pieceCommander] == 2 and self.pieceType == "knight"))

        if not self.parent().pauseGame and self.parent().turn == self.pieceColor and not self.parent().gameOver \
                and self.parent().turn == self.parent().player:
            # If the person left clicks, set object as draggable and store position.
            if ev.button() == Qt.LeftButton:
                self.isDraggable = True
                self.labelPos = ((ev.globalPos() - self.parent().pos()) -
                                 QPoint(0, 30))
                self.startingPosition = [
                    int(self.labelPos.x() / self.parent().tileSize),
                    int(self.labelPos.y() / self.parent().tileSize)
                ]
                self.parent().clearHighlights()
                self.parent().highlightPossibleMoves(self.startingPosition[0],
                                                     self.startingPosition[1])
                self.raise_()
Ejemplo n.º 25
0
 def mousePressEvent(self, event):
     event = QMouseEvent(event)
     if event.button() == Qt.LeftButton:
         plottable = self.plottableAt(event.pos())
         if plottable is not None:
             x = self.xAxis.pixelToCoord(event.pos().x())
             y = self.yAxis.pixelToCoord(event.pos().y())
             bar = self.plottableBarsAt(event.pos())
             graph = self.plottableGraphAt(event.pos())
             if bar:
                 data = QCPBarData(bar.data()[4.0])
                 y = data.value
                 QToolTip.showText(event.globalPos(),
                                   QCoreApplication.translate('MousePlot',
                                                              '<table>'
                                                              '<tr>'
                                                              '<th colspan="2">%s</th>'
                                                              '</tr>'
                                                              '<tr>'
                                                              '<td>%s rub.</td>'
                                                              '</tr>'
                                                              '</table>') % (plottable.name(), str(y)))
             elif graph:
                 labels = self.xAxis.tickVectorLabels()
                 label_x = str(labels[int(x)])
                 y = round(y, 2)
                 if not label_x == '':
                     QToolTip.showText(event.globalPos(),
                                       QCoreApplication.translate('MousePlot',
                                                                  '<table>'
                                                                  '<tr>'
                                                                  '<th colspan="2">%s</th>'
                                                                  '</tr>'
                                                                  '<tr>'
                                                                  '<td>%s: %s rub.</td>'
                                                                  '</tr>'
                                                                  '</table>') % (plottable.name(), label_x, str(y)))
     super().mousePressEvent(event)
Ejemplo n.º 26
0
    def mouseReleaseEvent(self, event: QtGui.QMouseEvent) -> None:
        if event.button() == QtCore.Qt.LeftButton:
            self.lmbPressed = False
            if int((self.mouseStartX - self.offsetX) / self.sc *
                   self.map.gridSize) == int(
                       (self.mouseCurX - self.offsetX) / self.sc *
                       self.map.gridSize) and int(
                           (self.mouseStartY - self.offsetY) / self.sc *
                           self.map.gridSize) == int(
                               (self.mouseCurY - self.offsetY) / self.sc *
                               self.map.gridSize):
                self.lmbClicked.emit(
                    int((self.mouseStartX - self.offsetX) / self.sc *
                        self.map.gridSize),
                    int((self.mouseStartY - self.offsetY) / self.sc *
                        self.map.gridSize))

            self.raw_selection = [
                ((min(self.mouseStartX, self.mouseCurX) - self.offsetX) /
                 self.sc) / self.map.gridSize,
                ((min(self.mouseStartY, self.mouseCurY) - self.offsetY) /
                 self.sc) / self.map.gridSize,
                ((max(self.mouseStartX, self.mouseCurX) - self.offsetX) /
                 self.sc) / self.map.gridSize,
                ((max(self.mouseStartY, self.mouseCurY) - self.offsetY) /
                 self.sc) / self.map.gridSize
            ]

            if self.map.get_tile_layer().visible:
                self.tileSelection = [
                    int(v) + (1 if i > 1 else 0)
                    for i, v in enumerate(self.raw_selection)
                ]
            self.selectionChanged.emit()
        else:
            self.rmbPressed = False
        self.scene().update()
Ejemplo n.º 27
0
    def mouseReleaseEvent(self, evt: QtGui.QMouseEvent) -> None:
        if evt.button() == Qt.LeftButton and self.__moving_point is not None:
            pos = self.__moving_point.pos()
            self.__moving_point = None

            if self.__move_mode != 'vertical':
                new_time = self.track.xToTime(pos.x())
            else:
                new_time = None

            if self.__move_mode != 'horizontal':
                new_value = self.track.yToValue(pos.y())
            else:
                new_value = None

            with self.project.apply_mutations('%s: Change control point' %
                                              self.track.track.name):
                self.track.highlightedPoint().point.time = new_time
                self.track.highlightedPoint().point.value = new_value

            evt.accept()
            return

        super().mouseReleaseEvent(evt)
Ejemplo n.º 28
0
    def mousePressEvent(self, event: QMouseEvent):
        x = event.x() + self.scroll_area.horizontalScrollBar().value()
        y = event.y() + self.scroll_area.verticalScrollBar().value()
        if BWindowWorker.IS_SELECT_FIGURE_MODE:
            if self.selected_figure is not None:
                print('self.selected_figure is not None')
                self.b_figure_worker.set_not_active_figures_color_size()
                # self.selected_figure = self.b_figure_worker.get_selected_figure(x, y)
                # self.selected_figure.set_point_color_radius(5, (250, 250, 51))
                self.select_point = self.b_figure_worker.get_point_of_figure_by_coors(
                    x, y, self.selected_figure)
                if self.select_point:
                    self.select_point.set_color((153, 255, 51))
            elif event.button() == Qt.LeftButton:
                self.is_press_rb = True
                print('T1', self.is_press_rb)
                self.selected_figure = self.b_figure_worker.get_selected_figure(
                    x, y)
                print('self.selected_figure : ', self.selected_figure)
                self.selected_figure.set_point_color_radius(5, (250, 250, 51))

        self.reload_mat()
        self.update()
        print('PRESSS')
 def mousePressEvent(self, event: QMouseEvent):
     if event.button() == Qt.LeftButton:
         self.on_move = True
         self.mouse_start_point = event.globalPos()
         self.window_geo = self.frameGeometry()
         if self.mouse_start_point.x() <= self.window_geo.left() + 9:
             if self.mouse_start_point.y() <= self.window_geo.top() + 9:
                 self.window_status = 'top_left'
                 self.setCursor(Qt.SizeFDiagCursor)
             elif self.mouse_start_point.y(
             ) >= self.window_geo.bottom() - 9:
                 self.window_status = 'bottom_left'
                 self.setCursor(Qt.SizeBDiagCursor)
             else:
                 self.window_status = 'left'
                 self.setCursor(Qt.SizeHorCursor)
         elif self.mouse_start_point.x() >= self.window_geo.right() - 9:
             if self.mouse_start_point.y() <= self.window_geo.top() + 9:
                 self.window_status = 'top_right'
                 self.setCursor(Qt.SizeBDiagCursor)
             elif self.mouse_start_point.y(
             ) >= self.window_geo.bottom() - 9:
                 self.window_status = 'bottom_right'
                 self.setCursor(Qt.SizeFDiagCursor)
             else:
                 self.window_status = 'right'
                 self.setCursor(Qt.SizeHorCursor)
         elif self.mouse_start_point.y() <= self.window_geo.top() + 9:
             self.window_status = 'top'
             self.setCursor(Qt.SizeVerCursor)
         elif self.mouse_start_point.y() >= self.window_geo.bottom() - 9:
             self.window_status = 'bottom'
             self.setCursor(Qt.SizeVerCursor)
         else:
             self.window_status = 'move'
     QMainWindow.mousePressEvent(self, event)
Ejemplo n.º 30
0
    def mousePressEvent(self, event: QMouseEvent):
        """
        Override mousePressEvent to support mouse button actions
        :param event:
        :return:
        """
        if self.video.kind == VIDEO_KIND_VOD:
            if event.button() == Qt.LeftButton and QApplication.keyboardModifiers() == Qt.ControlModifier:
                self.logger.error("Not Implemented: Select video")
            elif event.button() == Qt.LeftButton:
                left_button_rebind = read_config('SubFeed', 'left_mouse_action', literal_eval=False)

                if left_button_rebind == MOUSE_PRESS_OPEN_URL:
                    self.open_in_browser()
                elif left_button_rebind == MOUSE_PRESS_COPY_URL:
                    self.copy_url(mark_watched=True)
                elif left_button_rebind == MOUSE_PRESS_PLAY_URL:
                    url_player = self.str_to_list(read_config('Player', 'default_player', literal_eval=False))
                    self.open_in_player(self.video.url_video, url_player, isfile=False)
                elif left_button_rebind == MOUSE_PRESS_DOWNLOAD:
                    self.mark_downloaded()
                elif left_button_rebind == MOUSE_PRESS_DOWNLOAD_AND_COPY:
                    self.copy_url()
                    self.mark_downloaded()

            elif event.button() == Qt.MidButton and QApplication.keyboardModifiers() == Qt.ControlModifier:
                self.decrease_prio()
            elif event.button() == Qt.MidButton:
                self.mark_discarded()

        elif self.video.kind == VIDEO_KIND_LIVE or self.video.kind == VIDEO_KIND_LIVE_SCHEDULED \
                or self.video.kind == VIDEO_KIND_PREMIERE:
            if event.button() == Qt.MidButton:
                self.mark_discarded()
            elif event.button() == Qt.LeftButton:
                self.root.confirmation_dialog(VIDEO_IS_LIVE_MSG, self.mark_downloaded, title=VIDEO_IS_LIVE_TITLE,
                                              ok_text="Yes, stream it.",
                                              cancel_text="Abort, abort, ABORT!")
Ejemplo n.º 31
0
 def mousePressEvent(self, e: QtGui.QMouseEvent) -> None:
     if e.button() == Qt.LeftButton:
         self.main_window.hacer_click(e.x(), e.y())
Ejemplo n.º 32
0
 def mousePressEvent(self, event: QtGui.QMouseEvent):
     if event.button() == QtCore.Qt.LeftButton:
         self.drag_start_position = event.pos()
         global movedChecker
         movedChecker = self
Ejemplo n.º 33
0
 def mouseDoubleClickEvent(self, event: QMouseEvent) -> None:
     if event.button() == Qt.LeftButton:
         self.doubleClick.emit()
Ejemplo n.º 34
0
 def mousePressEvent(self, event: QMouseEvent) -> None:
     if event.button() == Qt.LeftButton:
         self.click.emit(self.type, self.name)
Ejemplo n.º 35
0
 def mouseReleaseEvent(self, e: QMouseEvent):
     if e.button() == Qt.RightButton:
         self.right_clicked.emit()
     super().mouseReleaseEvent(e)
Ejemplo n.º 36
0
 def mouseReleaseEvent(self, e: QMouseEvent):
     if e.button() == Qt.LeftButton:
         self._isTracking = False
         self._startPos = None
         self._endPos = None
Ejemplo n.º 37
0
 def mousePressEvent(self, e: QMouseEvent):
     if e.button() == Qt.LeftButton:
         self._isTracking = True
         self._startPos = QPoint(e.x(), e.y())
Ejemplo n.º 38
0
 def mousePressEvent(self, event: QtGui.QMouseEvent):
     #event.button() 1左2右,event.pos()坐标点,原点在中心
     if event.button()==1 and self.hasImage:
         self.leftButtonPressed=True
         self.lastPositionOfMouse=event.pos()
Ejemplo n.º 39
0
 def mouseReleaseEvent(self, event: QtGui.QMouseEvent):
     if event.button()==1:
         self.leftButtonPressed=False