Re: [PySide] Problem with garbage collection

2023-02-09 Thread David Ching
>from: "henry.w...@yahoo.com  " 
>mailto:henry.w...@yahoo.com> >

> 

>Thanks for looking that up.  It knew learning C++ would make me a better 
>Python programmer :)

> Seems too hard though...

 

Sure, I learned Qt with C++ and only recently switched to Python for the dev 
productivity.  Glad my background is useful.  

 

>My method probably does seem strange, but I will try to explain it.

> I have to store a bunch of lists containing both commands and robot positions.

> I made different objects to store the items information because it keeps 
> things organized.

> […]

> Then I thought that I would be clever... since I am making objects anyway, 
> why not derive

> those objects from a QListWidgetItem?  Then when I need to display the 
> objects I can just

> add them to a list widget and the displaying is done in only a couple lines 
> of code.  Also, the

> program can change the icons or text color with just a couple lines.  But I 
> only use one list

> widget to display the all of the lists - one at a time, of course.  The list 
> widget is reused/recycled.

> 

>That is why I am putting things into a list widget, moving them around, 
>storing them,

> clearing the list widget and doing it again.

> Probably not what the folks at Qt thought I was going to do.

 

Have you considered using a QListView instead of a QListWidget?  I believe that 
allows you to save your robot objects, etc. in a plain data object, and then 
display them in the same list display as QListWidget.  I do believe QListWidget 
is much easier, though and wonder if the model/view architecture is worth the 
increased complexity for your case.  But in any case, I think that is how the 
folks at Qt provided for what you are trying to do.

 

Thanks,

David

___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] Problem with garbage collection

2023-02-09 Thread David Ching
>from: "henry.w...@yahoo.com" 

Henry> it seems like the clear method of the listwidget was the problem.?
Here is what I tried.
[...]
 The objects are ~just~ created from XML.  When I display those items using
the ListWidget .addItem() method they display correctly.? But only the first
time!? If I clear the list and display the same objects in the same list a
second time then I get the error. So it seems that the addItem method "takes
control" of the object in the Python list and the clear() method destroys
the internal object - even though I can print the objects in the Python list
so they seem to still exist. They are like zombies without a C++ soul :) 
[...]
Lastly, I eliminated the trouble-causing clear() method completely and now
"remove" the list items manually like this:
for N in range( ListWidget.count(), -1, -1): 
Whatever = ListWidget.takeItem(N) 
I don't feel very professional doing it this way, but it seems to be
working.

The C++ code for QListWidget::clear() is as follows.  

 1: // NOTE:  QListWidget::clear() calls QListModel::clear()
 2: void QListModel::clear()
 3: {
 4: beginResetModel();
 5: for (int i = 0; i < items.count(); ++i) {
 6: if (items.at(i)) {
 7: items.at(i)->d->theid = -1;
 8: items.at(i)->view = nullptr;
 9: delete items.at(i); 
10: }
11: }
12: items.clear();
13: endResetModel();
14: }


So yes, on line 9, the QListWidgetItem C++ object is deleted (so it's
"soul") is indeed destroyed!  This is printed in red at
https://doc.qt.io/qt-6/qlistwidget.html#items:  "Warning: All items will be
permanently deleted."

Why do you need to access the QListWidgetItem after you clear it from the
list?  Perhaps you should create new QListWidgetItem's and call
QListWidget.addItem() for those new instances instead.  

Or just use QListWidget.takeItem() as you have done.  Nothing wrong with
that.  

I have also found QListWidgetItem.setHidden() to be great as it lets me keep
the item in the list but the user has no knowledge.

Good luck,
David 




___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] LGPL licensing obligations

2023-01-13 Thread David Ching
For now, I just posted a written offer.  The app is not expected to have 
widespread interest, I would be surprised if anyone bothered to ask.  If they 
do, I will get the needed info at the time.  I would be interested in 
commercially licensing Qt under the startup plan (it is $500/year), but it is 
vague whether this is an option any more, and when it was, they claimed to 
audit tax documents to check the revenue is less than a certain amount, and I 
don’t have a separate entity set up for that.

Meanwhile, I could not find the source to the pyside6 wheel... does anyone know 
if this is available?  If so, I could redistribute that.  Or maybe I can just 
zip up what is installed with “pip install PySide6” and call it a day.

The Qt for Python licenses for what it uses are at 
https://doc.qt.io/qtforpython/licenses.html but I don’t use any of the affected 
functionality, so I don’t think I have to include them.  I haven't found the 
webpage listing the C++ Qt licenses of what it uses yet.

Does anyone know of any existing PySide6 LGPL projects where these deployment 
issues have been resolved?  The process of LGPL licensing of Qt for Python 
might itself by open sourced!  

Thanks,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


[PySide] LGPL licensing obligations

2023-01-10 Thread David Ching
Hello, 

I am preparing to deploy an application which has a dependency on Qt for
Python, which I am licensing under the LGPL license.  I have not found any
specific documentation on how to do this.  In the Qt Licensing FAQ at
https://www.qt.io/faq/tag/qt-open-source-licensing?hsLang=en, it says:

"You will need to deliver the complete source code of Qt libraries you used,
including all modifications you did or applied, to your users/customers.
Alternatively, you need to provide a written offer with instructions on how
to get the source code. Please also note that this has to be under your
control, so a link to the source code provided by the Qt Project or Qt
Company is not sufficient."

How would I distribute the source code to "Qt for Python"?  Is that even
available?  I just install the pyside6 wheel, I've never dealt with any
source code for the Python Qt wrappers.  

In addition to whatever source code I need for "Qt for Python", do I also
need to deliver the Qt C++ code available at
https://www.qt.io/offline-installers?  I am using Nuitka to bundle and
distribute the app, and modules like QT6GUI.DLL are included in the bundle.
Do I need to distribute the C++ source to QtGui?

Thank you for any enlightenment!

-- David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] pyside6-qtpy2cpp

2022-10-28 Thread David Ching
> Date: Thu, 27 Oct 2022 07:05:30 -0700
> From: "David Ching" 
> Subject: [PySide] pyside6-qtpy2cpp
> Is there any update on when pyside6-qtpy2cpp will be available?  

Thanks for including it in 6.4.0.1!  

Thanks,
David






___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


[PySide] pyside6-qtpy2cpp (was RE: New Qt for Python release: 6.4.0 is out!)

2022-10-27 Thread David Ching
Is there any update on when pyside6-qtpy2cpp will be available?  I don't see
any tracking item at
https://bugreports.qt.io/issues/?jql=project%20%3D%20PYSIDE%20AND%20componen
t%20in%20(EMPTY%2C%20%22Build%20System%22%2C%20Documentation%2C%20Other%2C%2
0PySide%2C%20Shiboken%2C%20Tooling)%20AND%20text%20~%20%22pyside6-qtpy2cpp%2
2

Alternatively, can you point me to the source code so I might try to build
it?  I am most interested in porting my PySide app to C++ for potential
further development and distribution.

Thanks,
David


-Original Message-
From: Adrian Herrmann  
Sent: Monday, October 17, 2022 10:26 AM
To: David Ching ; pyside@qt-project.org
Subject: AW: [PySide] New Qt for Python release: 6.4.0 is out!

Hi David, thank you for bringing this to our attention, I can confirm your
report. We will look into it asap.
Best,


Adrian Herrmann
Software Engineer, Qt for Python

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
adrian.herrm...@qt.io
+49 1578 0598682
www.qt.io

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen Sitz der
Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB
144331 B


-Ursprüngliche Nachricht-
Von: PySide  Im Auftrag von David Ching
Gesendet: Montag, 17. Oktober 2022 18:00
An: pyside@qt-project.org
Betreff: Re: [PySide] New Qt for Python release: 6.4.0 is out!

[...]

Thanks Cristian, I tried in both a clean virtual environment as well as a
cleaned up system environment.  
pyside6-qtpy2cpp.exe is still missing after PIP install on Windows.
I'm excited to try this; hope I can get it soon!

Thanks,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] New Qt for Python release: 6.4.0 is out!

2022-10-17 Thread David Ching
> Date: Mon, 17 Oct 2022 09:20:28 +0200
> From: Cristi?n Maureira-Fredes  
> Hello,
>
> Can you try to install PySide6 on a fresh virtual environment and verify
this?
>
> If you are unfamiliar with that:
> https://doc.qt.io/qtforpython/quickstart.html
>
> It might be that you are installing everything on your system Python, and
then there might be some issues with upgrades.

Thanks Cristian, I tried in both a clean virtual environment as well as a
cleaned up system environment.  
pyside6-qtpy2cpp.exe is still missing after PIP install on Windows.
I'm excited to try this; hope I can get it soon!

Thanks,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] New Qt for Python release: 6.4.0 is out!

2022-10-16 Thread David Ching



From: Cristi?n Maureira-Fredes  
Subject: [PySide] New Qt for Python release: 6.4.0 is out!

> New tools: pyside6-qml (for qml preview), pyside6-qtpy2cpp (to translate
python to c++ code), pyside6-deploy (to simplify the deployment story, based
on nuitka)

pyside6-qtpy2cpp seems to be missing after PIP install on Windows.  The
other utilities including pyside6-deploy are present:

C:\Users\David\AppData\Roaming\Python\Python39\Scripts>dir /b pyside6* |
grep deploy
pyside6-deploy.exe

C:\Users\David\AppData\Roaming\Python\Python39\Scripts>dir /b pyside6* |
grep cpp

C:\Users\David\AppData\Roaming\Python\Python39\Scripts>




___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] setting colour via stylesheet causes indented combobox items

2022-09-18 Thread David Ching
David Ching> I tried with PySide2 and PySide6 on Windows 10.  

 

Today I repeated the test with PySide2 and PySide6 on MacOS 12.5.1.

Both failed in the same way Frank reported (indented tick appeared).

 

Thanks,

David 

 

___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] setting colour via stylesheet causes indented combobox items

2022-09-17 Thread David Ching
I tried with PySide2 and PySide6 on Windows 10.  

PySide2 shows small text not adjusted for high-dpi monitor.  It did not seem
to alter the default display at all.

PySide6 was entirely correct. 

See below

 

On Windows 10, Pyside 5.15.2.1:  

Selection doesn't become red.

No indented tick.

 



 

 

 

On Windows 10, Pyside 6.3.2 (change "import PySide2" to "import PySide6")

Selection correctly is red.

No indented tick (also correct).

 



 

 

Thanks,
David

 

 

 

> Date: Fri, 16 Sep 2022 09:54:40 +1200

> From: Frank Rueter <  fr...@ohufx.com>

> Subject: [PySide] setting colour via stylesheet causes indented

>combobox items with tick mark

> Hi all,

> 

> when I set this in a style sheet:

> QWidget:item:selected{background-color: red;

> 

> my combobox items are indented and have a tick mark in front of them.

> How come? And how can I suppress this?

> [image: image.png][image: image.png]

> Here is a code snippet (the colour in the code is now red so ignore that

> bit):

>  
https://gist.github.com/frueter/c36916f8e0901b332a88cbd71ff91c5d

> 

> Cheers,

> frank

> -- next part --

> An HTML attachment was scrubbed...

> URL: <

http://lists.qt-project.org/pipermail/pyside/attachments/20220916/b1aec4ad/a
ttachment-0001.htm>

> -- next part --

> A non-text attachment was scrubbed...

> Name: image.png

> Type: image/png

> Size: 6516 bytes

> Desc: not available

> > URL: <

http://lists.qt-project.org/pipermail/pyside/attachments/20220916/b1aec4ad/a
ttachment-0002.png>

> -- next part --

> A non-text attachment was scrubbed...

> Name: image.png

> Type: image/png

> Size: 7402 bytes

> Desc: not available

> URL: <

http://lists.qt-project.org/pipermail/pyside/attachments/20220916/b1aec4ad/a
ttachment-0003.png>

___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] editing selected cells in QTabelWidget

2022-08-31 Thread David Ching
> From: Frank Rueter mailto:fr...@ohufx.com 
> Thanks, I solved that part by not using the persistent editor at all as that 
> seemed to interrupt things.
> Instead I just use the mousePressEvent on the table to make single clicks 
> edit the cells. Then I have 
> the delegate's setModelData method deal with bulk editing selected rows.
> This seems to work really well and is quite transparent in the code so I am 
> happy for now.
> 
> Thanks for holding my hand!

Great! I am glad to help, I wish continued traffic on the mailing list as I 
think the PySide community is really great, but you don’t get a sense of that. 
It seems most of the users are very niche so there is not some industry swell 
around any one thing about it.

Cheers,
David




___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] editing selected cells in QTabelWidget

2022-08-30 Thread David Ching
Even if you got the right click to actually set focus to the combo box on
one item, I am not sure the user would find that intuitive.  Right-clicking
usually brings up a context menu.  On deeper thought, it seems to be a
conflict of using the persistent editor with a selection of multiple items.
It's not standard.  I would instead propose:

Insert a first column of checkmark controls.  Selecting an item checks this
checkbox.  In the end, multiple selections will have checkmarks.  Then you
can single click a combo box as normal, change the selection, and have it
apply to all the items with checkmarks.  Would that work for you?

Thanks,
David


> From: PySide  On Behalf Of Frank Rueter
> Sent: Friday, August 26, 2022 3:05 AM
> Subject: Re: [PySide] editing selected cells in QTabelWidget

> So I made some progress but am now having the problem that a right click
>  on a persistent editor (combo box) will lose the current table selection.

> [...]



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] PySide2 on OSX 12.5.1 not working?

2022-08-29 Thread David Ching
> Date: Sat, 27 Aug 2022 10:30:41 +1200
> From: Frank Rueter 
> Subject: [PySide] PySide2 on OSX 12.5.1 not working?
>
> Hi all,
>
> I just set up PySide2 on my laptop but when I run a simple test like the
below all I get is an empty window which freezes/beachballs straight away.
...
> from PySide2 import QtWidgets

Are you sure you want PySide2 and not PySide6?  I did a test on OSX 12.5.1
with Python 3.10 and it works with PySide6.

Thanks,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] editing selected cells in QTabelWidget

2022-08-25 Thread David Ching
> Date: Thu, 25 Aug 2022 20:36:01 +1200
> From: Frank Rueter 
> Subject: [PySide] editing selected cells in QTabelWidget
> Hi all,
>
> I have a simple table which will never hold much data, so I opted for
QTabelWidget rather than QTabelView.
> Two columns have combo boxes set as cell widgets; all other cells house
straight up strings.
>
> I have set the selection behaviour to QAbstractItemView.SelectRows and am
now trying to figure out how to enable
>  editing of selected cells, so that the user can select multiple rows,
then double click a cell in that selection and edit it,
>  which will cause all other cells in the same column within the selection
to receive the new value.
>
> I have hit a couple of issues:
>
>  1. By default the selection is reset when I double click in a cell, so I
   assume I will have to override QTableWidget.mousePressEvent() to prevent
   that somehow. Any suggestions on how to best manage that best? I am not
   sure what I need to re-implement to just prevent the selection being
reset.

In general, double clicking on a multiple selection doesn't work since as
you note, the first click (of the double click) selects the single item that
was clicked and de-selects the other items.  To edit multiple selected items
(my app runs on Windows) I select them and then start editing by pressing F2
(which Excel uses similarly) or a toolbar button, or right-clicking one of
the selected items which opens a context menu with an Edit item.


>   2. the cell widgets do not modify the actual cell item's value. Do I
>need to manually connect the widgets to a slot that will do that or is
>there a better way to do that?

I had a similar task:

MyTableWidget::MyTableWidget(QWidget *parent) : QTableWidget(parent)
{
m_delegate = new MyTableItemDelegate();  // MyTableItemDelegate is
derived from QStyledItemDelegate
setItemDelegate(m_delegate);
}

MyTableItemDelegate overrides createEditor(), setEditorData(),
setModelData(), updateEditorGeometry().

Apologies, this code is in C++.  It has been years since I developed this
code, so don't know more details off the top of my head.

Hope this helps,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


[PySide] : Re: Qt Designer is no longer shipped with the latest PySide6

2022-05-19 Thread David Ching
Date: Thu, 19 May 2022 16:50:03 +0800 (CST)
From: "Zhao Lee" 
Subject: Re: [PySide] Qt Designer is no longer shipped with the latest
PySide6

Zhao Lee> I tested with Python 3.9 on win11, there is no pyside6-designer

I tested with Python 3.10 on Windows 10.  There is a pyside6-designer:

C:\>pip list | grep Pyside -i
PySide6-Essentials6.3.0
WARNING: You are using pip version 22.0.3; however, version 22.1 is
available.
You should consider upgrading via the
'C:\Users\Test\AppData\Local\Programs\Python\Python310\python.exe -m pip
install --upgrade pip' command.

C:\Users\Test\AppData\Local\Programs\Python\Python310\Scripts>dir
*designer.exe
 Volume in drive C has no label.
 Volume Serial Number is 4E8F-2933

 Directory of C:\Users\Test\AppData\Local\Programs\Python\Python310\Scripts

04/25/2022  04:38 PM   106,900 pyside6-designer.exe
   1 File(s)106,900 bytes
   0 Dir(s)  45,298,212,864 bytes free






___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] QtDesigner ???

2022-04-27 Thread David Ching
>From what I can tell, the root problem is not 6.3 related.  It is also there
in 6.2.  The difference is the code generated by 6.3 activated a different
tab, and this tab contains a layout causing the issue.  When I changed the
6.2 generated code to activate the same tab, it also had the issue.

Thanks,
David

-Original Message-
From: Paolo De Stefani  
Sent: Wednesday, April 27, 2022 10:39 AM

So this can be considered a pyside6 rel. 6.3 bug ?



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] QtDesigner ???

2022-04-27 Thread David Ching
Hi Paolo,

I again tried your original code, and this time got an error:

c:\Src\paolo_orig>python pyDBManager.py
Traceback (most recent call last):
  File "c:\Src\paolo_orig\pyDBManager.py", line 166, in 
window = MainWindow()
  File "c:\Src\paolo_orig\pyDBManager.py", line 61, in __init__
self.ui.setupUi(self)
  File "c:\Src\paolo_orig\Ui\DBManagerMainWindowBad.py", line 246, in
setupUi
self.tab_widget.setCurrentIndex(3)
AttributeError: 'PySide6.QtWidgets.QSpacerItem' object has no attribute
'hasHeightForWidth'


I had rebuilt your code by editing your batch file to fix directories on my
system and ran it.  This runs uic and rcc.  I diffed the results with yours.
Earlier I had missed differences in the generated
"UI\DBManagerMainWindowBad.py" in line 246:

Yours:  self.tab_widget.setCurrentIndex(3)
Mine:   self.tab_widget.setCurrentIndex(0)

I don't know why the generated file was different; perhaps because I am
using 6.2 tool and you are using 6.3.  But, when I changed mine to be like
yours, I got the same error.  

Having reproduced your issue, I tried moving the snake_case enabling before
and after the import of the generated code, and it made no difference, i.e.
there was an error with both:

from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow
from __feature__ import snake_case, true_property

and

from __feature__ import snake_case, true_property
from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow


Since that failed, I disabled snake_case --- I verify with you that it fixes
it!

I commented out
  #from __feature__ import snake_case, true_property

And to avoid Atttribute errors at runtime, changed the necessary calls to
methods of the "self.ui.xxx" widgets to use camelCase e.g.
#self.ui.status_bar.add_permanent_widget(self.status_log)
self.ui.status_bar.addPermanentWidget(self.status_log)

Then it worked --- there does seem to be an error in generated code if snake
case is enabled.  

Thanks,
David

-Original Message-
From: Paolo De Stefani  
Sent: Tuesday, April 26, 2022 11:04 AM
To: David Ching 
Cc: pyside@qt-project.org
Subject: Re: [PySide] QtDesigner ???

I also noted that the error message is different if a modify the generated
pyDBManagerMainWIndowBad.py the original error is:

C:\PyWare\pyDBManager\Bug>python pyDBManager.py Traceback (most recent call
last):
   File "C:\PyWare\pyDBManager\Bug\pyDBManager.py", line 161, in 
 window = MainWindow()
   File "C:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in __init__
 self.ui.setupUi(self)
   File "C:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 133, in
setupUi
 self.gridLayout.setContentsMargins(0, 0, 0, 0)
AttributeError: 'PySide6.QtWidgets.QGridLayout' object has no attribute
'setContentsMargins'. Did you mean: 'getContentsMargins'?

If i add even an import line like import os and run again the script the
error message is:

C:\PyWare\pyDBManager\Bug>python pyDBManager.py Traceback (most recent call
last):
   File "C:\PyWare\pyDBManager\Bug\pyDBManager.py", line 161, in 
 window = MainWindow()
   File "C:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in __init__
 self.ui.setupUi(self)
   File "C:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 30, in
setupUi
 if not DBManagerMainWindow.objectName():
AttributeError: 'MainWindow' object has no attribute 'objectName'. Did you
mean: 'object_name'?

Why this behaviour ???
But looks like direct linked to the snake_case option





___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] QtDesigner ???

2022-04-25 Thread David Ching
> Date: Mon, 25 Apr 2022 20:26:45 +0200
> From: Paolo De Stefani 
> Subject: Re: [PySide] QtDesigner ???
> Message-ID: <6bb50e91a39bb8ec77e88f85d9d4e...@paolodestefani.it>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> I removed completly my python 3.10 installation (in C:\Python310\),
restarted the system, deleted completly the C:\Python310 directory,
downloaded a fresh python-3.10.4-amd64.exe from python.org, installed as
administrator (my user is administrator
> anyway), added from pip the pyside6-essentials wheel:
>
> C:\Python310>pip list
> PackageVersion
> -- ---
> pip22.0.4
> setuptools 58.1.0
>
> C:\Python310>pip install pyside6-essentials Collecting pyside6-essentials
>Downloading PySide6_Essentials-6.3.0-cp36-abi3-win_amd64.whl (70.7 MB)
>    70.7/70.7 MB 3.0 MB/s eta
> 0:00:00
> Collecting shiboken6==6.3.0
>Downloading shiboken6-6.3.0-cp36-abi3-win_amd64.whl (1.6 MB)
>    1.6/1.6 MB 3.2 MB/s eta
> 0:00:00
> Installing collected packages: shiboken6, pyside6-essentials Successfully
installed pyside6-essentials-6.3.0 shiboken6-6.3.0
>
> BUT running my script from VSCode i get exactly the same error:

Paolo, I don't know, I went onto a different machine with Python 3.10
installed and did a "pip install pyside6-essentials", got the same thing you
did.  But unlike you, "python.exe pyDBManager.py" with these lines worked
fine:

[pyDBManager.py] 
#from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow

from __feature__ import snake_case, true_property 


Are you sure VS Code is running it from the correct environment?  If you can
comment out enough of the non-working version for it to stay running, you
could run SysInternals Process Explorer and set it's lower pane to view the
DLL's running in the "python.exe" process -- then you can make sure the Qt
DLL's are correct.

Thanks,
David 



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] QtDesigner ???

2022-04-25 Thread David Ching
> From: Paolo De Stefani  
> Sent: Monday, April 25, 2022 11:27 AM
> Subject: Re: QtDesigner ???
>
...
> C:\Python310>pip install pyside6-essentials Collecting pyside6-essentials

Paolo, FWIW, I did a "pip install pyside6" and not the "pyside6-essentials".
Maybe that makes a difference.  Like I said, your code works fine here,
including with the "snake case" enabled.

Thanks,
David





___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] QtDesigner ???

2022-04-25 Thread David Ching
From: Paolo De Stefani  
Sent: Sunday, April 24, 2022 8:25 AM

...
> AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no attribute
'isEmpty'
...
> AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no attribute
'setContentsMargins'. Did you mean: 'getContentsMargins'?
...
> AttributeError: 'PySide6.QtWidgets.QSpacerItem' object has no attribute
'hasHeightForWidth'. Did you mean: 'heightForWidth'?
...
> AttributeError: 'PySide6.QtWidgets.QGridLayout' object has no attribute
'setContentsMargins'. Did you mean: 'getContentsMargins'?
> 
> So it looks like i can't use a H/V/Grid layout and spacer too ...
> What's wrong ???

Paolo, I would re-install Pyside.  Or even your entire Python distribution.
Something seems wrong with your installation because your "bad" file works
perfectly fine on my system.  In particular, all these missing attributes in
the layout and spacer classes seem to indicate a mismatch of some binaries
in your installation.  

It does seem the .ui files were processed by the correct uic utility, given
the comments in the generated .py files from that.  But the runtime Qt DLL's
just aren't supporting the required attributes somehow.

Hope this helps,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] QtDesigner ???

2022-04-24 Thread David Ching
Hi Paolo,

I could not reproduce.   Either:

[pyDBManager.py]
#from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow

Or:
[pyDBManager.py]
from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
#from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow

Ran without error.  The first added the Label and LineEdit as expected.

I ran your batch file after modifying it to work on my system (removed
hard-coded paths, etc.)  So I re-ran pyside6-uic and pyside6-rcc and ensured
the generated files were the same as yours.  They were, except for the
tooling version in the comments.  Mine is slightly older: 

My system:
* Windows 10
* Python 3.9.6 (from https://python.org)
* PySide6 6.2.3

In short, the (essentially) exact .py code works flawlessly here.

Let me know if I can help more,
David

> Date: Sun, 24 Apr 2022 09:58:55 +0200
> From: Paolo De Stefani 
> To: Cristi?n Maureira-Fredes 
> Cc: pyside@qt-project.org
> Subject: Re: [PySide] QtDesigner ???
> Message-ID: <4d55f5618bf932a303e1207d1ea3a...@paolodestefani.it>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Hi
>
> I shrinked more all of my ui file so now everything is in 5 ui/py files
>
> To create py files from ui i use this command in a windows batch file:
>
> cd c:\PyWare\pyDBManager\Bug
> REM create lib ui modules
> "c:\windows\system32\forfiles.exe" /P "C:\PyWare\pyDBManager\Bug" /M *.ui
/c "cmd /c c:\Python310\Scripts\pyside6-uic -o @fname.py @file"
> pause
>
> If i import from DBManagerMainWindowBad (line 33/34) running
pyDBManager.py i get:
>
> Traceback (most recent call last):
>File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 161, in 
>  window = MainWindow()
>File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in __init__
>  self.ui.setupUi(self)
>File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 171,
in setupUi
>  self.tab_widget_new_database.addTab(self.tab, "")
> AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no attribute
'isEmpty'
>
> If i import from DBManagerMainWindowGood everything is working
>
> So what's wrong in DBManagerMainWindowBad.ui ???



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


[PySide] Nuitka issue on macOS

2022-02-01 Thread David Ching
Hello, I am trying to use Nuitka to compile and distribute my Qt for Python
app.  https://doc.qt.io/qtforpython/deployment-nuitka.html cites a known
problem:  "Nuitka currently has a problem with the macOS bundle files on
current macOS versions. That has the effect that -standalone and -onefile
create a crashing application. Older versions which don't have the recent
macOS API changes from 2020 will work. We are currently trying to fix that
problem."  

I am using MacOS Monterey 12.1, Python 3.10 installed from python.org.  I am
not sure if the above means if I run Nuitka on an earlier MacOS version that
it will successfully build? 

I compiled the app using this command-line:

  python3 -m nuitka --follow-imports -standalone --enable-plugin=pyside6
mainscratch.py

Running the resulting app crashes my app referencing
QtQml.framework/Versions/A/QtQml:

Traceback (most recent call last):
  File "/Users/Ken/Desktop/QtScratch/mainscratch.dist/mainscratch.py", line
5, in 
ImportError:
dlopen(/Users/Ken/Desktop/QtScratch/mainscratch.dist/PySide6/QtCore.so,
0x0002): Library not loaded: @rpath/QtQml.framework/Versions/A/QtQml
  Referenced from:
/Users/Ken/Desktop/QtScratch/mainscratch.dist/libpyside6.abi3.6.2.dylib
  Reason: tried:
'/Users/Ken/Desktop/QtScratch/mainscratch.dist/Qt/lib/QtQml.framework/Versio
ns/A/QtQml' (no such file), '$ORIGIN/QtQml.framework/Versions/A/QtQml' (no
such file),
'/Users/Ken/Desktop/QtScratch/mainscratch.dist/PySide6/Qt/lib/QtQml.framewor
k/Versions/A/QtQml' (no such file),
'$ORIGIN/../QtQml.framework/Versions/A/QtQml' (no such file),
'/Users/Ken/Desktop/QtScratch/mainscratch.dist/PySide6/Qt/lib/QtQml.framewor
k/Versions/A/QtQml' (no such file),
'$ORIGIN/../QtQml.framework/Versions/A/QtQml' (no such file),
'$ORIGIN/QtQml.framework/Versions/A/QtQml' (no such file),
'$ORIGIN/QtQml.framework/Versions/A/QtQml' (no such file),
'/Library/Frameworks/QtQml.framework/Versions/A/QtQml' (no such file),
'/System/Library/Frameworks/QtQml.framework/Versions/A/QtQml' (no such file)

I do not use QML in my app, so could I workaround this?  How would I specify
not to include the QML module?  Or would there then be the same problem with
the remaining modules? 

Any fixes or workarounds would be helpful, as I think this problem has been
around for awhile and there is no sign of progress.  

Thanks,
David



___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside