def render(self): app = QApplication(sys.argv) self.config_window = ConfigWindow() self.stat_window = ClientStatsWindow() self.main_window = MainWindow() self.show_main_window() self.make_signals_connection() app.exec_()
def transition_to_main_window(project): logging.info("Transitioning to main window.") global main_window driver = Driver(project) settings_service.save_settings() main_window = MainWindow(transition_back_to_create_project, driver) main_window.show()
def main(): app = QgsApplication([], True) app.setPrefixPath("C:/OSGeo4W64/apps/qgis", True) app.initQgis() window = MainWindow() window.show() window.raise_() bb = (635432, 5616219, 635939, 5616575) # WestSouthEastNorth # bb = (633612, 5619141, 634424, 5619713) # highway # # streets streetsPath = ("files/cir/streets.shp") osmStreets = OsmStreets(extent=bb, extentEPSG=25832) osmStreets.getBufferedStreets(savePath=streetsPath) loadVectorLayer(streetsPath, "streets") streetMaskPath = ("files/cir/streets_mask.tiff") vector2raster(bb, streetsPath, streetMaskPath) loadRasterLayer(streetMaskPath, "streetsMask") # clipping dop with streetMask dop = ("files/colour/streets_dop.tif") clippedPathTemp = ("files/colour/streets_clipped_temp.tiff") clipping(streetMaskPath, dop, clippedPathTemp) # copy extent and EPSG from streetMaskPath clippedPath = ("files/colour/streets_clipped.tiff") CopyExtentandEPSG(streetMaskPath, clippedPathTemp, clippedPath) loadRasterLayer(clippedPath, "clippedSteets") # # # buildings # buildingsPath = ("files/buildings.shp") # osmBuildings = OsmBuildings(extent=bb, extentEPSG=25832) # osmBuildings.getBuildingPolygons(savePath=buildingsPath, onlyWithHeight=False) # loadVectorLayer(buildingsPath, "buildings") # buildingMaskPath = ("files/buildings.tiff") # vector2raster(bb, buildingsPath, buildingMaskPath) # loadRasterLayer(buildingMaskPath, "buildingsMask") # water # waterPath = "files/water.shp" # osmWater = OsmWater(extent=bb, extentEPSG=25832) # osmWater.getWaterPolygons(savePath=waterPath) # loadVectorLayer(waterPath, "water") # waterMaskPath = "files/water.tiff" # vector2raster(bb, waterPath, waterMaskPath) # loadRasterLayer(waterMaskPath, "waterMask") # set CRS to the one of image and zoom to extent crs = QgsCoordinateReferenceSystem() crs.createFromId(25832) window.canvas.setDestinationCrs(crs) exitcode = app.exec_() QgsApplication.exitQgis() sys.exit(exitcode)
def do_startup(self): Gtk.Application.do_startup(self) self.settings = Settings(self) self.discoverer = Discoverer() self.player = Player(self) self.equalizer = Equalizer(self) self.queue = Queue(self) self.history = History(self) self.integration = Integration(self) self.win = MainWindow(self)
def sign_up(self, login, password, name): user = User(login = login, password=password, fullname = str(name)) try: self.auth_service.create_new_user(user) messagebox.showinfo(message="User created.") self.window.destroy() self.window = Tk() MainWindow(self.window, user.id, Services.product_service(), Services.user_service(), Services.physical_stats_service()) except: messagebox.showinfo(message="User with that login already exists.")
def __init__(self): app = QApplication(sys.argv) width = app.desktop().screenGeometry().width() height = app.desktop().screenGeometry().height() Connection() # Initializing database connection load_setting() # Load Setting from config load_url() # Load URL List from json file w = MainWindow(width, height, "Skreepy") w.setVisible(True) sys.exit(app.exec_())
def sign_in(self, login, password): user = User(login = login, password = password) try: user_from_db = self.auth_service.verify_user(user) self.window.destroy() self.window = Tk() MainWindow(self.window, user_from_db.id, Services.product_service(), Services.user_service(), Services.physical_stats_service()) except Exception as e: messagebox.showinfo(message="Wrong login or password.")
def show_main_window(self): self.main_window = MainWindow(self.client.client_name) self.main_window.logout_signal.connect(self.logout) self.main_window.start_chatting_signal.connect(self.start_chatting) self.main_window.send_message_signal.connect(self.send_message) self.main_window.switch_to_add_contact.connect(self.show_add_contact_window) self.main_window.switch_to_del_contact.connect(self.show_del_contact_window) self.make_main_window_signals_connection() self.main_window.set_elements_disable_status(True) self.main_window.render_welcome_message() contacts = self.get_contacts() self.main_window.render_contacts(contacts) if self.login_window: self.login_window.close() if self.signup_window: self.signup_window.close() self.main_window.show()
def run(): import argparse parser = argparse.ArgumentParser() parser.add_argument( '-m', dest='module', default='pynodegl_utils.examples', help='set the module name containing the scene functions') parser.add_argument( '-a', dest='assets_dir', help='set the assets directory to be used by the scene functions') parser.add_argument('--hooks-dir', dest='hooksdir', help='set the directory path containing event hooks') pargs = parser.parse_args(sys.argv[1:]) app = QtWidgets.QApplication(sys.argv) window = MainWindow(pargs.module, pargs.assets_dir, pargs.hooksdir) window.show() app.exec_()
def main(argv): """ Program entry point argv: Command line args (excluding the script name) """ # Load the ship registry script_path = os.path.dirname(os.path.abspath(__file__)) ships_json = os.path.join(script_path, "data", "ship_registry.json") ship_registry = ShipRegistry(ships_json) # Load the pilot registry pilots_json = os.path.join(script_path, "data", "pilot_registry.json") pilot_registry = PilotRegistry(pilots_json, ship_registry) # Create the board board = Board() # Create players for each side player1 = ConsolePlayer(Faction.imperial, board) player2 = ConsolePlayer(Faction.rebel, board) # Wrap these all up in the game object game = Game(board, [player1, player2], pilot_registry) # Create the game thread and set it running game_thread = GameThread(game) # Build the UI and set it running root = tk.Tk() app = MainWindow(board, master=root) try: app.mainloop() except KeyboardInterrupt: pass # Once the main window is closed, join the game thread game_thread.join() return 0
def run(): import argparse parser = argparse.ArgumentParser() parser.add_argument( '-m', dest='module', default='pynodegl_utils.examples', help='set the module name containing the scene functions') parser.add_argument( '-a', dest='assets_dir', help='set the assets directory to be used by the scene functions') parser.add_argument('--hooks-dir', dest='hooksdir', help='set the directory path containing event hooks') pargs = parser.parse_args(sys.argv[1:]) app = QtWidgets.QApplication(sys.argv) # Fixes ui freezes with the native gl view on macos 10.14 (mojave) app.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings) window = MainWindow(pargs.module, pargs.assets_dir, pargs.hooksdir) window.show() app.exec_()
def run(self): print('Waiting to initial connection to server...') while not self.servers_db.selected: ip = Ip(self.queue.get()) if ip.protocol != 6: continue tcp = Tcp(ip.data) if len(tcp.data) == 4 and tcp.data.get_array_int(1) == [1, 0, 0, 0]: self.servers_db.selected = self.servers_db[ip.source_addr] print('Conected to: ' + self.servers_db.selected['name']) MainWindow().SetServerName(self.servers_db.selected['name']) while len(self.server_keys) < 2 or len(self.client_keys) < 2: ip = Ip(self.queue.get()) if ip.protocol != 6 or (ip.source_addr != self.servers_db.selected['ip'] and ip.destination_addr != self.servers_db.selected['ip']): continue tcp = Tcp(ip.data) if tcp.data.len() == 128: if ip.source_addr == self.servers_db.selected['ip']: # received self.server_keys.append(tcp.data) else: # sent self.client_keys.append(tcp.data) self.session = Session(self.server_keys, self.client_keys) SkillDatabase().read(self.servers_db.selected['location']) HotDotDatabase().read(self.servers_db.selected['location']) NpcDatabase().read(self.servers_db.selected['location']) while self.enable: ip = Ip(self.queue.get()) if ip.protocol != 6 or (ip.source_addr != self.servers_db.selected['ip'] and ip.destination_addr != self.servers_db.selected['ip']): continue tcp = Tcp(ip.data) if not tcp.data.len(): continue if ip.source_addr == self.servers_db.selected['ip']: # received self.session.encrypt(tcp.data) self.s_splitter.add_data(tcp.data) else: # sent self.session.decrypt(tcp.data) self.c_splitter.add_data(tcp.data)
def build(self): self.title = 'KrApp' return MainWindow()
from tkinter import Tk from ui.main_window import MainWindow if __name__ == '__main__': root = Tk() mw = MainWindow(root) root.mainloop()
import sys from PyQt5.QtWidgets import QApplication, QWidget from ui.main_window import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) UI = MainWindow() sys.exit(app.exec_())
import qdarkstyle from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QMessageBox from ui.main_window import MainWindow if __name__ == '__main__': app = QApplication([]) app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) if os.path.isfile('config.json'): with open('config.json') as f: config = json.load(f) application = MainWindow(app, config) # Disable window resize and the maximize button application.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowMinimizeButtonHint) application.show() application.setFixedSize(application.size()) sys.exit(app.exec_()) else: msg = QMessageBox() msg.setWindowTitle('Config missing') msg.setText( """<p style='text-align: center;'><img src='ui/assets/warning-icon.png' alt='' width='42' height='42'/></p> <p style='align: center;'><strong>config.json file is missing, cannot continue !</strong></p>"""
#!/usr/bin/python3 import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GdkPixbuf, GObject, GLib import os from ui.main_window import MainWindow from ui.view_service_window import ViewServiceWindow log_viewer = MainWindow() Gtk.main()
import sys from ui.main_window import MainWindow from PyQt5 import QtWidgets if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) main = MainWindow() main.show() sys.exit(app.exec_())
if __name__ == '__main__': print('Reading databases...') servers_db = ServerDatabase() abnormal_db = AbnormalDatabase() hot_dot_db = HotDotDatabase() icon_db = IconDatabase() npc_db = NpcDatabase() skill_db = SkillDatabase() opcodes_db = OpcodesDatabase() tracker = Tracker() app = wx.App() ui = MainWindow() msg_handler = MessagesHandler() c_splitter = BlockSplitter(MessageDirection(1), msg_handler.messages) s_splitter = BlockSplitter(MessageDirection(2), msg_handler.messages) con_handler = ConnectionHandler(c_splitter, s_splitter) sniffer = Sniffer(con_handler.queue) msg_handler.start() c_splitter.start() s_splitter.start() con_handler.start() sniffer.start() app.MainLoop() # hold in UI loop
import sys import argparse from PyQt5.QtWidgets import QApplication from ui.main_window import MainWindow def parse_arguments(): parser = argparse.ArgumentParser("Argument parser for decision system") parser.add_argument("-p", "--path", help="Path to the file with decision graph to import", type=str) return parser.parse_args() if __name__ == '__main__': args = parse_arguments() app = QApplication([]) main_window = MainWindow() if args.path: main_window.import_from_path(args.path) pass sys.exit(app.exec_())
#!/usr/bin/env python3 # Make sure to find pyVFRendering, nanogui and ovf if manually built # This is only needed if you did not install the package # # import sys # import os # pyVFRenderingDir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), "VFRendering/build/Release")) # sys.path.insert(0, pyVFRenderingDir) # nanoguiDir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), "nanogui/build/Release/python")) # sys.path.insert(0, nanoguiDir) # nanoguiDir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), "ovf/python")) # sys.path.insert(0, nanoguiDir) import nanogui import gc from ui.main_window import MainWindow if __name__ == '__main__': nanogui.init() win = MainWindow(800, 600) win.setVisible(True) nanogui.mainloop(refresh=1000) del win gc.collect nanogui.shutdown()
def create_window(w): w = MainWindow()
def setup_hook(): _excepthook = sys.excepthook def hook(exctype, value, traceback): print(exctype, value, traceback) _excepthook(exctype, value, traceback) sys.exit(1) sys.excepthook = hook if __name__ == '__main__': setup_hook() QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) app.setWindowIcon(QIcon(':/icon/img/logo.png')) w = MainWindow() cp = QDesktopWidget().availableGeometry().center() qr = w.frameGeometry() qr.moveCenter(cp) w.move(qr.topLeft()) w.show() w.tabs_container.setCurrentIndex(0) try: sys.exit(app.exec_()) except: pass
def write(self, message): os.write(self.fd, message.encode()) def flush(self): pass if __name__ == '__main__': app = QApplication(sys.argv) window = QMainWindow() # capture file descriptors, responsible for stderr and stdout and pass them to console for logging stdout_descriptor = sys.stdout.fileno() new_stdout, in_write = os.pipe() os.dup2(in_write, stdout_descriptor) sys.stdout = FDWrapper(in_write) dark = '--dark' in sys.argv if dark: stylesheet = load_stylesheet_pyqt5() window.setStyleSheet(stylesheet) main_ui = MainWindow(window, new_stdout, dark) main_ui.setupUi(window) main_ui.initialize() print('Ready.') window.show() sys.exit(app.exec_())
def act(self): logging.info("Entered Main state.") self.window = MainWindow() self.window.show()
def main(): # rows = int(input("How many rows do you want in the grid? ")) app = QtWidgets.QApplication(sys.argv) main_window = MainWindow(3) sys.exit(app.exec())
def main(): app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) print('start main window...') w = MainWindow() w.show() sys.exit(app.exec_())
from PyQt5.QtWidgets import QApplication from application_service.get_map_uc import GetMapUseCase from serveces.YandexMapAdapter import YandexMapAdapter from ui.main_window import MainWindow adapter = YandexMapAdapter() use_case = GetMapUseCase(adapter) app = QApplication([]) win = MainWindow(use_case) win.show() app.exec()
from PySide2.QtGui import QIcon # custom style from pdi.widgets.qstyle import darkstyle # main window from ui.main_window import MainWindow # logger utility from util.setup_log import setupLogger if __name__ == "__main__": os.chdir(os.path.dirname(os.path.abspath(os.path.join(__file__, "../")))) print(os.getcwd()) print("AAA") # アプリケーション作成 app = QApplication(sys.argv) # app.setWindowIcon(QIcon("icon.png")) # オブジェクト作成 window = MainWindow(sys.argv) # MainWindowの表示 window.show() window.resize(1200, 800) ret = app.exec_() print(ret) sys.exit(ret)