예제 #1
0
    def generateIcon(self):
        import svnmanip

        if self.readonly is True:
            pixmap = qt.QtGui.QPixmap(":/images/icons/lock.png")
        elif self._edited:
            pixmap = qt.QtGui.QPixmap(":/images/icons/codefile-red.png")
        else:
            pixmap = qt.QtGui.QPixmap(":/images/icons/codefile.png")
        if not self.readonly and not self.fname is None and svnmanip.hasSvnSupport():
            if svnmanip.isSvnFile(self.fname):
                status = svnmanip.svnFileTextStatus(self.fname)
                self.svnstatus = status
                if status == svnmanip.modified:
                    pixmap2 = qt.QtGui.QPixmap(":/images/icons/svn-modified.png")
                elif status == svnmanip.normal:
                    pixmap2 = qt.QtGui.QPixmap(":/images/icons/svn-normal.png")
                elif status == svnmanip.conflicted:
                    pixmap2 = qt.QtGui.QPixmap(":/images/icons/svn-conflict.png")
                elif status == svnmanip.added:
                    pixmap2 = qt.QtGui.QPixmap(":/images/icons/svn-add.png")
                else:
                    pixmap2 = None
                if not pixmap2 is None:
                    painter = qt.QtGui.QPainter(pixmap)
                    painter.drawPixmap(pixmap.width() - pixmap2.width(), pixmap.height() - pixmap2.height(), pixmap2)
                    painter.end()
        icon = qt.QtGui.QIcon()
        icon.addPixmap(pixmap.scaledToHeight(32), qt.QtGui.QIcon.Normal, qt.QtGui.QIcon.Off)
        return icon
예제 #2
0
파일: simulation.py 프로젝트: Shoko84/lpy
 def generateIcon(self):
     import svnmanip
     if self.readonly is True:
         pixmap = QPixmap(":/images/icons/lock.png")
     elif self._edited:
         pixmap = QPixmap(":/images/icons/codefile-red.png")
     else:
         pixmap = QPixmap(":/images/icons/codefile.png")
     if not self.readonly and not self.fname is None and svnmanip.hasSvnSupport() :
         if svnmanip.isSvnFile(self.fname):
             status = svnmanip.svnFileTextStatus(self.fname)
             self.svnstatus = status
             if  status == svnmanip.modified:
                 pixmap2 = QPixmap(":/images/icons/svn-modified.png")
             elif status == svnmanip.normal:
                 pixmap2 = QPixmap(":/images/icons/svn-normal.png")
             elif status == svnmanip.conflicted:
                 pixmap2 = QPixmap(":/images/icons/svn-conflict.png")
             elif status == svnmanip.added:
                 pixmap2 = QPixmap(":/images/icons/svn-add.png")
             else:
                 pixmap2 = None
             if not pixmap2 is None:
                 painter = QPainter(pixmap);
                 painter.drawPixmap(pixmap.width()-pixmap2.width(),pixmap.height()-pixmap2.height(),pixmap2)
                 painter.end()
     icon = QIcon()
     icon.addPixmap(pixmap.scaledToHeight(32),QIcon.Normal,QIcon.Off)
     return icon
예제 #3
0
    def updateSvnStatus(self):
        import svnmanip

        if svnmanip.hasSvnSupport():
            if (not hasattr(self, "svnstatus") and svnmanip.isSvnFile(self.fname)) or (
                hasattr(self, "svnstatus") and svnmanip.svnFileTextStatus(self.fname) != self.svnstatus
            ):
                self.updateTabName(force=True)
예제 #4
0
파일: lpytabbar.py 프로젝트: gkoehl/lpy
 def contextMenuEvent(self,event):
     self.selection = self.tabAt(event.pos())
     if self.selection != -1:
         menu = qt.QtGui.QMenu(self)
         action = menu.addAction('Close')
         QObject.connect(action,SIGNAL('triggered(bool)'),self.close)
         action = menu.addAction('Close all except this ')
         QObject.connect(action,SIGNAL('triggered(bool)'),self.closeAllExcept)
         menu.addSeparator()
         if self.lpystudio.simulations[self.selection].readonly:
             action = menu.addAction('Remove Readonly ')
             QObject.connect(action,SIGNAL('triggered(bool)'),self.removeReadOnly)
         else:
             action = menu.addAction('Set Readonly ')
             QObject.connect(action,SIGNAL('triggered(bool)'),self.setReadOnly)
         menu.addSeparator()
         action = menu.addAction('Copy filename ')
         QObject.connect(action,SIGNAL('triggered(bool)'),self.copyFilename)
         action = menu.addAction('Open folder')
         QObject.connect(action,SIGNAL('triggered(bool)'),self.openFolder)
         action = menu.addAction('Open terminal')
         QObject.connect(action,SIGNAL('triggered(bool)'),self.openTerminalAtFolder)
         fname = self.lpystudio.simulations[self.selection].fname
         if fname and svnmanip.hasSvnSupport() :
             if svnmanip.isSvnFile(fname):
                 menu.addSeparator()
                 status = svnmanip.svnFileTextStatus(fname)
                 if status != svnmanip.added:
                     action = menu.addAction('SVN Update')
                     QObject.connect(action,SIGNAL('triggered(bool)'),self.svnUpdate)
                 if status in  [svnmanip.added,svnmanip.modified]:
                     action = menu.addAction('SVN Commit')
                     QObject.connect(action,SIGNAL('triggered(bool)'),self.svnCommit)
                 if status != svnmanip.normal:
                     action = menu.addAction('SVN Revert')
                     QObject.connect(action,SIGNAL('triggered(bool)'),self.svnRevert)
                 if status != svnmanip.added:
                     menu.addSeparator()
                     action = menu.addAction('Is Up-to-date ?')
                     QObject.connect(action,SIGNAL('triggered(bool)'),self.svnIsUpToDate)
             elif svnmanip.isSvnFile(os.path.dirname(fname)):
                 menu.addSeparator()
                 action = menu.addAction('SVN Add')
                 QObject.connect(action,SIGNAL('triggered(bool)'),self.svnAdd)
         menu.exec_(event.globalPos())
예제 #5
0
 def contextMenuEvent(self, event):
     self.selection = self.tabAt(event.pos())
     if self.selection != -1:
         menu = QMenu(self)
         action = menu.addAction('Close')
         action.triggered.connect(self.close)
         action = menu.addAction('Close all except this ')
         action.triggered.connect(self.closeAllExcept)
         menu.addSeparator()
         if self.lpystudio.simulations[self.selection].readonly:
             action = menu.addAction('Remove Readonly ')
             action.triggered.connect(self.removeReadOnly)
         else:
             action = menu.addAction('Set Readonly ')
             action.triggered.connect(self.setReadOnly)
         menu.addSeparator()
         action = menu.addAction('Copy filename ')
         action.triggered.connect(self.copyFilename)
         action = menu.addAction('Open folder')
         action.triggered.connect(self.openFolder)
         action = menu.addAction('Open terminal')
         action.triggered.connect(self.openTerminalAtFolder)
         fname = self.lpystudio.simulations[self.selection].fname
         if fname and svnmanip.hasSvnSupport():
             if svnmanip.isSvnFile(fname):
                 menu.addSeparator()
                 status = svnmanip.svnFileTextStatus(fname)
                 if status != svnmanip.added:
                     action = menu.addAction('SVN Update')
                     action.triggered.connect(self.svnUpdate)
                 if status in [svnmanip.added, svnmanip.modified]:
                     action = menu.addAction('SVN Commit')
                     action.triggered.connect(self.svnCommit)
                 if status != svnmanip.normal:
                     action = menu.addAction('SVN Revert')
                     action.triggered.connect(self.svnRevert)
                 if status != svnmanip.added:
                     menu.addSeparator()
                     action = menu.addAction('Is Up-to-date ?')
                     action.triggered.connect(self.svnIsUpToDate)
             elif svnmanip.isSvnFile(os.path.dirname(fname)):
                 menu.addSeparator()
                 action = menu.addAction('SVN Add')
                 action.triggered.connect(self.svnAdd)
         menu.exec_(event.globalPos())
예제 #6
0
파일: lpystudio.py 프로젝트: openalea/lpy
    def updateSVNMenu(self):
        import svnmanip, os
        if svnmanip.hasSvnSupport() :
            fname = self.currentSimulation().fname

            if not fname or not svnmanip.isSvnFile(fname):
                for action in  [self.actionSVNUpdate, self.actionSVNCommit, self.actionSVNRevert, self.actionSVNIsUpToDate]:
                    action.setEnabled(False)

                self.actionSVNAdd.setEnabled(not fname is None and svnmanip.isSvnFile(os.path.dirname(fname)))
            else :
                    status = svnmanip.svnFileTextStatus(fname)
                    isadded = (status == svnmanip.added)
                    ismodified = (status == svnmanip.modified)
                    isnormal = (status == svnmanip.normal)

                    self.actionSVNUpdate.setEnabled(not isadded)
                    self.actionSVNIsUpToDate.setEnabled(not isadded)
                    self.actionSVNCommit.setEnabled(ismodified or isadded)
                    self.actionSVNRevert.setEnabled(not isnormal)
                    self.actionSVNAdd.setEnabled(False)
예제 #7
0
파일: simulation.py 프로젝트: Shoko84/lpy
 def updateSvnStatus(self):
     import svnmanip
     if svnmanip.hasSvnSupport():
         if (not hasattr(self,'svnstatus') and svnmanip.isSvnFile(self.fname)) or (hasattr(self,'svnstatus') and svnmanip.svnFileTextStatus(self.fname) != self.svnstatus):
             self.updateTabName(force=True)