Be careful...
Are you sure that the function itself is not being called within that module you wish to import??
Any function may call another function, and you should be concerned about that.
bye
[وسط]
♥ Countess ♥

♥
[/وسط]
Be careful...
Are you sure that the function itself is not being called within that module you wish to import??
Any function may call another function, and you should be concerned about that.
bye
[وسط]
♥ Countess ♥

♥
[/وسط]
رغـد كتب:Be careful...Are you sure that the function itself is not being called within that module you wish to import??
Any function may call another function, and you should be concerned about that.
bye
Dear sister;
Thanks for your kind interaction with my project problems, to save us both time, here's what i am trying to do:
I have this function using shell utility module which copies a directory from one location to another nonexistent location. when i do import the file name which is copying_photos.py as you suggested in header of my wrapper in the previous page of this thread. it copies files even before i click the button which is suppose to do that..! so can you take this example and give me an example :blush: to implement that in a SIGNALS and SLOTS environment without copying the codes to the actual program. because this example is just a prototype. i have other functions.py which containes hunderds lines of codes to be executed with i click on a button which i don't think it be a good action to copy em to the actual program where interface is called up...
Just to be sure..I hope to know how to call the copying_photos.py under the button which will execute whatever functions comes in it WITHOUT attempting to copying the actuall codes of copying_photos.py to the main program of SLOTS and SIGNALS. :wacko:
import sys
import shutil
shutil.copytree('/home/waseem/My Pictures/yemen 2008/2008/1', '/home/waseem/test')Thank you
تم تعديل هذه المشاركة بواسطة ubuntu-pro في 8 فبراير 2009 في 08:04
ubuntu-pro كتب:Dear sister;Thanks for your kind interaction with my project problems, to save us both time, here's what i am trying to do:
I have this function using shell utility module which copies a directory from one location to another nonexistent location. when i do import the file name which is copying_photos.py as you suggested in header of my wrapper in the previous page of this thread. it copies files even before i click the button which is suppose to do that..! so can you take this example and give me an example :blush: to implement that in a SIGNALS and SLOTS environment without copying the codes to the actual program. because this example is just a prototype. i have other functions.py which containes hunderds lines of codes to be executed with i click on a button which i don't think it be a good action to copy em to the actual program where interface is called up...
Just to be sure..I hope to know how to call the copying_photos.py under the button which will execute whatever functions comes in it WITHOUT attempting to copying the actuall codes of copying_photos.py to the main program of SLOTS and SIGNALS. :wacko:
import sys import shutil shutil.copytree('/home/waseem/My Pictures/yemen 2008/2008/1', '/home/waseem/test')Thank you
You're welcome my dear brother...
:happy:
I see!
Actually I'm so sorry and it was my mistake when I'd forgotten about the type restriction issues related to Signal and Slot mechnism.
well...
The appropriate signal' arguments must match the arguments of that slot connected with. For example, the following it was probably your attempt.
Yes, this will make a copy directory without any effort to push the pushButton. But from the PyQt point of view (not Python itself), this will raise an exception called "typeError" and it will raise it behind the scene of pyQt. That is, in the Python shell itself.
Ok, how do you solve this problem?
The answer is quite simple. Just you may make a global function or a method with argument(s) suitable for "clicked()" signal of the pushButton and let them bear the responsibility for calling copytree() function.
Exactly as the following, and in my early example again:
I've modified it to illustrate the proper way of the solution.
I hope so... :happy:
تم تعديل هذه المشاركة بواسطة رغـد في 9 فبراير 2009 في 03:54
[وسط]
♥ Countess ♥

♥
[/وسط]
رغـد كتب:You're welcome my dear brother...:happy:
I see!
Actually I'm so sorry and it was my mistake when I'd forgotten about the type restriction issues related to Signal and Slot mechnism.
well...
The appropriate signal' arguments must match the arguments of that slot connected with. For example, the following it was probably your attempt.
self.connect(pushButton, SIGNAL("clicked()"),shutil.copytree( '/home/waseem/My Pictures/yemen 2008/2008/1', '/home/waseem/test'))Yes, this will make a copy directory without any effort to push the pushButton. But from the PyQt point of view (not Python itself), this will raise an exception called "typeError" and it will raise it behind the scene of pyQt. That is, in the Python shell itself.
Ok, how do you solve this problem?
The answer is quite simple. Just you may make a global function or a method with argument(s) suitable for "clicked()" signal of the pushButton and let them bear the responsibility for calling copytree() function.
Exactly as the following, and in my early example again:
I've modified it to illustrate the proper way of the solution.
import sys import shutil from PyQt4.QtCore import * from PyQt4.QtGui import * #Option
ally you may use this... #Read the internal comments nested here... def globalF(): #This we
ll never be executed until you call globalF(). #Just check the path... shutil.copytree(
'/home/waseem/My Pictures/yemen 2008/2008/1', '/home/waseem/test')
class Example(QDialog): def __init__(self, parent = None): super(Example, self).__
init__(parent) #create and layout widgets... self.label = QLabel("...")
button1 = QPushButton('Copy Directory1') button2 = QPushButton('Copy Directory2')
layout = QVBoxLayout() layout.addWidget(self.label) layout.addWidget(bu
tton1) layout.addWidget(button2) self.setLayout(layout) self.setWindo
wTitle('SignalSlot') #connect using signal and slot mechanism #connect button
1 to call copyDirectory method as a slot self.connect(button1, SIGNAL("clicked()"), s
elf.copyDirectory) #Here we connect button2 with globalF as a slot. self.
connect(button2, SIGNAL("clicked()"), globalF) # A method treated as a slot...Read the
nested comments. def copyDirectory(self): #leave it to copyDirectory method.
#just check the path... shutil.copytree('/home/waseem/My Pictures/yemen 2008/20
08/1', '/home/waseem/test') def main(): app = QApplicatio
n(sys.argv) example = Example() example.show() app.exec_() if __name__ == '
__main__': main()I hope so... :happy:
well, thanks again my dear sis :lol:
The example provided is quite what i asked for -_- but in case of having a function.py not with few lines of codes but more than 100 line of codes, shall i use the same technique like you did?
Other two questions in relation with SIGNALS and SLOTS, i am trying to figure out what does this error mean?
~/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 definedregarding this line self.listView([QListView("filename %i" % i)])
besides, whenever i add append in this form self.listView.append([QListView("filename %i" % i)]) i get this error
~/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: appendany idea?
and my last question.. are there any differences between creating my UI using qt designer and then converting it to python classes or using PYQT to design my interface from scratch? sometimes your provided code and mine is slightly different!
Thank you
تم تعديل هذه المشاركة بواسطة ubuntu-pro في 9 فبراير 2009 في 09:43
Hunderds, or even thousands of lines, it is not a problem! as long as the functions.py has been written typically. That is, as a typical module.
Without any specification or special cases:
the rules are the rules.
- Import module(s)
- use its/thier function(s)/class(s)/data...etc
- Signal and slot mechanism calls any callable critter running/creeping in the wild of Python. Of course there is another consideration about the types of the arguments.
sorry I'm watching Tv, a program about wild animals...
.,.,.,.,.,.,.,.,
اقتباسand my last question.. are there any differences between creating my UI using Qt designer and then converting it to python classes or using PyQt to design my interface from scratch? sometimes your provided code and mine is slightly different!
Nope
باللهجة السوريانية "بنوب"
There is no difference, You can build your UI manually or by using pyQt Designer.
I wirte my own code manually but typically and I build my own software by well-engineered-designed manners.
You're welcome again...
[وسط]
♥ Countess ♥

♥
[/وسط]
رغـد كتب:Hunderds, or even thousands of lines, it is not a problem! as long as the functions.py has been written typically. That is, as a typical module.Without any specification or special cases:
the rules are the rules.
- Import module(s)
- use its/thier function(s)/class(s)/data...etc
- Signal and slot mechanism calls any callable critter running/creeping in the wild of Python. Of course there is another consideration about the types of the arguments.
sorry I'm watching Tv, a program about wild animals...
.,.,.,.,.,.,.,.,
Nope
باللهجة السوريانية "بنوب"
There is no difference, You can build your UI manually or by using pyQt Designer.
I wirte my own code manually but typically and I build my own software by well-engineered-designed manners.
You're welcome again...
Thank you
and
Wish me luck to finish this project
BY THE WAY CAN I STILL ASK YOU QUESTIONS REGARDING ANY PYTHON PROBLEMS?
بخصوص لو كان الـ module عبارة عن مية سطر هيك مرمايين و كلياتن عبارة عن ندائات لدوال معينة و تنفيذ اوامر و مش منسقة و معمولة بطريقة نموذجية!!!
بصراحة خايفة ما يكون هالملف غير صالح لأي برنامج نموذجي...
:happy:
انت بتحكي انجليزي منيح لشو ما بتاخد كتاب ممتاز و ببتبدا من الصفر و كمان قاموسك التكنلوجي عال و باين عليك هيك بأنك مبرمج بلغات تانية بس انت محتار بالتطبيق هاد مع pyQt!!
آسفة اخي استحملني شوي لتعليقاتي, انا ضويجة كتير...
:happy:
ubuntu-pro كتب:Thank you
and
Wish me luck to finish this project
BY THE WAY CAN I STILL ASK YOU QUESTIONS REGARDING ANY PYTHON PROBLEMS?
آسفة انت عم تكتب و انا عم بكتب
:happy:
أمرك اخي اسآل ياللي بدك ياه
موفق يارب
:happy:
[وسط]
♥ Countess ♥

♥
[/وسط]
رغـد كتب:بخصوص لو كان الـ module عبارة عن مية سطر هيك مرمايين و كلياتن عبارة عن ندائات لدوال معينة و تنفيذ اوامر و مش منسقة و معمولة بطريقة نموذجية!!!بصراحة خايفة ما يكون هالملف غير صالح لأي برنامج نموذجي...
:happy:
انت بتحكي انجليزي منيح لشو ما بتاخد كتاب ممتاز و ببتبدا من الصفر و كمان قاموسك التكنلوجي عال و باين عليك هيك بأنك مبرمج بلغات تانية بس انت محتار بالتطبيق هاد مع pyQt!!
آسفة اخي استحملني شوي لتعليقاتي, انا ضويجة كتير...
:happy:
آسفة انت عم تكتب و انا عم بكتب
:happy:
أمرك اخي اسآل ياللي بدك ياه
موفق يارب
:happy:
اختي العزيزة
اشكرك لطفك وتعليقاتك مرحب بها
انا مشروعي يتعامل مع الصور بحيث انة الهدف من المشروع هو تقليل الوقت المطلوب مشان البحث عنها
لبرنامج المفروض انة يشتغل على اللينكس يونيكس ومستر ويندوز والبايثون كان اختيار المشرف تبعي والكيوتي كانت اختياري
والان الامور ماشية انا مخلص اكثر من 60 في المائة من المشروع بس عندي مشاكل معينة واهمها هي في الصقحة 3 من هذا الموضوع والوقت مش في صالحي لانة لازم في يوم 13 مارس يكون البرنامج على الاقل قابل للعرض لانة يوم التسليم ومااعتقد عندي وقت لاكثر من بحث لانة انا مربط باشياء اخرى
سؤال فضولي انتي من سورية او العراق؟ :P
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…