Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: PySide objects considered a _ContextInt. #16

Closed
masasin opened this issue Jul 8, 2020 · 4 comments
Closed

Regression: PySide objects considered a _ContextInt. #16

masasin opened this issue Jul 8, 2020 · 4 comments

Comments

@masasin
Copy link

masasin commented Jul 8, 2020

Worked in 0.3.3, broken in 0.3.4.

MWE:

from guietta import Gui
from PySide2.QtWidgets import QProgressBar

gui = [(QProgressBar(), "progress")]

gui.progress.SetFormat("%p% of files")
gui.progress.setValue(0.4)

Tracebacks:

Traceback (most recent call last):
  File "gui.py", line 65, in <module>
    MyApp("My Fancy App").run()
  File "gui.py", line 30, in __init__
    self.set_progress(0, 0)
  File "gui.py", line 38, in set_progress
    self.progress.setFormat(f"{i} / {n} (%p%)")
AttributeError: '_ContextInt' object has no attribute 'setFormat'
Traceback (most recent call last):
  File "gui.py", line 65, in <module>
    MyApp("My Fancy App").run()
  File "gui.py", line 30, in __init__
    self.set_progress(0, 0)
  File "gui.py", line 39, in set_progress
    self.progress.setValue(100 * i / n if n != 0 else 0)
AttributeError: '_ContextInt' object has no attribute 'setValue'
@alfiopuglisi
Copy link
Owner

Hello @masasin , in 0.3.4 there is a new widget P that wraps QProgressBar. As a result, "gui.progress" is now a magic property used to get/set the progressbar value. Try this:

gui.widgets['progress'].setFormat('%p% of files')
gui.progress = 20

Also have a look at the progress_bar.py example in the guietta/examples directory.

@fahimmiddya
Copy link

Hello @masasin , in 0.3.4 there is a new widget P that wraps QProgressBar. As a result, "gui.progress" is now a magic property used to get/set the progressbar value. Try this:

gui.widgets['progress'].setFormat('%p% of files')
gui.progress = 20

Also have a look at the progress_bar.py example in the guietta/examples directory.

How can I change the title of the window of the GUI created by the module?

@alfiopuglisi
Copy link
Owner

The github version has a "title" keyword argument for the Gui constructor. It will go into 0.3.5. If you want to use the installed 0.3.4, you can try this:

gui.window().setWindowTitle('mytitle')

@fahimmiddya
Copy link

fahimmiddya commented Jul 9, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants