def __init__(self): QWidget.__init__(self) QWindow.__init__(self) discord.Client.__init__(self) self.maw = None self.ico = QIcon() self.ico.addFile("./Assets/logo.jpg")
def _onOpenWps(self): if self._wpsApp: return hr, rpc = createWpsRpcInstance() if FAILED(hr): QMessageBox.critical( self, "Open Wps", "Failed to call createWpsRpcInstance") return args = ["-shield", "-multiply", "-x11embed", "{}".format(self._wpsWnd.winId()), "{}".format(self._wpsWnd.width()), "{}".format(self._wpsWnd.height()) ] rpc.setProcessArgs(args) hr, self._wpsApp = rpc.getWpsApplication() if not self._wpsApp: QMessageBox.critical( self, "Open Wps", "Failed to call getWpsApplication") return appEx = self._wpsApp.ApplicationEx if appEx: container = QWidget.createWindowContainer( QWindow.fromWinId(appEx.EmbedWid), self) self._wpsWnd.setContainer(container) # FIXME: the container isn't place correctly if not self.isMaximized(): self.resize(self.width() + 1, self.height()) self.btnOpenDoc.setEnabled(True)
def create_unity_link(self, unity_app: Path): mp = subprocess.Popen([ str(unity_app.absolute()), '--api-port', str(HyperController.api_port), '--ws-port', str(HyperController.ws_port) ]) print(f'Unity Window PID: {mp.pid}') print(f'Api Server on port: {HyperController.api_port}') hwnd = None attempts = 0 while hwnd is None: try: hwnd = HyperController.get_unity_hwnd() except requests.exceptions.ConnectionError: print(f'Server not yet started: ' f'retrying connection ({attempts})') attempts += 1 print(f'recieved unity hwnd: {hwnd}') window_container = self.createWindowContainer( QWindow.fromWinId(int(hwnd)), self) self.layout().removeWidget(self._start_text) self.layout().addWidget(window_container) HyperController.connect_to_socket()
def __init__(self): __metaclass__ = ABCMeta super().__init__() self._stylesheet_filepath = Path(__file__).parent / ".." / "blender_stylesheet.qss" self._settings_key_geometry = "Geometry" self._settings_key_maximized = "IsMaximized" self._settings_key_full_screen = "IsFullScreen" self._settings_key_window_group_name = "MainWindow" # QApplication if self._stylesheet_filepath.exists(): self.setStyleSheet(self._stylesheet_filepath.read_text()) QApplication.setWindowIcon(self._get_application_icon()) # Blender Window self._hwnd = self._get_application_hwnd() self._blender_window = QWindow.fromWinId(self._hwnd) self.blender_widget = QWidget.createWindowContainer(self._blender_window) self.blender_widget.setWindowTitle("Blender") # Variables self.should_close = False # Runtime self._set_window_geometry() self.just_focused = False self.focusObjectChanged.connect(self._on_focus_object_changed)
def event(self, event): if event.type() == QEvent.Resize: self.backingStore.resize(self.size()) self.render() elif event.type() == QEvent.UpdateRequest or event.type() == QEvent.Expose: self.backingStore.flush(QRegion(QRect(QPoint(0, 0), self.size()))) return QWindow.event(self, event)
def __init__(self, parent=None): QWindow.__init__(self, parent) self.setSurfaceType(QSurface.OpenGLSurface) self.gl_format = QSurfaceFormat() self.gl_format.setRenderableType(QSurfaceFormat.OpenGL) self.gl_format.setProfile(QSurfaceFormat.CoreProfile) self.gl_format.setVersion(4, 1) self.setFormat(self.gl_format) if self.supportsOpenGL(): print("OpenGL supported !") self.mouse_x = 0 self.mouse_y = 0 self.mouse_init = False self.animating = False self.requestRender.connect(self.requestUpdate) # self.setMouseGrabEnabled(True) self.mouse_pressed = False
def shoot_screen(self, windo=0): screen = QGuiApplication.primaryScreen() window = QWindow() window = self.windowHandle() if window: screen = window.screen() if not screen: return if type(windo) in (list, tuple): self.original_pixmap = screen.grabWindow( QApplication.desktop().winId(), *windo) else: self.original_pixmap = screen.grabWindow( QApplication.desktop().winId(), windo) self.update_screenshot_label() # self.new_screenshot_button.setDisabled(False) # if self.hide_this_window_check_box.isChecked(): self.show()
def on_start_connect_click(self): subprocess.Popen( "C:/Program Files (x86)/GEOVIA/Surpac/69/nt_i386/bin/surpac2.exe") # subprocess.Popen("C:/Program Files/Microsoft Office/Office15/WINWORD.EXE") time.sleep(50) self.calc_hwnd = win32gui.FindWindow( None, "GEOVIA Surpac 6.9 - D:/Workspace/py_20190617 (Profile:)") # self.calc_hwnd = win32gui.FindWindow("NetUIHWND", None) print(self.calc_hwnd) self.calc_win = QWindow.fromWinId(self.calc_hwnd) # self.calc_win.setFlags(self.calc_win.flags() | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowMaximized) print(self.calc_win)
def __init__(self, manager: "X11GameManager", wid: int, **kwargs): super().__init__(**kwargs) self.manager = manager self.wid = wid self.pid = manager.get_property(wid, "_NET_WM_PID") self.qwindow = QWindow.fromWinId(wid) self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__) self.embedded_windows = [] self._setup_x() self._setup_overlay() self.input_signal.connect(self.on_input) self.config_signal.connect(self.on_config) self._update_is_focused()
def __init__(self): QWindow.__init__(self) self.show()
def embed_window(self, window: QWindow): window.setParent(self.qwindow)
def convertWndToWidget(hwnd): native_wnd = QWindow.fromWinId(hwnd) return QWidget.createWindowContainer(native_wnd)
child7k = QTreeWidgetItem(child7) child7k.setText(0, '以面积求多边形') child7l = QTreeWidgetItem(child7) child7l.setText(0, '将2根线在交点断开') child7l.setData(0,) tree.addTopLevelItem(root) # root.connect(root,SIN) mainFrame.gridLayout.addWidget(tree, 0, 0, 1, 1) # 显示surpac的tab # 设置surpac窗口为主窗口的子窗口 # 方法1 # win32gui.SetParent(hwnds[0], mainWindow.winId()) # 方法2 native_wnd = QWindow.fromWinId(hwnds[0]) surpacWidget = QWidget.createWindowContainer(native_wnd) # 方法2.1 # mainWindow.setCentralWidget(centralWidget) # 方法2.2 mainFrame.gridLayout.addWidget(surpacWidget, 0, 1, 1, 10) time.sleep(1) # 隐含窗口标题栏win32con.GW_CHILD & ISTYLE = win32gui.GetWindowLong(hwnds[0], win32con.GWL_STYLE) win32gui.SetWindowLong(hwnds[0], win32con.GWL_STYLE, ISTYLE & ~win32con.WS_CAPTION & win32con.SWP_NOSIZE & win32con.SWP_NOMOVE) # 退出应用 sys.exit(app.exec_())
''' Author: Vivienne Encarnacion Date: September 9, 2018 ''' import sys from PySide2.QtWidgets import QApplication from PySide2.QtGui import QGuiApplication, QWindow from PySide2.QtWidgets import QLabel if __name__ == '__main__': app = QGuiApplication(sys.argv) window = QWindow() window.setTitle('Hello world!') window.show() sys.exit(app.exec_())