Skip to content

Commit 6cd1025

Browse files
committed
First version.
1 parent d40d0e2 commit 6cd1025

28 files changed

Lines changed: 407 additions & 82 deletions

File tree

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ from setuptools import find_packages, setup
1515
from pyside_setup_macro import QtBuildPackage
1616

1717
setup(
18-
...,
19-
packages=find_packages(exclude=("test*", "tests*")),
2018
...,
2119
cmdclass={
2220
"build_py": QtBuildPackage, # This is all you need to add.
@@ -25,10 +23,10 @@ setup(
2523
```
2624

2725

28-
If your lazy like me and don't want to maintain a qresource file then I have introduced qmacro.
26+
If your lazy like me and don't want to maintain a qresource file then I have introduced `qmacro`.
2927

30-
The qmacro has 2 parts.
31-
A mandatory name of the qresource file to ge created.
28+
The `qmacro` has 2 parts.
29+
A mandatory name of the qresource file to be created.
3230
```python
3331
name="resource" # Name of resource file to be created.
3432
```
@@ -93,4 +91,11 @@ walk()
9391
<file alias="sweden.png">flags/sweden.png</file>
9492
</qresource>
9593
</RCC>
96-
```
94+
```
95+
96+
97+
## Examples
98+
Example apps that use `PySideSetupMacro`.
99+
* [email app](examples/email_app/)
100+
* [scandinavian flag picker](examples/scandinavian_flag_picker/)
101+
* [ui file app](examples/ui_file_app/)

examples/email_app/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Email app
2+
![icon](email_app.png)
3+
4+
Small app showing the usage of automatically compiling existing qresource file.
5+
6+
## install
7+
```shell
8+
python setup.py install # install PysideSetupMacro
9+
10+
cd examples/email_app
11+
python setup.py install
12+
```

examples/email_app/email_app.png

4.03 KB
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Flag Picker
2+
3+
![icon](flag_picker.png)
4+
5+
Small app showing the usage of dynamically generated resource file and compiling it with qmacro
6+
7+
## install
8+
9+
```shell
10+
python setup.py install # install PysideSetupMacro
11+
12+
cd examples/scandinavian_flag_picker
13+
python setup.py install
14+
```
3.38 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (C) 2023 Max Wiklund
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the “License”);
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an “AS IS” BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__version__ = "1.0.0"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright (C) 2023 Max Wiklund
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the “License”);
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an “AS IS” BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import sys
16+
from PySide6 import QtCore, QtGui, QtWidgets
17+
18+
import scandinavian_flag_picker.icons.qresource
19+
20+
21+
class FlagPicker(QtWidgets.QWidget):
22+
def __init__(self, parent: QtWidgets.QWidget = None):
23+
super().__init__(parent=parent)
24+
pen_label = QtWidgets.QLabel()
25+
pen_label.setPixmap(QtGui.QPixmap(":pen.png").scaled(QtCore.QSize(20, 20)))
26+
self.flags_combobox = QtWidgets.QComboBox()
27+
for flag_file in QtCore.QDir(":flags").entryList():
28+
self.flags_combobox.addItem(
29+
QtGui.QIcon(f":flags/{flag_file}"),
30+
flag_file.replace(".png", "").capitalize(),
31+
)
32+
33+
self.flags_combobox.setCurrentText("Sweden")
34+
35+
layout = QtWidgets.QHBoxLayout()
36+
layout.addWidget(pen_label)
37+
layout.addWidget(self.flags_combobox)
38+
self.setLayout(layout)
39+
40+
41+
if __name__ == "__main__":
42+
app = QtWidgets.QApplication(sys.argv)
43+
win = FlagPicker()
44+
win.show()
45+
sys.exit(app.exec())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (C) 2023 Max Wiklund
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the “License”);
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an “AS IS” BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

examples/skandinavia_flag_picker/skandinavia_flag_picker/icons/flags/denmark.png renamed to examples/scandinavian_flag_picker/scandinavian_flag_picker/icons/flags/denmark.png

File renamed without changes.

examples/skandinavia_flag_picker/skandinavia_flag_picker/icons/flags/norway.png renamed to examples/scandinavian_flag_picker/scandinavian_flag_picker/icons/flags/norway.png

File renamed without changes.

0 commit comments

Comments
 (0)