[PyQt] hidden signals?
hello, sorry for the tons of beginner-questions and thanks for your patience. there is a strange behaviour of a pushbutton and do not see, why it is ... there are two buttons and two lineedits. if the first button is clicked, only the first lineedit should be alive if the second button is clicked, the user should insert some data first in the first and then in the second lineedit. the program seems to pass the first-lineedit's slot correctly, but after that it runs through the first-button-slot, i never told it to do so !!?? I remember Java to have lots of builtin FocusEvents, but I do not think that this is the problem here. Can you give me a hint? Thanks a lot Merry Christmas jochen output: btn2_Clicked !Modus_firstButton edit1_ReturnPressed, !Modus_firstButton btn1.has NO Focus # btn1_Clicked#?? Modus_firstButton self.connect(self.btn1, SIGNAL(clicked()), self.btn1_Clicked) self.connect(self.btn2, SIGNAL(clicked()), self.btn2_Clicked) self.connect(self.edit1, SIGNAL(returnPressed()), self.edit1_ReturnPressed) self.connect(self.edit2, SIGNAL(returnPressed()), self.edit2_ReturnPressed) def btn1_Clicked(self): self.qtb_browser.append(btn1_Clicked) self.Modus_firstButton = True self.qtb_browser.append(Modus_firstButton) self.edit2.setDisabled(True) self.edit1.selectAll() self.edit1.setFocus() def btn2_Clicked(self): self.qtb_browser.append(btn2_Clicked) self.Modus_firstButton = False self.qtb_browser.append(!Modus_firstButton) self.edit1.selectAll() self.edit1.setFocus() def edit1_ReturnPressed(self): if self.Modus_firstButton: self.qtb_browser.append(edit1_ReturnPressed, Modus_firstButton) else: self.qtb_browser.append(edit1_ReturnPressed, !Modus_firstButton) self.edit2.setDisabled(False) self.edit2.selectAll() self.edit2.setFocus() if self.btn1.hasFocus(): self.qtb_browser.append(btn1.hasFocus) else: self.qtb_browser.append(btn1.has NO Focus) def edit2_ReturnPressed(self): self.qtb_browser.append(edit2_ReturnPressed) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] hidden signals?
On 24.12.07 09:16:17, Jochen Georges wrote: hello, sorry for the tons of beginner-questions and thanks for your patience. there is a strange behaviour of a pushbutton and do not see, why it is ... there are two buttons and two lineedits. if the first button is clicked, only the first lineedit should be alive if the second button is clicked, the user should insert some data first in the first and then in the second lineedit. the program seems to pass the first-lineedit's slot correctly, but after that it runs through the first-button-slot, i never told it to do so !!?? I remember Java to have lots of builtin FocusEvents, but I do not think that this is the problem here. Can you give me a hint? Thats not a simple self-contained example that demonstrates the problem. Sorry, but you have to create an app that we can simply run to check what exactly happens and whats wrong with that behaviour. Especially when the verbal description is relatively unclear like in this case (at least to me). Andreas -- Don't read any sky-writing for the next two weeks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ANN: new eric4 snapshot
Hi, this is to announce the availability of a new eric 4.1 snapshot release. It fixes a few bugs and includes these new functions. - made number of Subversion commit messages to remember configurable - added buttons to edit the Subversion config and servers file to the Subversion configuration page - changed the plugin installation dialog to be able to install multiple plugin archives - added menu entry and code to create a snapshot plugin archive - added a simplified editor dialog and an associated main script - created a main script to start the plugin repository dialog Regards, Detlev -- Detlev Offenbach [EMAIL PROTECTED] ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] hidden signals?
On Monday 24 December 2007 12:25:14 Andreas Pakulat wrote: On 24.12.07 09:16:17, Jochen Georges wrote: Thats not a simple self-contained example that demonstrates the problem. Sorry, but you have to create an app that we can simply run to check what exactly happens and whats wrong with that behaviour. :-) Especially when the verbal description is relatively unclear like in this case (at least to me). sorry Andreas to see what is going wrong, please 1. click list 2. insert a number in the left lineedit 3. press return now the right lineedit should have the focus. i looked quite often on these lines, i think for today i'm kind of blind, so thanks for any hint beste gruesse jochen #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class Form(QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) self.mainLayout = QVBoxLayout() self.browser = QTextBrowser() self.mainLayout.addWidget(self.browser) self.btnLayout = QHBoxLayout() self.btnInteractive = QPushButton(interactive) self.btnList = QPushButton(list) self.btnLayout.addWidget(self.btnInteractive) self.btnLayout.addWidget(self.btnList) self.mainLayout.addLayout(self.btnLayout) self.lbInfo = QLabel(Info) self.lbInfo.setAlignment(Qt.AlignCenter) self.mainLayout.addWidget(self.lbInfo) self.editLayout = QHBoxLayout() #not OK: self.lineedit = QLineEdit(ü) #not OK: self.lineedit = QLineEdit(unicode(ü)) #OK: self.lineedit = QLineEdit(unicode(ue)) self.leFrom = QLineEdit() self.leUntil = QLineEdit() self.editLayout.addWidget(self.leFrom) self.editLayout.addWidget(self.leUntil) self.mainLayout.addLayout(self.editLayout) self.setLayout(self.mainLayout) self.connect(self.btnInteractive, SIGNAL(clicked()), self.btnInteractive_Clicked) self.connect(self.btnList, SIGNAL(clicked()), self.btnList_Clicked) self.connect(self.leFrom, SIGNAL(returnPressed()), self.leFrom_ReturnPressed) self.connect(self.leUntil, SIGNAL(returnPressed()), self.leUntil_ReturnPressed) self.setWindowTitle(EasyCalculator) def btnInteractive_Clicked(self): self.browser.append(btnInteractive_Clicked) self.interactiveModus = True #self.browser.append(interactive) self.lbInfo.setText(Welches Jahr moechten Sie ueberpruefen?) self.leFrom.setText(Jahr) self.leUntil.setDisabled(True) self.leFrom.selectAll() self.leFrom.setFocus() def btnList_Clicked(self): #self.browser.append(btnList_Clicked) self.interactiveModus = False #self.browser.append(list) self.lbInfo.setText(Geben sie einen Zeitraum an!) self.leFrom.setText(von) self.leUntil.setText(bis) self.leFrom.selectAll() self.leFrom.setFocus() def leFrom_ReturnPressed(self): if self.interactiveModus: #self.browser.append(leFrom_ReturnPressed, interactive) text = unicode(self.leFrom.text()) self.browser.append(self.isLeapYear(text)) else: self.leUntil.setDisabled(False) self.leUntil.selectAll() self.leUntil.setFocus() if self.btnInteractive.hasFocus(): self.browser.append(btnInteractive.hasFocus) else: self.browser.append(btnInteractive.has NO Focus) def leUntil_ReturnPressed(self): #self.browser.append(leUntil_ReturnPressed) txt1 = unicode(self.leFrom.text()) start = eval(txt1) txt2 = unicode(self.leUntil.text()) end = eval(txt2) for i in range(start, end+1): self.browser.append(self.isLeapYear(i)) def isLeapYear(self, inyear): try: #here eval works like Integer.parseInt(string) year = eval(inyear) if ((year % 4 == 0 and year % 100 != 0) or year % 400 == 0): return %i ist ein Schaltjahr % year else: return %i ist kein Schaltjahr % year except: return font color=redisLeapYear: input is invalid!/font app = QApplication(sys.argv) form = Form() form.show() app.exec_() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] hidden signals?
On Montag, 24. Dezember 2007, Andreas Pakulat wrote: On 24.12.07 13:22:22, Jochen Georges wrote: On Monday 24 December 2007 12:25:14 Andreas Pakulat wrote: On 24.12.07 09:16:17, Jochen Georges wrote: Thats not a simple self-contained example that demonstrates the problem. Sorry, but you have to create an app that we can simply run to check what exactly happens and whats wrong with that behaviour. :-) : Especially when the verbal description is relatively unclear like in this case (at least to me). sorry You could have stripped down that code a bit more, but its easy to see the problem, now that I can run it. Andreas to see what is going wrong, please 1. click list 2. insert a number in the left lineedit 3. press return now the right lineedit should have the focus. The problem is that the Interactive button is the default button in the dialog, so it automatically gets activated on return-presses. Changing from QDialog to QWidget fixes that, I don't see a way to have a Qt4 QDialog without a default button, though. Using setDefault on the push buttons doesn't seem to do anything useful. Andreas If a dialog must be used, you can override the accept()-Method and handle the Return press there. E.g. if (focusWidget() == leftLineEdit) { rightLineEdit-setFocus(Qt::OtherFocusReason); return; } QDialog::accept() Regards, Detlev -- Detlev Offenbach [EMAIL PROTECTED] ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QListViewItem editable
Hi, I searching how turn editable all QListViewItem from a QListView. -- Reinaldo Carvalho ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Repr for value objects
On Monday 17 December 2007, Giovanni Bajo wrote: On Mon, 2007-12-17 at 14:48 +, Phil Thompson wrote: A list would help. The code would help more (just a patch against the source would be fine). See the attached patch. These are the ones I care most about. Others that could be done (if you want to put those on the todo list): QStringMatcher/QByteArrayMatcher QDate/QTime/QDateTime QFlags QLatin1String QRegExp QStringList QStringRef QUrl and last but not least: QEvent* Applied - with a few from the above list. I changed them to return the full module path rather than just the class name to be consistent with other packages (like wx). Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] qtable object
Hi all :) I would like to be able to select a qtable object in order to copy and paste it in a sheet for example. Qtable is Qtdesigner made. when I select all, only last cell is copied. (only string in cells) Could someone explain me mechanisms in order to allow selection of qtable then paste on an other soft ? Thanks and happy christmas. JB -- http://astrolix.org association des linuxiens astronomes ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Memory leak when using QAbstractTableModel
Hurray! Thanks to Justin Noel on the qt-interest list, the following code now works and doesn't leak! Noam === #!/usr/bin/env python import sys from PyQt4 import QtCore, QtGui from PyQt4.QtCore import Qt class TableModel(QtCore.QAbstractTableModel): def rowCount(self, index): return 1000 if not index.isValid() else 0 def columnCount(self, index): return 1000 if not index.isValid() else 0 def data(self, index, role): if index.isValid() and role == Qt.DisplayRole: return QtCore.QVariant(str((index.row(), index.column( else: return QtCore.QVariant() def headerData(self, col, orientation, role): if orientation == Qt.Horizontal and role == Qt.DisplayRole: return QtCore.QVariant(str(col)) if orientation == Qt.Vertical and role == Qt.DisplayRole: return QtCore.QVariant(str(col)) return QtCore.QVariant() def main(): app = QtGui.QApplication(sys.argv) model = TableModel() tableView = QtGui.QTableView() tableView.setModel(model) tableView.show() sys.exit(app.exec_()) if __name__ == '__main__': main() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Using a protected slot (columnResized)
Hello, I want to know when the width of columns in a table has changed. So I wrote something like this: class TableView(QtGui.QTableView): def columnResized(self, column, oldWidth, newWidth): print 'columnResized(%r,%r,%r)' % (column,oldWidth,newWidth) QtGui.QTableView.columnResized(self, column, oldWidth, newWidth) I then used my TableView instead of QtGui.QTableView. However, the method isn't called when a column is resized. Did I do something wrong? Should it be done in another way? Thanks, Noam ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt