[PyQt] Stop main window from showing when closing dialog

2011-03-24 Thread Mikael Modin
Hi,

I'm working on a background application that sometimes show a dialog in a
lower corner, most of the time it's meant to just sit queitly in the taskbar
or system tray. My problem is this; When the dialog in the corner is closed
the main window get the focus again and becomes the top window, stealing it
from whichever window had it before.

The corner window doesn't take the focus when shown which is correct. Now I
just need to stop the main window from receiving the focus when the corner
dialog is closed, or failing that loose it directly after getting it.

I tried setting parent to None when calling QDialog.__init__ for my corner
dialog but then it didn't show up at all. If anyone has any idea how to fix
this I'd greatly appreciate it.

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

[PyQt] Different png formats?

2011-01-10 Thread Mikael Modin
Hi,

I'm trying to get my application working fully after freezing it with
cx_Freeze, but I'm having weird troubles with images. Some png's load
fine, others stop working after freezing.

I'm attaching two examples. Ar there different ways of encoding pngs?
Is the support these different ways in different Qt modules?

Kind regards,
Mikael
attachment: not working.pngattachment: working.png___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Different png formats?

2011-01-10 Thread Mikael Modin
Hi,

Thanks alot for the tip, now excuse me while I go strangle my
coworker, he told me he's sending me .png files.

Which module should I include to support decoding of jpg files?

/Mikael

On 10 January 2011 20:30, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:
 Le 10/01/11 09:16, Mikael Modin a écrit :

 Hi,

 I'm trying to get my application working fully after freezing it with
 cx_Freeze, but I'm having weird troubles with images. Some png's load
 fine, others stop working after freezing.

 I'm attaching two examples. Ar there different ways of encoding pngs?
 Is the support these different ways in different Qt modules?

 Kind regards,
 Mikael

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

 Hi,

 not working.png is not .png but .jpg

 Change the extension ...


 --
 Vincent V.V.
 Oqapy
 ___
 PyQt mailing list    p...@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt

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


Re: [PyQt] Images not showing in WebView after cx_Freeze

2011-01-03 Thread Mikael Modin
Hi,


As I understood it png support is built-in and doesn't need a module
for that. Might have changed since that mail thread was written
though.

I will look into pyInstaller as well then.

/Mikael

On 3 January 2011 21:03, Hans-Peter Jansen h...@urpla.net wrote:
 On Monday 03 January 2011, 04:10:08 Mikael Modin wrote:
 Hi,

 I'm currently developing a small tool for taking and sending
 screnshots, time-reporting for freelancers, and am using cx_Freeze to
 avoid having the users install python, pyqt and all other
 dependencies.

 The problem I'm having is that after running the code through
 cx_Freeze images on a web page doesn't seem to work.
 1) All I get is the grey box with a question mark inside of it.
 2) The same setup works when I run the python code by itself without
 cx_Freeze. 3) Loading a local html-page that just contains an img-tag
 works fine, so the actual image loading and showing seem to work
 fine. Loading Google and that works, so images over network work
 fine. The server send the images in png format.

 These three combined leave me very confused. Has anybody else had any
 similar trouble?

 Most probably, your app suffers from missing Qt image format plugins,
 or, equally likely, cx_freeze failed to include them in a way, that Qt
 is able to use them properly.

 You might try PyInstaller, that is prepared for such (Qt/PyQt) needs.

 Good luck,
 Pete
 ___
 PyQt mailing list    p...@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt

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


[PyQt] Images not showing in WebView after cx_Freeze

2011-01-02 Thread Mikael Modin
Hi,

I'm currently developing a small tool for taking and sending
screnshots, time-reporting for freelancers, and am using cx_Freeze to
avoid having the users install python, pyqt and all other
dependencies.

The problem I'm having is that after running the code through
cx_Freeze images on a web page doesn't seem to work.
1) All I get is the grey box with a question mark inside of it.
2) The same setup works when I run the python code by itself without cx_Freeze.
3) Loading a local html-page that just contains an img-tag works fine,
so the actual image loading and showing seem to work fine. Loading
Google and that works, so images over network work fine. The server
send the images in png format.

These three combined leave me very confused. Has anybody else had any
similar trouble?

Kind regards,
Mikael
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Reduce memory footprint

2010-12-19 Thread Mikael Modin
Hi,

I've written a small tool with a quite simple GUI using pyqt. After
startup is completed the gui takes up 35mb memory, is there any way to
reduce this footprint? Seems unneccesarily large.

Kind regards,
Mikael
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Load font form file

2010-12-15 Thread Mikael Modin
Hi,

I've added it to the QFontDatabase and then I could create it, I just
had to download a font editor to find out the family name of the font.
Thanks :)

/Mikael

On 15 December 2010 21:34, Hans-Peter Jansen h...@urpla.net wrote:
 On Wednesday 15 December 2010, 04:29:26 Mikael Modin wrote:
 Hi,

 I've downloaded a new font that I want to use in my application, how
 do I get a QFont object to use with QLabel.setFont()?

 Hmm, mostly answered in the second last thread regarding fonts in this
 ML:

 http://www.riverbankcomputing.com/pipermail/pyqt/2010-October/028029.html

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

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


[PyQt] Load font form file

2010-12-14 Thread Mikael Modin
Hi,

I've downloaded a new font that I want to use in my application, how
do I get a QFont object to use with QLabel.setFont()?

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


[PyQt] Hunting down memory leaks

2010-12-13 Thread Mikael Modin
Hi,

I'm currently developing a little tool and it seems I have a memory
leak somewhere along the line that handles images, so each leak is
around 7mb which is kind of a big deal leading my app quickly to
100mb. I'm wondering if any of you havea any tips to figure out what
kind of object I'm leaking and where I'm leaking them. I'm new to
python, Qt and PyQt so I'm not very well versed in what tools are
available.

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


Re: [PyQt] Application not hiding from taskbar

2010-12-06 Thread Mikael Modin
I figured out how to solve my little conundrum. My solution is so ugly
I'm ashamed but I can't figure out why self.hide() doesn't hide my
window in the first place. Here's the final code:

def hideEvent(self, event):
self.hide()
if ph.is_windows():
self.hidden = True
self.setWindowFlags(Qt.ToolTip)
def showEvent(self, event):
if ph.is_windows() and self.hidden:
self.setWindowFlags(Qt.Window)
self.hidden = False
self.show()

Kind regards,
Mikael

On 4 December 2010 00:40, Mikael Modin micke.mo...@gmail.com wrote:
 Hi,

 I'm trying to implement minimize-to-tray but my application refuses to
 hide from taskbar. I've distilled the problematic code down to this
 little snippet, attached .ui-file.

 import sys, os
 from PyQt4 import uic
 from PyQt4.QtGui import QMainWindow, QApplication

 class MyClass(QMainWindow):
    def __init__(self, parent = None):
        QMainWindow.__init__(self, parent)
        self.ui = uic.loadUi(os.path.join(gui,
 timeTrackerClientGUI.ui), self)
    def hideEvent(self, event):
        self.hide()

 if __name__ == '__main__':
    app = QApplication(sys.argv)
    wnd = MyClass()
    wnd.show()
    app.exec_()

 According to 
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#hideEvent
 I get a hideEvent when the user minimizes the window and that part
 works, but self.hide() doesn't hide my window from the taskbar. It's
 working fine in Linux, but in Windows 7 it refuses to hide. It looks
 like one icon hides but then another one pops up beside it, if I click
 quick enough you get this flickering effect I managed to catch in a
 screenshot, http://dl.dropbox.com/u/3184097/problem2.png
 I'm stumped, thought this would be simple to do.

 Kind regards
 Mikael Modin

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


[PyQt] Application not hiding from taskbar

2010-12-03 Thread Mikael Modin
Hi,

I'm trying to implement minimize-to-tray but my application refuses to
hide from taskbar. I've distilled the problematic code down to this
little snippet, attached .ui-file.

import sys, os
from PyQt4 import uic
from PyQt4.QtGui import QMainWindow, QApplication

class MyClass(QMainWindow):
def __init__(self, parent = None):
QMainWindow.__init__(self, parent)
self.ui = uic.loadUi(os.path.join(gui,
timeTrackerClientGUI.ui), self)
def hideEvent(self, event):
self.hide()

if __name__ == '__main__':
app = QApplication(sys.argv)
wnd = MyClass()
wnd.show()
app.exec_()

According to 
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#hideEvent
I get a hideEvent when the user minimizes the window and that part
works, but self.hide() doesn't hide my window from the taskbar. It's
working fine in Linux, but in Windows 7 it refuses to hide. It looks
like one icon hides but then another one pops up beside it, if I click
quick enough you get this flickering effect I managed to catch in a
screenshot, http://dl.dropbox.com/u/3184097/problem2.png
I'm stumped, thought this would be simple to do.

Kind regards
Mikael Modin


timeTrackerClientGUI.ui
Description: Binary data
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Translation troubles

2010-11-08 Thread Mikael Modin
Hi,

I'm trying to translate a UI created using QDesigner, but I could
never get it working so I wrote a quick minimal non-working sample in
the hope that one of you could tell me what I'm doing wrong.

  main.py
--
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class Wnd(QDialog):
def __init__(self):
QDialog.__init__(self)
self.setWindowTitle(self.tr(Title))

def main():
app = QApplication(sys.argv)
translator = QTranslator()
translator.load(main.ts)
app.installTranslator(translator)
wnd = Wnd()
wnd.show()
app.exec_()

if __name__ == '__main__':
main()

--- main.ts
---
The translation file I created using pyuldate4 main.py -ts main.ts
and then edited in QLinguist.

?xml version=1.0 encoding=utf-8?
!DOCTYPE TS
TS version=2.0 language=sv_SE sourcelanguage=en_GB
context
nameWnd/name
message
location filename=main.py line=8/
sourceTitle/source
translatorcommentBlabla/translatorcomment
translationMuffins/translation
/message
/context
/TS

Kind regards,
Mikael Modin
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Getting information about crash/lockup

2010-11-02 Thread Mikael Modin
Hi,

I'm developing a networked multithreaded application using PyQt4 v
4.7.4. I'm wondering if there are any tools available to see what
messages/signals are passed internally by Qt or if you can suggest any
other good debugging tips/tools.

My problem is this:
The problem is related to three parts, the main window, system tray
icon and a dialog. If I click a button that start things with main
window in normal mode or maximized mode and the dialog pops up
everything works fine. But If I click the same button, minimise the
window to tray and the dialog pops up the main Qt thread dissapear
from the Eclipse thread list in Debug perspective. And with it the
entire gui. Which at the moment only consists of the system tray icon
but I think the thread should keep running.

I'm not calling close on the window when minimizing to Tray, I'm just
hiding it with setVisible(false)
I'm using the pydev extension with Eclipse 3.5.2.
The other threads keep running without python exceptions.
I don't get any python exception from the main thread.
I tried running it through gdb with gdb --args python main.py to see
if I could catch an exception, signal something that way, nothing.
This makes me think that the thread somehow locks up completely and
therefore doesn't show up in Eclipse, but it doesn't crash.

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


Re: [PyQt] Getting information about crash/lockup

2010-11-02 Thread Mikael Modin
As per Eriks suggestion I have attached the complete sample. Some more
digging by myself and a colleague has shown a solution/workaround as
well, but I'm still confused. The behaviour seem to be different from
the specification.

If you run the attached file you have 2 seconds to minimize the window
and then an additional 5 seconds until the dialog closes. If you have
minimized the dialog before the dialog closes the app.exec_() returns
and the gui thread exits. If you don't minimize the window the dialog
will just show up and then close.

If you add the line self.setAttribute(Qt.WA_QuitOnClose, False)
after the line QDialog.__init__(self, parent) everything works like
it should.

If you look here: http://doc.qt.nokia.com/4.7/qwidget.html#close it
says that this is correct behaviour iff the window doesn't have a
parent, but my dialog has my main window as a parent so I don't know
why it ignores it and close the whole gui.

Mikael

On 2 November 2010 23:08, Erik Janssens erik.janss...@conceptive.be wrote:
 could you post the sample to the list ? it might be of
 interest.

 fortunately I don't run on windows...but I have a windows
 built for testing purposes

 On Tue, 2010-11-02 at 21:39 +1100, Mikael Modin wrote:
 Hi Erik,

 Thanks for the tips.

 I have a minimal sample with the exact same bug. Got it down to 26
 lines of code and one icon. I've built and run make install on the
 latest SIP and PyQt. If you are running Windows I could send you the
 sample and see if it's platform-specific.

 The key seem to be to be close the only visible dialog in a function
 that is called by a timer from a function that is called by a timer.
 If I move the close() up one step everything works like it should.
 Timer - Function - Timer - Function - close()

 I've tried both PyQt and PySide and the error occurs the same way in
 both frameworks so I assume this is based in Qt and not PyQt. I've
 tried running this through gdb, got the debug symbols but so far I
 haven't been able to make sense of it.

 /Mikael

 On 2 November 2010 17:50, Erik Janssens erik.janss...@conceptive.be wrote:
  Hello Mikael,
 
  first of all, you should use the latest version of PyQT / QT,
  because previous versions have some issues.
 
  that being said, I have had some reports of customers where our
  application crashes indeed  only when running minimized, but I
  have not been unable to reproduce it.
 
  so it would be interesting if you can generate a minimal example
  that crashes, try to use as few QT classes as possible.
 
  when you have a minimal example, you can try to run it with pyqt
  and pyside, this can give you a hint wether it's qt or pyqt related.
 
  the next step is to build both pyqt and qt with debugging information
  on your system, this makes it easier to debug using gdb.
 
  I'd be interested in the results...
 
  regards,
 
  Erik
 
  On Tue, 2010-11-02 at 17:33 +1100, Mikael Modin wrote:
  Hi,
 
  I'm developing a networked multithreaded application using PyQt4 v
  4.7.4. I'm wondering if there are any tools available to see what
  messages/signals are passed internally by Qt or if you can suggest any
  other good debugging tips/tools.
 
  My problem is this:
  The problem is related to three parts, the main window, system tray
  icon and a dialog. If I click a button that start things with main
  window in normal mode or maximized mode and the dialog pops up
  everything works fine. But If I click the same button, minimise the
  window to tray and the dialog pops up the main Qt thread dissapear
  from the Eclipse thread list in Debug perspective. And with it the
  entire gui. Which at the moment only consists of the system tray icon
  but I think the thread should keep running.
 
  I'm not calling close on the window when minimizing to Tray, I'm just
  hiding it with setVisible(false)
  I'm using the pydev extension with Eclipse 3.5.2.
  The other threads keep running without python exceptions.
  I don't get any python exception from the main thread.
  I tried running it through gdb with gdb --args python main.py to see
  if I could catch an exception, signal something that way, nothing.
  This makes me think that the thread somehow locks up completely and
  therefore doesn't show up in Eclipse, but it doesn't crash.
 
  /Mikael Modin
  ___
  PyQt mailing list    p...@riverbankcomputing.com
  http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 
 


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



test_crash_stripped.rar
Description: application/rar
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt