Exemple #1
0
 def mouseDoubleClickEvent(self, event):
     if self.cutok:
         rectPixmap = self.opaqueRectLabel.label.pixmap()
         date = datetime.datetime.now().date()
         nowTime = time.strftime("%H.%M.%S")
         name = "Screen Shot %d-%d-%d at %s %s" % (
             date.year, date.month, date.day, nowTime, time.strftime("%p"))
         #try to get path from previous log
         try:
             with open('pathLog.txt', 'r') as txtFile:
                 self.savePath = txtFile.readline()
         except:
             with open('pathLog.txt', 'w+') as txtFile:
                 self.savePath = txtFile.readline()
         #get path to save the file at
         if not self.savePath:
             self.openMenuBtn.hide()
             tarPath = QFileDialog.getExistingDirectory(
                 self.menu,
                 caption="Please select a path",
                 options=QFileDialog.ShowDirsOnly)
             self.savePath = tarPath
             with open('pathLog.txt', 'w') as txtFile:
                 txtFile.writelines(tarPath)
         if not self.savePath:
             return
         rectPixmap.save(self.savePath + "/%s.png" % (name), None, 100)
         QApplication.closeAllWindows()
         self.close()
Exemple #2
0
 def mousePressEvent(self, event):
     if not self.cutok:
         self.helpWin.close()
         if event.button() == Qt.LeftButton:
             self.startPos = event.globalPos()
             self.startx = self.startPos.x()
             self.starty = self.startPos.y()
             self.selectRect.setTopLeft(self.startPos)
             self.selectionExists = True
         elif event.button() == Qt.RightButton:
             QApplication.closeAllWindows()
             self.close()
     elif self.cutok:
         if event.button() == Qt.RightButton:
             self.drawArrowOK = False
             self.drawArrowHead = False
             self.underlineOK = False
             self.underlineEnd = False
             self.drawOK = False
             self.drawingEnd = False
             self.allLines = []
             self.allArrows = []
             self.allDrawings = []
             self.deleted = []
             self.drawLines = []
             self.tempDrawLines = []
             self.openMenuBtn.hide()
             self.menu.hide()
             self.startPos = event.globalPos()
             self.startx = self.startPos.x()
             self.starty = self.startPos.y()
             self.selectRect.setTopLeft(self.startPos)
             self.selectRect.setSize(QSize(0, 0))
             self.opaqueRectLabel.label.hide()
             self.rectLabel.hide()
             self.cutok = False
         elif event.button() == Qt.LeftButton:
             if self.resizeOK:
                 self.initialStartX = float(event.globalPos().x())
                 self.initialStartY = float(event.globalPos().y())
             if self.drawArrowOK:
                 if self.rectLabel.underMouse():
                     self.drawingArrow = True
                     self.currentPos = event.globalPos()
                     self.arrowStartPos = event.globalPos()
                     self.drawArrowOK = False
             elif self.drawOK:
                 if self.rectLabel.underMouse():
                     self.drawing = True
                     self.currentPos = event.globalPos()
                     self.drawStartPos = event.globalPos()
                     self.origin = event.globalPos()
                     self.drawOK = False
             elif self.underlineOK:
                 if self.rectLabel.underMouse():
                     self.underlining = True
                     self.currentPos = event.globalPos()
                     self.lineStartPos = event.globalPos()
                     self.underlineOK = False
 def closeAllWindows(self):
     QApplication.closeAllWindows()
Exemple #4
0
 def keyPressEvent(self, event):
     if event.key() == Qt.Key_Escape:
         QApplication.closeAllWindows()
         self.close()
Exemple #5
0
 def closeAllWindows(self):
     QApplication.closeAllWindows()