def setUp(self): self.mainWindow = main_window.MainWindow("example_files/file1.c", "example_files/file2.c") self.table = self.mainWindow.table_widget # for testing button presses on window with no input files self.mainWindow2 = main_window.MainWindow() self.table2 = self.mainWindow2.table_widget
def setup(self, share_dir): self.wtree = gtk.glade.XML(os.path.join(share_dir, 'gtklick.glade')) # explicitly call base class method, because get_name() is overridden in AboutDialog. stupid GTK... self.widgets = dict([(gtk.Widget.get_name(w), w) for w in self.wtree.get_widget_prefix('')]) self.config = gtklick_config.GTKlickConfig() # load config from file self.config.read() # start klick process self.klick = klick_backend.KlickBackend('gtklick', self.port, self.return_port, self.connect, self.verbose) # make "globals" known in other modules for m in (main_window, profiles_pane, preferences_dialog): m.wtree = self.wtree m.widgets = self.widgets m.klick = weakref.proxy(self.klick) m.config = weakref.proxy(self.config) # the actual windows are created by glade, this basically just connects GUI and OSC callbacks self.win = main_window.MainWindow() self.profiles = profiles_pane.ProfilesPane(self.win) self.prefs = preferences_dialog.PreferencesDialog()
def main(outfile): out = open(outfile, "w") printer = CommandPrinter(out) mw = main_window.MainWindow(["../formulas"]) menu_items = mw.get_all_actions() for item in menu_items: if len(item) < 4: continue key = item[3] if not key: continue func = item[5] printer.add_command(key, func.__doc__) # hard-code ones which are too hard to extract from main code printer.add_command("(arrow)", "Pan image in indicated direction.") printer.add_command("<control>(arrow)", "Pan more quickly in indicated direction.") printer.add_command("<shift>(arrow)", "Mutate image in Z or W directions.") printer.add_command("<shift><control>(arrow)", "Mutate more quickly.") printer.add_command("Escape", "Quit full-screen mode.") printer.add_mouse("Left-click", "Zoom in") printer.add_mouse("Left-click and drag", "Draw rectangle to zoom into.") printer.add_mouse("Shift-Left-click", "Recenter image on point clicked.") printer.add_mouse("Middle-click", "Flip to Julia set (or back to Mandelbrot).") printer.add_mouse("Right-click", "Zoom out.") printer.add_mouse("Control-Right-click", "Zoom out more quickly.") printer.output_all()
def do_activate(self): """ Override the 'activate' signal of GLib.Application. """ try: import main_window except ImportError as err: msg = "Cannot create Cnchi main window: {0}".format(err) logging.error(msg) sys.exit(1) # Check if we have administrative privileges if os.getuid() != 0: msg = _( 'This installer must be run with administrative privileges, ' 'and cannot continue without them.') show.error(None, msg) return # Check if we're already running if self.already_running(): msg = _( "You cannot run two instances of this installer.\n\n" "If you are sure that the installer is not already running\n" "you can run this installer using the --force option\n" "or you can manually delete the offending file.\n\n" "Offending file: '{0}'").format(self.TMP_RUNNING) show.error(None, msg) return window = main_window.MainWindow(self, cmd_line) self.add_window(window) window.show() with open(self.TMP_RUNNING, "w") as tmp_file: tmp_file.write("Cnchi {0}\n{1}\n".format(info.CNCHI_VERSION, os.getpid()))
def main(): """main""" if len(sys.argv) < 2: path = os.path.abspath(os.curdir) else: path = os.path.abspath(sys.argv[1]) path = get_git_root_path(path) print("Use git repository:", path) try: os.chdir(path) except OSError as error: print(error) return git.Git.repo_path = path + "/.git" app = QtGui.QApplication(sys.argv) app.setApplicationName("SnoutGit") app.setApplicationVersion("0.0.0.0") app.setOrganizationName("PanteR") window = main_window.MainWindow() window.show() sys.exit(app.exec_())
def main(): """Main entry. """ app = QtWidgets.QApplication(sys.argv) # i18n locale = QtCore.QLocale.system().name() logging.info('locale: {}'.format(locale)) translator = QtCore.QTranslator(app) if translator.load('qt_' + locale, ':/') and app.installTranslator(translator): logging.info('system translation loaded') translator = QtCore.QTranslator(app) if translator.load('languages_' + locale, ':/') and app.installTranslator(translator): logging.info('app translation loaded') # app info app.setOrganizationName('caobinbin') app.setOrganizationDomain('binbincao.com') app.setApplicationName('Accounting') app.setApplicationVersion('1.0.0') app.setWindowIcon(QtGui.QIcon(':/app.png')) window = main_window.MainWindow() window.show() app.exec()
def init_main_window(prog_name, masteruri, launch_files=[]): # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) rospy.init_node(prog_name, anonymous=False, log_level=rospy.DEBUG) setTerminalName(rospy.get_name()) setProcessName(rospy.get_name()) import main_window local_master = init_globals(masteruri) return main_window.MainWindow(launch_files, not local_master, launch_files)
def do_activate(self): """ Override the 'activate' signal of GLib.Application. """ try: import main_window except ImportError as err: msg = _("Can't create Thus main window: {0}").format(err) logging.error(msg) sys.exit(1) # window = main_window.MainWindow(self, cmd_line) main_window.MainWindow(self, cmd_line)
def MainWindow_Enter(self): if self.password.text() == 'sparal' and self.name.text(): # if self.choice.value() == 1: # self.takeinputs() # else: self.cams = main_window.MainWindow() self.cams.NameSetter(self.name) self.cams.login(self.choice.value()) self.cams.show() self.close() else: Dialog()
def run(): config_taskbar_icon() app = QtWidgets.QApplication(sys.argv) check = run_welcome_check() if check == 'run': window = welcome_window.WelcomeWindow() if check == 'skip': window = main_window.MainWindow() sys.exit(app.exec_())
def main(): logger = get_logger(__name__) logger.debug("start self_checkout_machine") settings.init() # print settings.app app = QtGui.QApplication(sys.argv) window = main_window.MainWindow() window.goodShow() window.check_devices() sys.exit(app.exec_())
def login_check(self): r = db.check_login(self.enum, self.pwd) if (r != 'no'): print("login success") self.error.setText("login success") self.hide() try: self.m = main_window.MainWindow() self.m.initUI(2, r) self.m.show() except Exception as e: print(e) else: print("login failed") self.error.setText("login failed")
def check_admin_login(self): r = db.check_admin(self.n, self.p) if (r == 'yes'): print("login success") self.error.setText("login success") self.hide() try: self.m = main_window.MainWindow() self.m.initUI(1, r) self.m.show() except Exception as e: print(e) else: print("login failed") self.error.setText("login failed")
def got_a_message(argv): print('got_a_message argv: %s' % argv) if argv == '--show': for win in windows: print('win: %s' % win) win.showRaise() return # Let's make this a list of files. parser = argparse.ArgumentParser() parser.add_argument('files', metavar='FILE', nargs='*', help='A file to open for editing') args = parser.parse_known_args(argv)[0] count = 0 # Open a window for every file. for file in args.files: if not os.path.isfile(file): print('Invalid file: %s' % file) continue # Make a window. count += 1 win = main_window.MainWindow() # Open the file. win.do_open(file) # Spruce up the editor. siding.style.apply_stylesheet(win.editor, 'editor.qss') # ... and show it. win.show() windows.append(win) return count
def main(): ''' Creates and runs the ROS node. ''' setTerminalName(NODE_NAME) setProcessName(NODE_NAME) try: from PySide.QtGui import QApplication from PySide.QtCore import QTimer except: print >> sys.stderr, "please install 'python-pyside' package!!" sys.exit(-1) rospy.init_node(NODE_NAME, log_level=rospy.DEBUG) # Initialize Qt global app app = QApplication(sys.argv) # initialize the global handler global _ssh_handler global _screen_handler global _start_handler global _name_resolution _ssh_handler = SSHhandler() _screen_handler = ScreenHandler() _start_handler = StartHandler() _name_resolution = NameResolution() #start the gui import main_window mainForm = main_window.MainWindow() if not rospy.is_shutdown(): mainForm.show() exit_code = -1 try: rospy.on_shutdown(finish) exit_code = app.exec_() mainForm.finish() finally: sys.exit(exit_code)
def __init__(self, loggers, stats, signals, db): # pyqt definitions os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" self.app = QApplication([]) self.app.setAttribute(Qt.AA_EnableHighDpiScaling) # variables received self.loggers = loggers self.stats = stats self.signals = signals self.db = db # windows self.main = main_window.MainWindow(self.loggers, self.stats, self.signals, self.db) self.options = options_window.OptionsWindow(self.signals, self.db) # init self.connect_events() # start self.main.window.show() exit(self.app.exec_())
def main(): os.chdir(os.getcwd()) reload(sys) # sys.setdefaultencoding("utf-8") codec = QtCore.QTextCodec.codecForName("utf-8") QtCore.QTextCodec.setCodecForLocale(codec) QtCore.QTextCodec.setCodecForCStrings(codec) QtCore.QTextCodec.setCodecForTr(codec) app = QtGui.QApplication(sys.argv) ct_widget = main_window.MainWindow() ct_widget.resize(WINDOW_WIDTH, WINDOW_HEIGHT) ct_widget.show() x, y = __get_center_pos(ct_widget.frameSize().width(), ct_widget.frameSize().height()) ct_widget.move(x, y) #sys.stderr = Common.customog sys.exit(app.exec_())
''' Created on 6 Jun 2019 @author: Scott Hurley [email protected] ''' ''' This file creates and runs the GUI. Run this file if you want to use it. ''' import Tkinter as tk import main_window as mw if __name__ == '__main__': root = tk.Tk() root.minsize(1217, 720) app = mw.MainWindow(root) root.mainloop() pass
def main(): ui = main_window.MainWindow() while ui.main_loop(): pass
def main(): mw = main_window.MainWindow() mw.init()
def main(name, anonymous=False): global CFG_PATH masteruri = masteruri_from_ros() CFG_PATH = ''.join([get_ros_home(), os.sep, 'node_manager', os.sep]) ''' Creates and runs the ROS node. ''' if not os.path.isdir(CFG_PATH): os.makedirs(CFG_PATH) args = rospy.myargv(argv=sys.argv) # decide to show main or echo dialog if len(args) >= 4 and args[1] == '-t': name = ''.join([name, '_echo']) anonymous = True try: from PySide.QtGui import QApplication except: print >> sys.stderr, "please install 'python-pyside' package!!" sys.exit(-1) # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) rospy.init_node(name, anonymous=anonymous, log_level=rospy.DEBUG) setTerminalName(rospy.get_name()) setProcessName(rospy.get_name()) # Initialize Qt global app app = QApplication(sys.argv) # decide to show main or echo dialog import main_window, echo_dialog global main_form if len(args) >= 4 and args[1] == '-t': show_hz_only = (len(args) > 4 and args[4] == '--hz') main_form = echo_dialog.EchoDialog(args[2], args[3], show_hz_only) else: # initialize the global handler global _ssh_handler global _screen_handler global _start_handler global _name_resolution global _history _ssh_handler = SSHhandler() _screen_handler = ScreenHandler() _start_handler = StartHandler() _name_resolution = NameResolution() _history = History() # test where the roscore is running (local or remote) __is_local('localhost') ## fill cache __is_local(_name_resolution.getHostname(masteruri)) ## fill cache local_master = is_local(_name_resolution.getHostname(masteruri)) #start the gui main_form = main_window.MainWindow(args, not local_master) if not rospy.is_shutdown(): os.chdir(PACKAGE_DIR ) # change path to be able to the images of descriptions main_form.show() exit_code = -1 rospy.on_shutdown(finish) exit_code = app.exec_()
import tkinter as tk import main_window import manage_accounts if not manage_accounts.check_credentials(): manage_accounts.ManageAccount() root = tk.Tk() root.config(padx=50, pady=50) root.title('Email Client') main = main_window.MainWindow(root) main.grid(row=0, column=0) root.mainloop()
def window(newJira): app = QtWidgets.QApplication(sys.argv) mainwindow = main_window.MainWindow(newJira) mainwindow.show() app.exec_()
def run_main_window(self): self.main_window = main_window.MainWindow() self.main_window.show()
def Exit_Window(self): self.cams = main_window.MainWindow() self.cams.show() self.close()
def openMain(self): self.window = main_window.MainWindow() self.window.show() self.close()
def run(self): self.main_window = main_window.MainWindow(self) self.root.mainloop() cv2.destroyAllWindows() sys.exit()
def correct_auth_handler(self): sock = self.login_handler.get_sock() new_window = Toplevel(self.master) main_window.MainWindow(new_window, self.username_input.get(), sock) self.master.withdraw()
def run(): _app = app.App(sys.argv) main = main_window.MainWindow(_app) main.show() sys.exit(_app.exec_())
import sys import main_window from PyQt4 import QtGui if __name__ == '__main__': app = QtGui.QApplication(sys.argv) window = main_window.MainWindow() window.show() sys.exit(app.exec_())