PyQt event recognition

2010-01-13 Thread Zabin
Hey Everyone!

I am a new pyqt programmer. I have a tab widget with lots of line
edits, radiobuttons and combo boxes. I want to trigger a single sub
the moment any one of these widgets listed are modified. I tried using
the clicked signal- but it doesnt seem to work. Any suggestion will be
much appreciated.

Cheers!

Zabin

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt event recognition

2010-01-13 Thread Zabin
On Jan 14, 9:00 am, Zabin zabin.faris...@gmail.com wrote:
 Hey Everyone!

 I am a new pyqt programmer. I have a tab widget with lots of line
 edits, radiobuttons and combo boxes. I want to trigger a single sub
 the moment any one of these widgets listed are modified. I tried using
 the clicked signal- but it doesnt seem to work. Any suggestion will be
 much appreciated.

 Cheers!

 Zabin

Essentailly what i am looking for is a way to easily and quickly
attach multiple objects to the same slot via the same signal

Cheers
Zabin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt event recognition

2010-01-13 Thread Zabin
On Jan 14, 10:22 am, Jonathan Gardner jgard...@jonathangardner.net
wrote:
 On Jan 13, 12:21 pm, Zabin zabin.faris...@gmail.com wrote:

  On Jan 14, 9:00 am, Zabin zabin.faris...@gmail.com wrote:

   I am a new pyqt programmer. I have a tab widget with lots of line
   edits, radiobuttons and combo boxes. I want to trigger a single sub
   the moment any one of these widgets listed are modified. I tried using
   the clicked signal- but it doesnt seem to work. Any suggestion will be
   much appreciated.

  Essentailly what i am looking for is a way to easily and quickly
  attach multiple objects to the same slot via the same signal

 Zabin, you'd probably get a better response on the PyQt mailing list,
 or even the Qt mailing list for Qt API and behavior.

will try that- thanks=)
-- 
http://mail.python.org/mailman/listinfo/python-list


Undo/Redo in PyQt

2010-01-12 Thread Zabin
Hey!

I am trying to implement the undo and redo facility in pyqt. I have
gone through some sites and was wondering whether iyou always need to
create subclasses and their definitions for the undo/redo action. My
program currently has a single window in which the user enters
information which is used to update a text file as soon as the user
leaves the field- so i essentially need to undo the text in that field
as well as the file. I am puzzled as to how to approach this. Any help
will be much appreciated!

Cheers
Zabin
-- 
http://mail.python.org/mailman/listinfo/python-list


os.system function

2010-01-11 Thread Zabin
Hey everyone!

I am a new python programmer. I am trying to get the general file
functionality with options of save and save as working. These save
functions save a folder with multiple files. Upon using the os.system
copy function- if my destination directory has files with similar
names- i am asked whether i want to replace the files on the command
prompt.

Is there some way of getting this question into a dialog box?

Also is there someway of avoiding or programmatically setting the
response to the command prompt?

Cheers
Zabin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.system function

2010-01-11 Thread Zabin
On Jan 12, 10:23 am, Chris Rebert c...@rebertia.com wrote:
 On Mon, Jan 11, 2010 at 12:43 PM, Zabin zabin.faris...@gmail.com wrote:
  Hey everyone!

  I am a new python programmer. I am trying to get the general file
  functionality with options of save and save as working. These save
  functions save a folder with multiple files. Upon using the os.system
  copy function- if my destination directory has files with similar
  names- i am asked whether i want to replace the files on the command
  prompt.

  Is there some way of getting this question into a dialog box?

  Also is there someway of avoiding or programmatically setting the
  response to the command prompt?

 You can probably avoid using os.system() entirely (always a good
 thing) by instead using the functions in the `shutil` 
 library:http://docs.python.org/library/shutil.html

 And for future reference, the `subprocess` module is the preferred way
 to invoke external programs, rather than 
 os.system():http://docs.python.org/library/subprocess.html

 Cheers,
 Chris
 --http://blog.rebertia.com

Thanks for the pointersi had a look around and found the site:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true

to disable the prompt- i needed to include /y as below:
 os.system ('xcopy /s %s %s /y ' % (dirExe, dirname_new))


and just wondering- whats the drawback of using os.system() command

Appreciate the prompt suggestions!

Cheers
Zabin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.system function

2010-01-11 Thread Zabin
On Jan 12, 11:31 am, Jeremy Sanders jeremy
+complangpyt...@jeremysanders.net wrote:
 Zabin wrote:
  Thanks for the pointersi had a look around and found the site:

 http://www.microsoft.com/resources/documentation/windows/xp/all/prodd...
 us/xcopy.mspx?mfr=true



  to disable the prompt- i needed to include /y as below:
   os.system ('xcopy /s %s %s /y ' % (dirExe, dirname_new))

  and just wondering- whats the drawback of using os.system() command

 - It won't work across different platforms (unix, mac, windows)
 - Spaces or special characters in the filename will mess up the command line
 and can lead to huge security flaws in your program.
 - It's inefficient as you have to start a new program to do the work (slow
 on windows)
 - Error handling from the xcopy process will not be easy

 --
 Jeremy Sandershttp://www.jeremysanders.net/

wow- thanks heaps!
-- 
http://mail.python.org/mailman/listinfo/python-list


Linking Python to multiple qt forms

2010-01-11 Thread Zabin
Hey!

I am new to PyQt programming and am trying to activate a secondary qt
form from a primary form. I am unsure as to how this will work as i am
using pyuic4 to convert .ui file to .py and then importing it by:

from SimLCM_GUI import Ui_main

I am unsure as to how the self.uicommands will function if there
are two such .ui files.

Thanks in advance for any advice!

Cheers
Zabin
-- 
http://mail.python.org/mailman/listinfo/python-list


setTextAlignment function Qtablewidget PyQt

2010-01-10 Thread Zabin
Hey!

I am trying to align contents of some table cells but find the code
below working for some fields and not for others. I am stuck as to why
this is happening. Help will be gretly appreciated!

setTextAlignment(QtCore.Qt.AlignVCenter)

Cheers
Zabin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: setTextAlignment function Qtablewidget PyQt

2010-01-10 Thread Zabin
On Jan 11, 1:10 pm, Zabin zabin.faris...@gmail.com wrote:
 Hey!

 I am trying to align contents of some table cells but find the code
 below working for some fields and not for others. I am stuck as to why
 this is happening. Help will be gretly appreciated!

 setTextAlignment(QtCore.Qt.AlignVCenter)

 Cheers
 Zabin

Figured it out!
It was just the '\n' character being read with the line from the text
file that messed up the formatting.
just needed to use the line.strip() function before passing it to the
table as a table widget item.

-- 
http://mail.python.org/mailman/listinfo/python-list


QDoubleValidator

2010-01-06 Thread Zabin
Hey!

I am new PyQt programmer and want to restrict users to allow only
numeric values into a table and lineedit boxes. I found the
QDoubleValidator class but am unsure as to how to implement it. (I am
a little shaky on the concept of parent and how to define them). Any
help would be much appreciated!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: QDoubleValidator

2010-01-06 Thread Zabin
On Jan 7, 10:23 am, Zabin zabin.faris...@gmail.com wrote:
 Hey!

 I am new PyQt programmer and want to restrict users to allow only
 numeric values into a table and lineedit boxes. I found the
 QDoubleValidator class but am unsure as to how to implement it. (I am
 a little shaky on the concept of parent and how to define them). Any
 help would be much appreciated!

I managed to get it going for the line edit- but am stuck with
checking a cell in a table as cells do not have the set validator
attribute- here's the code i had for the line edit:

 self.ui.Thickness_datum.setValidator(QtGui.QDoubleValidator(-999.0,
999.0, 2, self.ui.Thickness_datum))

for the table i thought it would be:

self.ui.table_process.item(row,2).setValidator(QtGui.QDoubleValidator
(-999.0, 999.0, 2, self.ui.table_process.item(row,2)))

Any help would be appreciated
-- 
http://mail.python.org/mailman/listinfo/python-list


Validating cells of a table PyQt

2010-01-06 Thread Zabin
Hey!

I am new PyQT programmer. I am trying to create a table in which cells
only take in numeric data. I am unable to use setValidator on table
cells. Looking around i found some material on the editor attribute
but I dont know how to apply this. Any help will be appreciated

Cheers!
-- 
http://mail.python.org/mailman/listinfo/python-list


PyQt Signals and multiple sources

2009-12-20 Thread Zabin
I am beginner in programming in pyqt. I have been trying to call the
same function from multiple events- but each event results in a
different instance of the function. I am just unable to figure out how
to retrieve the source which calls the function:

My source signal declarations are as below:
QtCore.QObject.connect(self.ui.Button_Process, QtCore.SIGNAL(clicked
()), self.activate_tab)
QtCore.QObject.connect(self.ui.Button_Material, QtCore.SIGNAL(clicked
()), self.activate_tab)
QtCore.QObject.connect(self.ui.Button_Geometry, QtCore.SIGNAL(clicked
()), self.activate_tab)

for each of the above source i want to activate a different instance
of the activate_tab function. Any help would be greatly appreciated!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt Signals and multiple sources

2009-12-20 Thread Zabin
On Dec 21, 11:15 am, John Posner jjpos...@optimum.net wrote:
 On Sun, 20 Dec 2009 16:59:11 -0500, Zabin zabin.faris...@gmail.com wrote:
  I am beginner in programming in pyqt. I have been trying to call the
  same function from multiple events- but each event results in a
  different instance of the function. I am just unable to figure out how
  to retrieve the source which calls the function:

  My source signal declarations are as below:
  QtCore.QObject.connect(self.ui.Button_Process, QtCore.SIGNAL(clicked
  ()), self.activate_tab)
  QtCore.QObject.connect(self.ui.Button_Material, QtCore.SIGNAL(clicked
  ()), self.activate_tab)
  QtCore.QObject.connect(self.ui.Button_Geometry, QtCore.SIGNAL(clicked
  ()), self.activate_tab)

  for each of the above source i want to activate a different instance
  of the activate_tab function. Any help would be greatly appreciated!

 In the self.activate_tab() method, use self.sender() to determine which  
 object sent the signal.

 -John- Hide quoted text -

 - Show quoted text -

Awesum. That works!

To get the object name you just need to use self.sender().objectName()

Cheers!
-- 
http://mail.python.org/mailman/listinfo/python-list