Skip to content

Commit 7c66208

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # resources/__init__.py # resources/runtime/maskfunctions.py # resources/runtime/savestate.py # resources/runtime/textfiles/fileedit.py # resources/runtime/textlists/package.py # resources/runtime/textlists/program.py # resources/uis/settings.ui
2 parents c8cd8a2 + 7ec8207 commit 7c66208

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

resources/test.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QVBoxLayout, QWidget
2+
3+
import sys
4+
5+
from qtpy import uic
6+
7+
from resources.runtime import savestate
8+
9+
10+
class AnotherWindow(QWidget):
11+
"""
12+
This "window" is a QWidget. If it has no parent, it
13+
will appear as a free-floating window as we want.
14+
"""
15+
16+
def __init__(self):
17+
super().__init__()
18+
self.ui = uic.loadUi('uis' + savestate.symbol + 'settings.ui')
19+
self.ui.setWindowTitle("Spoon")
20+
21+
22+
class MainWindow(QMainWindow):
23+
24+
def __init__(self):
25+
super().__init__()
26+
self.w = None # No external window yet.
27+
self.button = QPushButton("Push for Window")
28+
self.button.clicked.connect(self.show_new_window)
29+
self.setCentralWidget(self.button)
30+
31+
def show_new_window(self, checked):
32+
if self.w is None:
33+
self.w = AnotherWindow()
34+
self.w.ui.show()
35+
36+
else:
37+
self.w.close() # Close window.
38+
self.w = None # Discard reference.
39+
40+
41+
app = QApplication(sys.argv)
42+
w = MainWindow()
43+
w.show()
44+
app.exec_()

resources/uis/main.ui

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<string>LoL Overlay</string>
5858
</property>
5959
<property name="currentIndex">
60-
<number>0</number>
60+
<number>1</number>
6161
</property>
6262
<property name="documentMode">
6363
<bool>false</bool>
@@ -1661,5 +1661,21 @@
16611661
</hint>
16621662
</hints>
16631663
</connection>
1664+
<connection>
1665+
<sender>actionMain_Settings</sender>
1666+
<signal>triggered()</signal>
1667+
<receiver>MainWindow</receiver>
1668+
<slot>hide()</slot>
1669+
<hints>
1670+
<hint type="sourcelabel">
1671+
<x>-1</x>
1672+
<y>-1</y>
1673+
</hint>
1674+
<hint type="destinationlabel">
1675+
<x>399</x>
1676+
<y>299</y>
1677+
</hint>
1678+
</hints>
1679+
</connection>
16641680
</connections>
16651681
</ui>

0 commit comments

Comments
 (0)