Ejemplo n.º 1
0
    def __init__(self, parent=None):
        super(ConfigDialog, self).__init__(parent)
        self.name = "Configuration"
        self.configObj = CRConfiguration()
        self.configObj.loadconfig()
        sLabel = QLabel("Source Directories")
        dLabel = QLabel("Destination Directory")
        
        font = QFont()
        font.setUnderline(True)
        font.setBold(True)
        font.setItalic(True)
        
        sLabel.setFont(font)
        dLabel.setFont(font)
        
        firstLine = DirExplorer._createLine(self, "sep1")
        secondLine = DirExplorer._createLine(self, "sep2")
        thirdLine = DirExplorer._createLine(self, "sep3")
        self.listWidget = QListWidget()
        self.destination = QLineEdit()
        self.destination.setEnabled(False)
        #self.destination.setMinimumWidth(self)
        confirmBBox = QDialogButtonBox(QDialogButtonBox.Cancel|
                                     QDialogButtonBox.Ok)
        

        grid = QGridLayout()
        grid.addWidget(sLabel, 0, 0)
        grid.addWidget(firstLine, 1, 0, 1, 2)
        grid.addWidget(self.listWidget, 2, 0, 3, 1)
        
        for text, slot, x, y in (("&Add", self.add, 2, 1),
                           ("&Edit", self.edit, 3, 1),
                           ("&Delete", self.delete, 4, 1),
                           ("&Set Destination", self.updatedest, 10, 1)):
            
            button = QPushButton(text)
            if not MAC:
                button.setFocusPolicy(Qt.NoFocus)
             
            self.connect(button, SIGNAL("clicked()"), slot)
            
            grid.addWidget(button, x, y)
            
        grid.addWidget(secondLine, 6, 0, 1, 2) 
        grid.addWidget(dLabel, 8, 0)
        grid.addWidget(thirdLine, 9, 0, 1, 2) 
        grid.addWidget(self.destination, 10, 0)
        grid.addWidget(confirmBBox, 11, 0, 1, 2)
        self.setLayout(grid)
        
        self.connect(confirmBBox, SIGNAL("accepted()"),
                     self, SLOT("accept()"))
        self.connect(confirmBBox, SIGNAL("rejected()"),
                     self, SLOT("reject()"))
        
        self.setup()
        self.listWidget.setMinimumWidth(self.listWidget.sizeHintForColumn(0)+5)
        self.listWidget.setMaximumHeight(130)
Ejemplo n.º 2
0
 def add(self):
     dialog = DirExplorer(treefilter=QDir.NoDotAndDotDot | QDir.AllDirs | QDir.Hidden,
                          startPath="/",
                          parent=self)
     if dialog.exec_():
         addsource = True
         removesources = False
         selection = dialog.getselection()
         for source in self.configObj.getsources():
             if source in selection:
                 addsource = False
                 quickNote = QMessageBox()
                 quickNote.setText("Path not added as parent directory already a source")
                 quickNote.setInformativeText("Parent path:%s" % source)
                 quickNote.exec_()
                 break
             elif selection in source:
                 quickNote = QMessageBox()
                 reply = QMessageBox.question(self, "Check sources",
                     "Some of the current sources are under `%s' directory. Do you want to remove them from the list?" % dialog.getselection(),
                     QMessageBox.Abort|QMessageBox.No|QMessageBox.Yes)
                 
                 if reply == QMessageBox.Yes:
                     removesources = True
                 elif reply == QMessageBox.Abort:
                     addsource = False
                 break
 
         if removesources:  
             for row in range(self.listWidget.count()):
                 item = self.listWidget.item(row)     
                 if selection == str(item.text())[0:len(selection)]:
                     self.configObj.removesource(str(item.text()))
                     item = self.listWidget.takeItem(row)
                     del item
                                        
         if addsource:
             self.listWidget.addItem(selection)
             self.configObj.addsource(selection)
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        super(MapShownameDialog, self).__init__(parent)

        self.showname = None
        self.season = None
        self.episode = None

        self.name = "Moving cfE file Dialog"
        shownameQLabel = QLabel("Enter ShowName: ")
        seasonQLabel = QLabel("Enter Season Number: ")
        episodeQLabel = QLabel("Enter Episode Number: ")
        
        font = QFont()
        font.setBold(True)
        
        shownameQLabel.setFont(font)
        seasonQLabel.setFont(font)
        episodeQLabel.setFont(font)
        
        firstLine = DirExplorer._createLine(self, "sep1")
        self.shownameQLineEdit = QLineEdit()
        self.shownameQLineEdit.setEnabled(True)
        self.seasonQLineEdit = QLineEdit()
        self.seasonQLineEdit.setEnabled(True)
        self.seasonQLineEdit.setInputMask("99")
        self.episodeQLineEdit = QLineEdit()
        self.episodeQLineEdit.setEnabled(True)
        self.episodeQLineEdit.setInputMask("99")

        grid = QGridLayout()
        grid.addWidget(shownameQLabel, 0, 0)
        grid.addWidget(self.shownameQLineEdit, 0, 1)
        grid.addWidget(seasonQLabel, 1, 0)
        grid.addWidget(self.seasonQLineEdit, 1, 1)
        grid.addWidget(episodeQLabel, 2, 0)
        grid.addWidget(self.episodeQLineEdit, 2, 1)
            
        button = QPushButton("&Set Values")
        if not MAC:
            button.setFocusPolicy(Qt.NoFocus)
             
        self.connect(button, SIGNAL("clicked()"), self.setvalues)
        grid.addWidget(button, 1, 2)
            
        self.setLayout(grid)
Ejemplo n.º 4
0
 def updatedest(self):
     current = str(self.destination.text())
     dialog = DirExplorer(currentSelection=current, parent=self)
     if dialog.exec_():
         self.configObj.setdestination(dialog.getselection())
         self.destination.setText(self.configObj.getdestination())