Exemple #1
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)
        self.layout().setAlignment(hBox, Qt.AlignHCenter)

        cBox = KVBox(hBox)
        hBox.layout().setAlignment(cBox, Qt.AlignTop)
        hBox.setSpacing(25)
        hBox.setMargin(10)

        self.stdDirs = KStandardDirs()
        types = self.stdDirs.allTypes()

        comboLbl = QLabel("Types", cBox)
        combo = KComboBox(cBox)
        combo.addItems(types)
        cBox.layout().setAlignment(comboLbl, Qt.AlignTop)
        cBox.layout().setAlignment(combo, Qt.AlignTop)

        self.connect(combo, SIGNAL("currentIndexChanged (const QString&)"),
                     self.slotIndexChanged)

        lBox = KVBox(hBox)
        listLbl = QLabel("Directories", lBox)
        self.location = KListWidget(lBox)
        self.location.setMaximumSize(400, 200)
        lBox.layout().setAlignment(listLbl, Qt.AlignTop)
        lBox.layout().setAlignment(self.location, Qt.AlignTop)

        self.slotIndexChanged(combo.currentText())
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)
        
        hBox          = KHBox (self)
        self.layout ().setAlignment (hBox, Qt.AlignHCenter)
        
        cBox          = KVBox (hBox)
        hBox.layout ().setAlignment (cBox, Qt.AlignTop)
        hBox.setSpacing (25)
        hBox.setMargin (10)

        self.stdDirs  = KStandardDirs ()
        types         = self.stdDirs.allTypes ()
        
        comboLbl      = QLabel ("Types", cBox)
        combo         = KComboBox (cBox)        
        combo.addItems (types)
        cBox.layout ().setAlignment (comboLbl, Qt.AlignTop)
        cBox.layout ().setAlignment (combo, Qt.AlignTop)
        
        self.connect (combo, SIGNAL ("currentIndexChanged (const QString&)"), self.slotIndexChanged)

        lBox          = KVBox (hBox)
        listLbl       = QLabel ("Directories", lBox)
        self.location = KListWidget (lBox)
        self.location.setMaximumSize (400, 200)
        lBox.layout ().setAlignment (listLbl, Qt.AlignTop)
        lBox.layout ().setAlignment (self.location, Qt.AlignTop)

        QLabel (self.stdDirs.installPath ("ui"), self)

        self.slotIndexChanged (combo.currentText ())
Exemple #3
0
    def __init__(self, parent=None):
        super(KVBox, self).__init__(parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)
        self.layout().setAlignment(hBox, Qt.AlignHCenter)

        cBox = KVBox(hBox)
        hBox.layout().setAlignment(cBox, Qt.AlignTop)
        hBox.setSpacing(25)
        hBox.setMargin(10)

        self.stdDirs = KStandardDirs()
        types = self.stdDirs.allTypes()

        comboLbl = QLabel("Types", cBox)
        combo = KComboBox(cBox)
        combo.addItems(types)
        cBox.layout().setAlignment(comboLbl, Qt.AlignTop)
        cBox.layout().setAlignment(combo, Qt.AlignTop)

        # We're calling the QString version of the signal, as
        # currentIndexChanged can also be emitted with an int (the index that
        # changed)

        combo.currentIndexChanged[QString].connect(self.slotIndexChanged)

        lBox = KVBox(hBox)
        listLbl = QLabel("Directories", lBox)
        self.location = KListWidget(lBox)
        self.location.setMaximumSize(400, 200)
        lBox.layout().setAlignment(listLbl, Qt.AlignTop)
        lBox.layout().setAlignment(self.location, Qt.AlignTop)

        QLabel(self.stdDirs.installPath("ui"), self)

        self.slotIndexChanged(combo.currentText())
Exemple #4
0
	def __init__ (self):
		KMainWindow.__init__ (self)
		self.result = ""
		self.resize (640, 480)
		
		label = QLabel ("Search", self)
		label.setGeometry (10,10,200,20)
		
		self.searchBox = KLineEdit(self)
		self.searchBox.setGeometry(50,8,520,25)
		self.connect(self.searchBox, SIGNAL("returnPressed()"),self.search)
		
		searchButton = KPushButton(self)
		searchButton.setGeometry(570,6,70,25)
		searchButton.setText("Search")
		self.connect (searchButton, SIGNAL("clicked()"), self.search)
		
		self.resultList = KListWidget(self)
		self.resultList.setGeometry(10,50,620,400)
		self.connect(self.resultList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.playSelected)
Exemple #5
0
class MainWindow (KMainWindow):

	
	
	def __init__ (self):
		KMainWindow.__init__ (self)
		self.result = ""
		self.resize (640, 480)
		
		label = QLabel ("Search", self)
		label.setGeometry (10,10,200,20)
		
		self.searchBox = KLineEdit(self)
		self.searchBox.setGeometry(50,8,520,25)
		self.connect(self.searchBox, SIGNAL("returnPressed()"),self.search)
		
		searchButton = KPushButton(self)
		searchButton.setGeometry(570,6,70,25)
		searchButton.setText("Search")
		self.connect (searchButton, SIGNAL("clicked()"), self.search)
		
		self.resultList = KListWidget(self)
		self.resultList.setGeometry(10,50,620,400)
		self.connect(self.resultList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.playSelected)
	
		
	
	def formatResult(self,track):
		has_metadata = "un"
		if track.has_meta_data():
			has_metadata = ""

		return " %s - %s (%s), length: %d [%splayable]" % (", ".join((a.name for a in track.artists)),
                                                         track.title, track.album,
                                                         track.length, has_metadata)
	def playSelected(self):
		global s
		global result
		self.proc = SpotPlayFile(self,s,result,self.resultList.currentRow())
		self.proc.start()
		
		
	def doSomething(self):
		print("Doing something")
	
	def search(self):
		global result
		global s
		if self.searchBox.text() == "":
			KMessageBox.error(None,"Search for something...")
			return
		else:
			self.resultList.clear()
			result = s.search(str(self.searchBox.text()))
			if not result:
				self.resultList.addItem("Nothing found :(")
			else:
				for i in range(0,len(result.playlist.tracks)):
					tracktext = self.formatResult(result.playlist.tracks[i])
				#	tracktext = str(track)
					self.resultList.addItem(tracktext)
					
				#s.play(result.playlist.tracks.)
		return