Exemplo n.º 1
0
 def mousePressEvent(self, QMouseEvent):
     cursor = QCursor()
     x = QMouseEvent.x()
     y = QMouseEvent.y()
     if (x < 1280 and y < 720) and (x > 15 and y > 15):
         if self._rubber == None:
             if not self.frozen:
                 self.freeze()
                 self.frozen_before = False
             else:
                 self.frozen_before = True
             self.rub_origin = QMouseEvent.pos()
             self._rubber = QRubberBand(QRubberBand.Rectangle, self)
             self._rubber.show()
             self.crop_stat = IMG
     elif (x > 1300 and y > 520) and (x < 1907 and y < 1010):
         self.rub_origin = QMouseEvent.pos()
         self._rubber = QRubberBand(QRubberBand.Rectangle, self)
         self._rubber.show()
         if QMouseEvent.button(
         ) == Qt.RightButton and self.selected_count != 0:
             self.select_status = HIST_DESELECTION
         else:
             self.select_status = HIST_SELECTION
         self.crop_stat = HIST
         self.log_info("hist status {}".format("HSV" if self.hist_status ==
                                               HSV else "LAB"))
Exemplo n.º 2
0
 def mouseMoveEvent(self, QMouseEvent):
     cursor = QCursor()
     x = QMouseEvent.x()
     y = QMouseEvent.y()
     # if in coords of image and crop status is image then draw the rect
     if self._rubber is None:
         return
     if (x < 1280 and y < 720) and (x > 15
                                    and y > 15) and self.crop_stat == IMG:
         self._rubber.setGeometry(
             QRect(self.rub_origin, QMouseEvent.pos()).normalized())
     # if in coords of hist and crop status is hist then draw the rect
     elif (x > 1300 and y > 520) and (x < 1907 and
                                      y < 1010) and self.crop_stat == HIST:
         self._rubber.setGeometry(
             QRect(self.rub_origin, QMouseEvent.pos()).normalized())