def main(): QtWin.setCurrentProcessExplicitAppUserModelID('elchworks.elchitools.2.2') app = QApplication() app.setWindowIcon(QIcon('Icons/Logo.ico')) engine = HeaterControlEngine() gui = ElchMainWindow() app.exec_()
def main(): try: from PySide2.QtWinExtras import QtWin myappid = 'mycompany.myproduct.subproduct.version' QtWin.setCurrentProcessExplicitAppUserModelID(myappid) except ImportError: pass app = QtWidgets.QApplication(sys.argv) window = Window() sys.exit(app.exec_())
def __init__(self, parent=None): self.updateSize = True self.settingsWidget = QWidget() super().__init__(parent=parent) self.hwnd = self.winId().__int__() self.setObjectName("QFramelessWindow") window_style = win32gui.GetWindowLong(self.hwnd, GWL_STYLE) win32gui.SetWindowLong( self.hwnd, GWL_STYLE, window_style | WS_POPUP | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX) if QtWin.isCompositionEnabled(): # Aero Shadow QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1) else: QtWin.resetExtendedFrame(self)
def launch_gui(filename=None): # check the requirements and import failed_requirements = [] try: from PySide2.QtWidgets import QApplication from PySide2.QtGui import QIcon except ModuleNotFoundError: failed_requirements.append('PySide2') try: from asyncqt import QEventLoop except ModuleNotFoundError: failed_requirements.append('asyncqt') if failed_requirements: for package in failed_requirements: print(_module_err_msg.format(package=package)) sys.exit() # if on Windows, change the taskbar icon try: from PySide2.QtWinExtras import QtWin myappid = f'andersonics.llc.patchbay.{__version__}' QtWin.setCurrentProcessExplicitAppUserModelID(myappid) except ImportError: pass from patchbay.qt.patchbay_ui import Patchbay # launch the GUI app = QApplication(sys.argv) app.setOrganizationName('Andersonics') app.setOrganizationDomain('andersonics.llc') app.setApplicationName('patchbay') app.setWindowIcon(QIcon(str(root_path / 'resources' / 'pb.svg'))) try: # use proper scaling for matplotlib figures in the UI plt.matplotlib.rcParams['figure.dpi'] = app.desktop().physicalDpiX() except NameError: pass asyncio.set_event_loop(QEventLoop(app)) patchbay_ui = Patchbay(filename=filename) return app.exec_()
import asyncio from asyncio import AbstractEventLoop from asyncqt import QEventLoop from PySide2.QtGui import QIcon from PySide2.QtWidgets import QApplication from calculator.window import MainWindow try: # noinspection PyUnresolvedReferences from PySide2.QtWinExtras import QtWin QtWin.setCurrentProcessExplicitAppUserModelID("com.manchenkov.source_calc") except ImportError: pass def run_app(): app = QApplication() app.setWindowIcon(QIcon('icon.ico')) event_loop: AbstractEventLoop = QEventLoop() asyncio.set_event_loop(event_loop) form = MainWindow() form.show() event_loop.run_forever()
import sys from PySide2.QtWidgets import QApplication from src.Main_View import Main_View try: # Include in try/except block if you're also targeting Mac/Linux from PySide2.QtWinExtras import QtWin myappid = 'leonine.digitalsales.fileconverter.0.1' QtWin.setCurrentProcessExplicitAppUserModelID(myappid) except ImportError: pass class App(QApplication): """ The application """ def __init__(self, sys_argv): super(App, self).__init__(sys_argv) self.view = Main_View() if __name__ == '__main__': app = App(sys.argv) sys.exit(app.exec_())