[PyQt] what does import urllib2 as ulib mean?
Heys guys; as the name of the post indicates my questionwhat are those libraries? i need further details Thanks -- View this message in context: http://www.nabble.com/what-does-import-urllib2-as-ulib-mean--tp23008258p23008258.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Creating a message box
klia wrote: > > Hey guys; > > i am totally new to pyqt > > My query is can some one give me an example that creates a button which > will display a message box once it's clicked > > thank you > Thank you for help -- View this message in context: http://www.nabble.com/Creating-a-message-box-tp22922690p22931918.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Creating a message box
Hey guys; i am totally new to pyqt My query is can some one give me an example that creates a button which will display a message box once it's clicked thank you -- View this message in context: http://www.nabble.com/Creating-a-message-box-tp22922690p22922690.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] how to covert an object text to string?
hey guys This is in Pyqt I have this code filename=os.path.basename(self.lwitem.text()) which self.lwitem.text() holds my filename path but i wanna convert it into a string how am i gonna do that?? Thanks -- View this message in context: http://www.nabble.com/how-to-covert-an-object-text-to-string--tp22907976p22907976.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] linking subprocess function and items in listwidget?
Till Gerken-2 wrote: > > On Mon, Mar 16, 2009 at 11:32 AM, klia wrote: >> I have function myexif.py that extracts exif data from photos into .csv >> file, i have subprocess this function into this form under a bush button >> (add photo) >> >> p= Popen(["python","myexif.py","-q","photopath"], >> stdout=file("test.csv","w")) >> p.wait() >> >> I am suppose to select one or more photos in the listwidget and execute >> my >> (add photo) button which will extracts exif data from the photos >> selected, >> but i am facing problem on how to get the function above to know the path >> of >> my selected photos in the listwidget? > > Using a QListWidget, you will either have to add the items with their > full path to the list or use a common directory root. If that is not > possible, use a QListView and your own data model. A custom data model > allows you to keep the list entry and path to the file name as > separate entities. > > http://doc.trolltech.com/4.4/model-view-programming.html > > Till > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > Thanks for replaying actually i am already able to add my items into my list widget with full path info but how to make the subprocess function provided above realize that i need to execute those items on the listwidget and not fixed path hard coded in the function itself? -- View this message in context: http://www.nabble.com/linking-subprocess-function-and-items-in-listwidget--tp22535334p22540555.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] linking subprocess function and items in listwidget?
Hello guys I have this question about subprocess I have function myexif.py that extracts exif data from photos into .csv file, i have subprocess this function into this form under a bush button (add photo) p= Popen(["python","myexif.py","-q","photopath"], stdout=file("test.csv","w")) p.wait() I am suppose to select one or more photos in the listwidget and execute my (add photo) button which will extracts exif data from the photos selected, but i am facing problem on how to get the function above to know the path of my selected photos in the listwidget? Thanks in advance -- View this message in context: http://www.nabble.com/linking-subprocess-function-and-items-in-listwidget--tp22535334p22535334.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] subprocess in PyQt
Ville M. Vainio wrote: > > On Sat, Mar 14, 2009 at 9:17 AM, klia wrote: > >> i have a function that suppose to do something and from terminal it has >> this >> syntax to be executed; >> >> was...@home:~/Desktop/Project2/GUI$ python myexif.py -q "pathfile" > >> test.csv >> >> so far on using subprocess i came up with this; >> >> from subprocess import * >> x=Popen(['python','myexif','-q','sys.argv[1]'], stdout=PIPE) >> y=Popen(['>','Exif.csv'], stdin=x.stdout) > > the y=... line doesn't make much sense. > > Why not just do os.system('myexif.py -q "pathfile" > test.csv') and be > done with it? If you don't care about your UI blocking for a second, > it should be rather trouble-free... > > -- > Ville M. Vainio > http://tinyurl.com/vainio > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > Thank you ville it's working. -- View this message in context: http://www.nabble.com/subprocess-in-PyQt-tp22510022p22519764.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] subprocess in PyQt
Mads Ipsen-3 wrote: > >> >> Hello guys; >> >> i have a function that suppose to do something and from terminal it has >> this >> syntax to be executed; >> >> was...@home:~/Desktop/Project2/GUI$ python myexif.py -q "pathfile" > >> test.csv >> >> so far on using subprocess i came up with this; >> >> from subprocess import * >> x=Popen(['python','myexif','-q','sys.argv[1]'], stdout=PIPE) >> y=Popen(['>','Exif.csv'], stdin=x.stdout) >> >> but i keep getting this error >> >> was...@home:~/Desktop/Project2/GUI$ python wrapphotodb.py >> Traceback (most recent call last): >> File "wrapphotodb.py", line 37, in _addphotoClicked >> y=Popen(['>','Exif.csv'], stdin=x.stdout) >> File "/usr/lib/python2.5/subprocess.py", line 594, in __init__ >> errread, errwrite) >> File "/usr/lib/python2.5/subprocess.py", line 1153, in _execute_child >> raise child_exception >> OSError: [Errno 2] No such file or directory >> >> Any idea? is my syntax correct? >> -- >> View this message in context: >> http://www.nabble.com/subprocess-in-PyQt-tp22510022p22510022.html >> Sent from the PyQt mailing list archive at Nabble.com. >> >> ___ >> PyQt mailing listPyQt@riverbankcomputing.com >> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> > > > Why don't you try to use a QProcess from spawning external processes? I > have a good success ratio with that approach. > > Mads > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > Okay how am i going to use it? i read for sometimes i couldn't understand -- View this message in context: http://www.nabble.com/subprocess-in-PyQt-tp22510022p22510772.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] subprocess in PyQt
Hello guys; i have a function that suppose to do something and from terminal it has this syntax to be executed; was...@home:~/Desktop/Project2/GUI$ python myexif.py -q "pathfile" > test.csv so far on using subprocess i came up with this; from subprocess import * x=Popen(['python','myexif','-q','sys.argv[1]'], stdout=PIPE) y=Popen(['>','Exif.csv'], stdin=x.stdout) but i keep getting this error was...@home:~/Desktop/Project2/GUI$ python wrapphotodb.py Traceback (most recent call last): File "wrapphotodb.py", line 37, in _addphotoClicked y=Popen(['>','Exif.csv'], stdin=x.stdout) File "/usr/lib/python2.5/subprocess.py", line 594, in __init__ errread, errwrite) File "/usr/lib/python2.5/subprocess.py", line 1153, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory Any idea? is my syntax correct? -- View this message in context: http://www.nabble.com/subprocess-in-PyQt-tp22510022p22510022.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Executing function with argument under a button in pyqt
Till Gerken-2 wrote: > > On Fri, Mar 13, 2009 at 2:23 PM, klia wrote: >> I have this function that is suppose to extract Exif(exchangeable image >> formate) from photos and direct the output to an .CSV file (comma >> seperated >> values) >> >> well the function syntax is like the following: >> >> was...@home:~/Desktop/Project2/GUI$ python myexif.py -q waseem1.JPG > >> test.csv >> >> in the program now my photos are listed in ListWidget... >> How can i select photo or multiple photos from the listwidget and execute >> the above syntax after clicking a button which is already there in order >> to >> create a CSV file?? > > Just create a new method that you connect to your button's clicked() > signal and include the Exif extraction code there. Since your Exif > extraction already seems to be in Python, you do not have to execute > any external programs. > > connect(yourButton, SIGNAL("clicked(bool)"), yourExifMethod) > > The signal is documented here: > http://doc.trolltech.com/4.4/qpushbutton.html#details > http://doc.trolltech.com/4.4/qabstractbutton.html#clicked > > Till > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > Thank you for replaying, creating a connect method ain't a problem for me but how to select photo in the ListWidget and then executing myexif functiion with -q argument? -- View this message in context: http://www.nabble.com/Executing-function-with-argument-under-a-button-in-pyqt-tp22496319p22496972.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Executing function with argument under a button in pyqt
hey guys; I have this function that is suppose to extract Exif(exchangeable image formate) from photos and direct the output to an .CSV file (comma seperated values) well the function syntax is like the following: was...@home:~/Desktop/Project2/GUI$ python myexif.py -q waseem1.JPG > test.csv in the program now my photos are listed in ListWidget... How can i select photo or multiple photos from the listwidget and execute the above syntax after clicking a button which is already there in order to create a CSV file?? Thanks in advance -- View this message in context: http://www.nabble.com/Executing-function-with-argument-under-a-button-in-pyqt-tp22496319p22496319.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] linking listwidget with Qgraphicsview
Matt Smith-23 wrote: > >>From the looks of it your list widget has the name of the file you want > to open and display so what you can do is connect the signal being > emitted, itemClicked(QListWidgetItem *), and then get the text from the > item passed with say my_list_item.text(). > >>From that you should be able to make a QPixmap with the file name and > put that in your graphicscene as a QGraphicsPixmapItem. > > mbs > > there are a couple signals you could use: > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qlistwidget.html > >> Message: 2 >> Date: Tue, 10 Mar 2009 05:49:35 -0700 (PDT) >> From: klia >> Subject: [PyQt] linking listwidget with Qgraphicsview >> To: pyqt@riverbankcomputing.com >> Message-ID: <22433529.p...@talk.nabble.com> >> Content-Type: text/plain; charset=us-ascii >> >> >> hey guys; >> >> in my application i have Listwidegt and Qgraphics view beside to each >> other >> in the interface, my intension is after i list my photos in the >> listwidget, >> i want that whenever i click on the photo on listwidget it will be >> displayed >> on the graphics view... >> >> Any idea on how to do that? >> >> here's the code of inserting photos into Listwidegt >> >> files = QFileDialog.getOpenFileNames(self, self.trUtf8("Add >> documentation"), >> QString("/home"), self.trUtf8("Images (*.png *.tiff *.jpg)")) >> for file_ in files: >> data = "" >> f = open(file_) >> #data = file.read() >> self.listWidget.addItem(file_) >> >> here's a screen shot of my inquiry >> http://www.nabble.com/file/p22433529/Screenshot-MainWindow-1.png >> -- > > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > Thanks for the hint but i have QGraphicsview widget not graphicscene, how can i implement QgraphicsPixmapItem? so far i came with this, is it correct? files = QFileDialog.getOpenFileNames(self, self.trUtf8("Add documentation"), > QString("/home"), self.trUtf8("Images (*.png *.tiff *.jpg)")) > for file_ in files: > data = "" > f = open(file_) > #data = file.read() > self.listWidget.addItem(file_) self.listWidget.setItemSelected(file_) self.my_list_item.text(file_) self.photosdisplay.addPixmap(file_) but nothing happened when i clicked? -- View this message in context: http://www.nabble.com/linking-listwidget-with-Qgraphicsview-tp22433529p22454858.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] linking listwidget with Qgraphicsview
hey guys; in my application i have Listwidegt and Qgraphics view beside to each other in the interface, my intension is after i list my photos in the listwidget, i want that whenever i click on the photo on listwidget it will be displayed on the graphics view... Any idea on how to do that? here's the code of inserting photos into Listwidegt files = QFileDialog.getOpenFileNames(self, self.trUtf8("Add documentation"), QString("/home"), self.trUtf8("Images (*.png *.tiff *.jpg)")) for file_ in files: data = "" f = open(file_) #data = file.read() self.listWidget.addItem(file_) here's a screen shot of my inquiry http://www.nabble.com/file/p22433529/Screenshot-MainWindow-1.png -- View this message in context: http://www.nabble.com/linking-listwidget-with-Qgraphicsview-tp22433529p22433529.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qfiledailoug multiple file selection
Detlev Offenbach wrote: > > On Samstag, 7. März 2009, klia wrote: >> Detlev Offenbach wrote: >> > On Freitag, 6. März 2009, klia wrote: >> >> Hey folks; >> >> >> >> How can i be able to select multiple files whenever i browse my >> >> directory using QfileDailoug? >> >> >> >> this is the code to call up the filedailoug >> >> >> >> files = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/', >> >> ("Images (*.png *.tiff *.jpg)")) >> > >> > Just use "getOpenFileNames(...)". See the docs for more details. >> > >> >> Thank you >> > >> > -- >> > Detlev Offenbach >> > det...@die-offenbachs.de >> > >> > ___ >> > PyQt mailing listPyQt@riverbankcomputing.com >> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> >> Thank you Detlev Offenbach it worked but python complaining that there's >> no >> buffer or string to hold the selected files in order to process >> them...Any idea > > Just call it like this: > > fileNames = QFileDialog.getOpenFileNames(\ > self, > self.trUtf8("Add Documentation"), > QString("/home"), > self.trUtf8("Qt Compressed Help Files (*.qch)")) > > Detlev > -- > Detlev Offenbach > det...@die-offenbachs.de > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > hey man; it worked perfectly after commenting this line: #data = file.read() anyway, i still have one more question, in my interface i have few buttons that should be linked with functions, my functions are in separate .py files but some of the functions when i execute them from terminal they should be in this syntax was...@home:~$python csv2sql.py -t my_table photos.csv | sqlite 3 photos.db how can i be able to link such a function with this syntax in pyqt? -- View this message in context: http://www.nabble.com/Qfiledailoug-multiple-file-selection-tp22369488p22432064.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qfiledailoug multiple file selection
Detlev Offenbach wrote: > > On Samstag, 7. März 2009, klia wrote: >> Detlev Offenbach wrote: >> > On Freitag, 6. März 2009, klia wrote: >> >> Hey folks; >> >> >> >> How can i be able to select multiple files whenever i browse my >> >> directory using QfileDailoug? >> >> >> >> this is the code to call up the filedailoug >> >> >> >> files = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/', >> >> ("Images (*.png *.tiff *.jpg)")) >> > >> > Just use "getOpenFileNames(...)". See the docs for more details. >> > >> >> Thank you >> > >> > -- >> > Detlev Offenbach >> > det...@die-offenbachs.de >> > >> > ___ >> > PyQt mailing listPyQt@riverbankcomputing.com >> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> >> Thank you Detlev Offenbach it worked but python complaining that there's >> no >> buffer or string to hold the selected files in order to process >> them...Any idea > > Just call it like this: > > fileNames = QFileDialog.getOpenFileNames(\ > self, > self.trUtf8("Add Documentation"), > QString("/home"), > self.trUtf8("Qt Compressed Help Files (*.qch)")) > > Detlev > -- > Detlev Offenbach > det...@die-offenbachs.de > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > hello Detlev I am supposed to select multiple files and list them on listwidget but i am able only to select one file and list it on listwidget using this code files = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/', ("Images (*.png *.tiff *.jpg)")) data="" if(files): file=open(files) data = file.read() self.listWidget.addItem(files) but when i pasted your code files = QFileDialog.getOpenFileNames(self, self.trUtf8("Add documentation"), QString("/home"), self.trUtf8("Images (*.png *.tiff *.jpg)")) data="" if(files): file=open(files) data = file.read() self.listWidget.addItem(files) python returned this error was...@home:~/Desktop/Project2/GUI$ python wrapphotodb.py Traceback (most recent call last): File "wrapphotodb.py", line 50, in _actionImport_Photos file=open(files) TypeError: coercing to Unicode: need string or buffer, QStringList found plus what do you mean by Add Documentation in your code?! -- View this message in context: http://www.nabble.com/Qfiledailoug-multiple-file-selection-tp22369488p22408007.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qfiledailoug multiple file selection
Detlev Offenbach wrote: > > On Freitag, 6. März 2009, klia wrote: >> Hey folks; >> >> How can i be able to select multiple files whenever i browse my directory >> using QfileDailoug? >> >> this is the code to call up the filedailoug >> >> files = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/', >> ("Images (*.png *.tiff *.jpg)")) > > Just use "getOpenFileNames(...)". See the docs for more details. > >> >> Thank you > > > > -- > Detlev Offenbach > det...@die-offenbachs.de > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > Thank you Detlev Offenbach it worked but python complaining that there's no buffer or string to hold the selected files in order to process them...Any idea -- View this message in context: http://www.nabble.com/Qfiledailoug-multiple-file-selection-tp22369488p22384191.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Qfiledailoug multiple file selection
Hey folks; How can i be able to select multiple files whenever i browse my directory using QfileDailoug? this is the code to call up the filedailoug files = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/', ("Images (*.png *.tiff *.jpg)")) Thank you -- View this message in context: http://www.nabble.com/Qfiledailoug-multiple-file-selection-tp22369488p22369488.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QListView Global funcation behaviour
hey folks; I am trying to list photos on QlistView by browsing using Qfiledailoug... so far i was doing the following filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/') #this one calls the file dailoug for browsing filename = [] # this one is an array to hold selected files filename = listViewitem1() # this one is suppose to list the files on listview anyway i was getting an error saying that there is no global name for (listViewitem1), so i had to define a global function for it. here it's filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/') filename = [] filename = listViewitem1(filename, self) class listViewitem1(QAbstractListModel): def __init__(self, datain, parent=None, *args): """ datain: a list where each item is a row """ QAbstractTableModel.__init__(self, parent, *args) self.filename = datain def rowCount(self, parent=QModelIndex()): return len(self.filename) def data(self, index, role): if index.isValid() and role == Qt.DisplayRole: return QVariant(self.filename[index.row()]) else: return QVariant() Then it runs with no errors but when i browse through my directory and select a file, nothing happens (no file is listed on QListView) and no errors occurred either. Any ideas will be so helpful Thank you -- View this message in context: http://www.nabble.com/QListView-Global-funcation-behaviour-tp22269640p22269640.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re[PyQt] directing function output from one widget to another
hello everyone i have a search program that query about data in DB created using sqlite. i have build a small interface to be linked with the program in qt designer. how can i redirect my output of the search from lineEdit to listViewitem widget whenever i click search. http://www.nabble.com/file/p22020178/Screenshot-MainWindow.png Screenshot-MainWindow.png and here's the code of my main program import sys import os from search import Ui_MainWindow as UIMW from PyQt4 import QtCore, QtGui import urllib2 as ulib import sqlite3 from pysqlite2 import dbapi2 as sqlite3 def globalF(): connection = sqlite3.connect('Photos.db') memoryConnection = sqlite3.connect(':memory:') cursor = connection.cursor() cursor.execute('SELECT * FROM photos where Tag = "Tag"') print cursor.fetchall() class MainWindow (QtGui.QMainWindow, UIMW): def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.__setupConnection() def __setupConnection(self): self.connect(self.pushButton, QtCore.SIGNAL("clicked()"), globalF) def _pushButtonClicked(self): search=str(self.lineEdit.text()).strip() if search: try: self.listWidget.append(ulib.searchresult(search).read()) except: pass else: pass if __name__=="__main__": app=QtGui.QApplication(sys.argv) w=MainWindow() w.show() sys.exit(app.exec_()) -- View this message in context: http://www.nabble.com/Redirecting-function-output-from-one-widget-to-another-tp22020178p22020178.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] AttributeError: global name 'QListView' is not defined
~/Project2/GUI$ python wrapphotodb.py Traceback (most recent call last): File "wrapphotodb.py", line 48, in _actionImport_Photos self.listView([QListView("filename %i" % i)]) NameError: global name 'QListView' is not defined I am getting this error regarding this line.. self.listView([QListView("filename %i" % i)]) and this error when i add append self.listView.append([QListView("filename %i" % i)]) ~/Project2/GUI$ python wrapphotodb.py Traceback (most recent call last): File "wrapphotodb.py", line 48, in _actionImport_Photos self.listView([QListView("filename %i" % i)]) AttributeError: append any idea?!!! -- View this message in context: http://www.nabble.com/AttributeError%3A-global-name-%27QListView%27-is-not-defined-tp21896838p21896838.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] defining QlistViewitem in python
hello folks i have this problems in my codes. i am try to link qfiledailoug with qlistviewitem so that whenever i chose a file it would be loaded in qlistview item using this function self.item.append(QlistViewitem(self.tree, 'filename')) but whenever i try that it gives me an attribute error so, how can i define qlistviewitem in the following codes. import sys import shutil from test import Ui_MainWindow as UIMW from PyQt4 import QtCore, QtGui import urllib2 as ulib #import QFileDialog.py #from PyQt4 import QtGui #from PyQt4 import QtCore class MyWindow(QtGui.QMainWindow, UIMW): def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.__setupConnections() def __setupConnections(self): self.connect(self.addphoto, QtCore.SIGNAL("clicked()") ,self._addphotoClicked) self.connect(self.addphotoandtag, QtCore.SIGNAL("clicked()") ,self._addphotoandtagClicked) self.connect(self.removephoto, QtCore.SIGNAL("clicked()") ,self._removephotoClicked) self.connect(self.searchphoto, QtCore.SIGNAL("clicked()" ) ,self._searchphotoClicked) self.connect(self.cancel, QtCore.SIGNAL("clicked()"), self._cancelClicked) self.connect(self.actionImport_Photos, QtCore.SIGNAL("triggered()") self._actionImport_Photos) self.connect(self.actionExit, QtCore.SIGNAL("triggered()"), self._actionExit) self.connect(self.listView, QtCore.SIGNAL("triggered()"), self._listView) def _addphotoClicked(self): shutil.copytree('/home/waseem/My Pictures/yemen 2008/2008/1', '/home/waseem/test') def _addphotoandtagClicked(self): pass def _searchphotoClicked(self): pass def _removephotoClicked(self): pass def _FinishClicked(self): pass def _cancelClicked(self): pass def _actionImport_Photos(self): filename = QtGui.QFileDialog.getOpenFileName(self, 'Import Photo', '/home/')#, tr('Images (*.png *.xpm *.jpg)')); #self.items=[] self.item.append(QlistViewitem(self.tree, 'filename')) # file=open(filename) #data = file.read() #print data #self.photosdisplay.read(data) def _actionExit(self): pass def _listView(self): pass #class Import_Photos(QtGui.QMainWindow, UIMW): if __name__=="__main__": app=QtGui.QApplication(sys.argv) w=MyWindow() w.show() sys.exit(app.exec_()) -- View this message in context: http://www.nabble.com/defining-QlistViewitem-in-python-tp21846265p21846265.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] building file dialoug
hello folks; i am trying to build to a file dialog that i can use to brows through my home directory and files and be able to chose multiple photos and load them to the application front.. i am stuck with theses codes,,,any ideas Thanks in advance import sys from PyQt4 import QtGui from PyQt4 import QtCore class OpenFile(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setGeometry(300, 300, 350, 300) self.setWindowTitle('OpenFile') self.textEdit = QtGui.QTextEdit() self.setCentralWidget(self.textEdit) self.statusBar() self.setFocus() exit = QtGui.QAction(QtGui.QIcon('open.png'), 'Open', self) exit.setShortcut('Ctrl+O') exit.setStatusTip('Open new File') self.connect(exit, QtCore.SIGNAL('triggered()'), self.showDialog) menubar = self.menuBar() file = menubar.addMenu('&File') file.addAction(exit) def showDialog(self): filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '/home/') file=open(filename) data = file.read() self.textEdit.setText(data) app = QtGui.QApplication(sys.argv) cd = OpenFile() cd.show() app.exec_() -- View this message in context: http://www.nabble.com/building-file-dialoug-tp21596605p21596605.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt