Re: [PyQt] Synchronized scrolling between two tables

2011-11-02 Thread Nader Abedrabbo

Thanks Wolfgang and Scott. 

Wolfgang,  Initially I had wanted to use one table.  But I couldn't figure
out how to disable certain columns.  My data goes in the first three
columns, then the calculation results are populated in the next 5 columns. 
I don't want the user to be able to edit/select the calculated 5 columns.   
That is why I implemented two adjacent tables. 

If their is a way to disable certain columns in a table from being selected,
I would appreciate if you can guide me to it. 

Thanks again! 




Bugzilla from wolfg...@rohdewald.de wrote:
 
 Am Dienstag, 1. November 2011, 14:02:48 schrieb Nader Abedrabbo:
 What I would like though is a synchronized scrolling of the two tables,
 i.e.
 if I scroll the first table, then the second table should scroll to the
 same view (same row level) as the first table.
 
 Is that possible? 
 
 yes. Have a look at classes ScoreViewLeft, ScoreViewRight and ScoreTable
 in kajongg
 http://websvn.kde.org/trunk/KDE/kdegames/kajongg/src/scoring.py?view=markup
 
 but I do not see the need for two tables in your case, I would try to use
 one
 single QTableView. Initialize the calculated fields to empty and after
 having 
 calculated them, refresh the view.
 
 you do not even need a calculate button. If your calculation really needs
 some
 time,  you can put the calculation into a separate thread and
 automatically
 update the view when a field has been calculcated.
 
 -- 
 Wolfgang
 
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://old.nabble.com/Synchronized-scrolling-between-two-tables-tp32761709p32765646.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] Synchronized scrolling between two tables

2011-11-02 Thread Wolfgang Rohdewald
Am Mittwoch, 2. November 2011, 06:23:36 schrieb Nader Abedrabbo:
 If their is a way to disable certain columns in a table from being selected,
 I would appreciate if you can guide me to it.

you can define you own model, deriving from a Qt standard model, 
and override flags(). In the link I gave you there is a file rulesetselector.py
which defines a tree view where some items can be edited in
different ways (combobox, text, numbers, checkboxes). Your table
view should be easier to implement.

def flags(self, index): # pylint: disable=R0201
tell the view what it can do with this item
if not index.isValid():
return Qt.ItemIsEnabled
column = index.column()
item = index.internalPointer()
content = item.rawContent
checkable = False
if isinstance(content, Ruleset) and column in (0, 3):
mayEdit = True
elif isinstance(content, Rule):
mayEdit = column in [0, 1, 2, 3]
checkable = column == 1 and content.parType is bool
else:
mayEdit = False
mayEdit = mayEdit and not isinstance(item.ruleset(), PredefinedRuleset)
result = Qt.ItemIsEnabled | Qt.ItemIsSelectable
if mayEdit:
result |= Qt.ItemIsEditable
if checkable:
result |= Qt.ItemIsUserCheckable
return result


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] setUniformValueArray missing

2011-11-02 Thread David Kaufman
Greetings,

I'm currently developing an OpenGL PyQt app. I'm in the need of this
function 
http://doc.qt.nokia.com/latest/qglshaderprogram.html#setUniformValueArray-20
(setUniformValueArray) but I can't seem to find it anywhere in the
most recent PyQt documentation. Is there any chance that this function
will be added in the near future?

Bye Bye,
David Kaufman
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Synchronized scrolling between two tables

2011-11-02 Thread Nader Abedrabbo

Thanks Guys, 

I found the solution to my problem. 

By linking to the tables scroll bar via (QScrollBar) I now have access to
the bar.  Then using the signals emitted by the slider via (QAbstractSlider)
I can get the current location of the bar and then sync the other table with
it. 

Here is a short example (right table syncs with left, I just need to add
another signal for left table to synch with right).

#
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
import time
 

class MyWindow(QWidget):
def __init__(self, *args):
QWidget.__init__(self, *args)
   
self.tableWidget1 = QTableWidget()
self.tableWidget2 = QTableWidget()
numRows = 40
numCols = 2
self.tableWidget1.setRowCount(numRows)
self.tableWidget1.setColumnCount(numCols)
self.tableWidget2.setRowCount(numRows)
self.tableWidget2.setColumnCount(numCols)
   
layout = QHBoxLayout(self)
layout.addWidget(self.tableWidget1)
layout.addWidget(self.tableWidget2)

self.setLayout(layout)

self.sliderBar1 = self.tableWidget1.verticalScrollBar()
self.sliderBar2 = self.tableWidget2.verticalScrollBar()

QObject.connect(self.sliderBar1, 
   SIGNAL(actionTriggered(int)),
self.SyncScroll)
   
def SyncScroll(self):
sliderValue = self.sliderBar1.value()
self.sliderBar2.setValue(sliderValue)



def main():
app = QApplication(sys.argv)
w = MyWindow()
w.show()
sys.exit(app.exec_())

if __name__ == __main__:
main() 
#




Nader Abedrabbo wrote:
 
 Greetings, 
 
 I have a program where two tables are shows next to each other.   One
 program is used to get user data, while the second table is used to show
 the results of the data after certain calculations are performed on the
 original data (via a calculate button).  The list of data in the tables
 can be in the hundreds. I added buttons to scroll to the bottom and top of
 the table.  
 
 What I would like though is a synchronized scrolling of the two tables,
 i.e. if I scroll the first table, then the second table should scroll to
 the same view (same row level) as the first table. 
 
 Is that possible? 
 
 Thanks, 
 Nader
 
 

-- 
View this message in context: 
http://old.nabble.com/Synchronized-scrolling-between-two-tables-tp32761709p3279.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] setUniformValueArray missing

2011-11-02 Thread Phil Thompson
On Wed, 2 Nov 2011 16:39:53 +0100, David Kaufman david.kauf...@gmx.de
wrote:
 Greetings,
 
 I'm currently developing an OpenGL PyQt app. I'm in the need of this
 function

http://doc.qt.nokia.com/latest/qglshaderprogram.html#setUniformValueArray-20
 (setUniformValueArray) but I can't seem to find it anywhere in the
 most recent PyQt documentation. Is there any chance that this function
 will be added in the near future?

Can setAttributeArray() be used instead? Or is a UniformValue something
different to an Attribute?

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] PyQt and DBus in Python 3

2011-11-02 Thread Jonathan Riddell
Ubuntu is looking at moving to Python 3.  Currently PyQt depends on
python-dbus for its DBus support, but we believe that there are no
plans to port python-dbus to Python 3 (because the gtk 3 bindings now
have their own DBus support).

Are there any plans for adding PyQt bindings to the QtDBus module?  Or
another expected way to get DBus support in PyQt with Python 3?

Thanks

Jonathan Riddell
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt and DBus in Python 3

2011-11-02 Thread Phil Thompson
On Wed, 2 Nov 2011 21:30:51 +, Jonathan Riddell jridd...@ubuntu.com
wrote:
 Ubuntu is looking at moving to Python 3.  Currently PyQt depends on
 python-dbus for its DBus support, but we believe that there are no
 plans to port python-dbus to Python 3 (because the gtk 3 bindings now
 have their own DBus support).

I wasn't aware of that.

 Are there any plans for adding PyQt bindings to the QtDBus module?  Or
 another expected way to get DBus support in PyQt with Python 3?

Something will be done - not sure what yet. What are your timescales?

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt and DBus in Python 3

2011-11-02 Thread Jonathan Riddell
On Wed, Nov 02, 2011 at 09:45:57PM +, Phil Thompson wrote:
  Are there any plans for adding PyQt bindings to the QtDBus module?  Or
  another expected way to get DBus support in PyQt with Python 3?
 
 Something will be done - not sure what yet. What are your timescales?

Thanks for your quick response :)

Nothing immediate, our hope of switching to Python 3 for our April
2012 release won't happen because of a number of issues.  However we'd
like to start porting Ubuntu's various GUI applications to Python 3 and an
incomplete PyQt for Python 3 will prevent us from starting on that.

Jonathan
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt