Re: [PyQt] Synchronized scrolling between two tables

2011-11-01 Thread Scott Price
According to the documentation:

QTableView.scrollTo (*self*,
QModelIndex
 *index*, 
QAbstractItemView.ScrollHint
 *hint* = QAbstractItemView.EnsureVisible)

I assume you would have to create a QModelIndex based on the first tables'
scrolled to record, and then feed it into the second table via a key press
(or release) grab?  If this is set up to fire for each scrolled record on
the first table, it might get resource-intensive to 'synchronize' the
scrolling, though.





On Tue, Nov 1, 2011 at 2:02 PM, 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-tp32761709p32761709.html
> Sent from the PyQt mailing list archive at Nabble.com.
>
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Synchronized scrolling between two tables

2011-11-01 Thread Wolfgang Rohdewald
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


[PyQt] Synchronized scrolling between two tables

2011-11-01 Thread Nader Abedrabbo

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-tp32761709p32761709.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] PyQt4.Gui.QFileDialog

2011-11-01 Thread Andreas Pakulat
On 01.11.11 12:27:45, Janwillem van Dijk wrote:
> I am sorry to say that this does not help either. On linux the
> dialog shows until the sleep finishes on windows it exits as soon as
> the button is clicked as expected.
> For the time being I changed to traits. Bit heavy weight perhaps but
> give the opportunity to have a few other parameters conveniently
> adjusted too.

Your original example works fine here on Debian Linux, Python 2.6, PyQt
4.8.3 and Qt 4.7.3 and using the KDE file-dialog.

Does this also happen when you create a Qt file dialog, i.e. not use the
static function but instead create a dialog instance and call exec_ on
it:

# Ensure the pure-qt version is used
fdialog.setOptions(QFileDialog.Options(QFileDialog.DontUseNativeDialog))
fdialog.exec_()
#filenames = fdialog.getOpenFileNames(directory=default_dir)
filenames = fdialog.selectedFiles()

If this does not exhibit the problem, then the problem is most certainly
in the platform-plugin used in your case. Since you said you're using
Ubuntu thats most likely the GTK plugin for Qt.

If the behaviour still exists with that change the problem is likely in
PyQt or Qt itself, but already fixed in a later version of one of the
two.

BTW: You don't need the fdialog variable at all, you can simply do
QFileDialog.getOpenFileNames(...) when you want the native dialog.

Andreas

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


[PyQt] Localizing QDateEdit popup calendar

2011-11-01 Thread Joe Moudrik
Hello,

I have a slight problem with QDateEdit. I want to use the popup calendar
dateEdit.setCalendarPopup(True)
to set the date. The popup hovewer ignores my locale (Czech) settings
(set in both the QDateEdit and top widget as well) and shows
everything in Englsh.

Is it possible to set the locale of the popup to respect that of my QDateEdit?

(I know I can workarkound about htis by creating my own Calendar
widget with proper localization, but I wonder if it is possible to do
more nicely)


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


Re: [PyQt] PyQt4.Gui.QFileDialog

2011-11-01 Thread Hans-Peter Jansen
On Monday 31 October 2011, 08:07:00 Janwillem wrote:
> I want a small script with just a few filedialogs not a full blown
> gui application . However when I try the code below the dialog does
> not disappear after clicking the Open button on the dialog  but stays
> on top until the script exits. What am I doing wrong??
> Thanks, Janwillem
>
> def open_files(default_dir=None):
> """Returns list of filenames optionally given a default dir"""
> from sys import argv
> from os import environ
> from PyQt4.QtGui import QApplication, QFileDialog,QWidget
> if default_dir == None:
> default_dir = environ['HOME']
> app = QApplication(argv)
> fdialog = QFileDialog
> filenames = fdialog.getOpenFileNames(directory=default_dir)
> app.exit()
> return list(filenames)
>
> if __name__ == '__main__':
> from PyQt4.QtCore import QT_VERSION_STR
> from platform import python_version
> print('Python %s' % (python_version()))
> print('PyQt4 %s' %QT_VERSION_STR)
> print('open dialog')
> lst = open_files()
> print('dialog finished')
> for fname in lst:
> print(fname)
> import time
> time.sleep(2)
> print 'finished'

Without taking a deeper look, you might want to try instancing/exiting 
QApplication just once per process.

Also time.sleep is a (non pyqtonic) blocking function. Use a 
QTimer.singleShot for this purpose, which would allow you to let the 
event loop run in the meantime.

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


Re: [PyQt] PyQt4.Gui.QFileDialog

2011-11-01 Thread Janwillem van Dijk
I am sorry to say that this does not help either. On linux the dialog 
shows until the sleep finishes on windows it exits as soon as the button 
is clicked as expected.
For the time being I changed to traits. Bit heavy weight perhaps but 
give the opportunity to have a few other parameters conveniently 
adjusted too.

Thanks again, Janwillem


On 10/31/2011 10:19 AM, Vincent Vande Vyvre wrote:

Le 31/10/11 10:07, Vincent Vande Vyvre a écrit :

Le 31/10/11 09:32, Matteo Boscolo a écrit :

Try this after instantiate the application:
app.setQuitOnLastWindowClosed(False)

and this after closing the dialog:
app.closeAllWindows()

I use this in some case in my com application .. hope it helps

Regards,
Matteo



Il 31/10/2011 09:08, Janwillem ha scritto:
Thanks, yes I see, that is under windows (XP on VirtualBox, python 
2.7.1 and
pyqt4 4.7.2 in my case) but under linux (ubuntu 11.10, python 
2.7.2+ and
pyqt 4.7.3) it only closes after the sleep has finished (or in case 
of my

practical application, until the data processing finished)
So any tips from a ubuntu user???
cheers, Janwillem


Matteo Boscolo wrote:

with this configuration
Python 2.6.6
PyQt4 4.7.3
open dialog
dialog finished
C:\Users\mboscolo\Documents\.bzr.log
finished

it works perfectly .. after press the opendialog the form is 
closed and

start to print the rest of the debug

regards,
Matteo

Il 31/10/2011 08:07, Janwillem ha scritto:
I want a small script with just a few filedialogs not a full 
blown gui

application . However when I try the code below the dialog does not
disappear after clicking the Open button on the dialog  but stays 
on top

until the script exits. What am I doing wrong??
Thanks, Janwillem

def open_files(default_dir=None):
  """Returns list of filenames optionally given a default dir"""
  from sys import argv
  from os import environ
  from PyQt4.QtGui import QApplication, QFileDialog,QWidget
  if default_dir == None:
  default_dir = environ['HOME']
  app = QApplication(argv)
  fdialog = QFileDialog
  filenames = fdialog.getOpenFileNames(directory=default_dir)
  app.exit()
  return list(filenames)

if __name__ == '__main__':
  from PyQt4.QtCore import QT_VERSION_STR
  from platform import python_version
  print('Python %s' % (python_version()))
  print('PyQt4 %s' %QT_VERSION_STR)
  print('open dialog')
  lst = open_files()
  print('dialog finished')
  for fname in lst:
  print(fname)
  import time
  time.sleep(2)
  print 'finished'


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




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


No problem for me on Ubuntu 10.04

vincent@tiemoko:~/Bureau$ python test.py
Python 2.6.5
PyQt4 4.6.2
open dialog
dialog finished
/home/vincent/Documents/gabarit_cd.svg
finished
vincent@tiemoko:~/Bureau$

--
Vincent V.V.
Oqapy  . Qarte+7 
 . PaQager 



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

Works as expected too on 11.10

vincent@bacoudian:~/Bureau$ python test.py
Python 2.7.2+
PyQt4 4.7.3
open dialog
dialog finished
/home/vincent/examples.desktop
finished
vincent@bacoudian:~/Bureau$

--
Vincent V.V.
Oqapy  . Qarte+7 
 . PaQager 



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


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

[PyQt] pyqt vs pyside for desktop & Android development

2011-11-01 Thread Gour
Hello!

We're starting with Python & Qt and plan to write multi-platform desktop app
using Python+Qt technology.

Moreover, we'd like to write 'lite' app for Android and wonder whether there is
any support in PyQt for doing Python+Qt for this mobile OS?

We've found this link http://thp.io/2011/pyside-android/ which is based on
Pyside...

Let me add that we would like to start with Python-3.

Which bindings could you recommend to learn (we bought PyQt book) to develop
for *both* desktop and mobile OS?

License is, we believe, not the issue since we plan to use 3-rd party C-lib
which is GPL2+ licensed.


Sincerely,
Gour

p.s. It looks that there is misleading info on Gmane page about this list
stating 'posting allowed', although it is not if one is not subscribed to the
list.


-- 
As a strong wind sweeps away a boat on the water, 
even one of the roaming senses on which the mind 
focuses can carry away a man's intelligence.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt