Example #1
0
def test_gui_3questions(qtbot):
    app = QtWidgets.QApplication(sys.argv)
    screen = main_window.MainWindow()
    screen.show()
    ql_text = """form Box1HouseOwning {
    "Did you sell a house in 2010?" hasSoldHouse: boolean
    "Did you by a house in 2010?" hasBoughtHouse: boolean
    "Did you enter a loan for maintenance/reconstruction?" hasMaintLoan: boolean
}"""
    screen.parse(ql_text,"")
    question_ids = screen.output_frame.question_ids
    questions = screen.output_frame.questions
    questions[question_ids[0]].set_answer_true()
    questions[question_ids[1]].set_answer_false()
    screen.output_frame.output_path = "tests/gui_test_3questions.txt"

    screen.output_frame.write_to_txt()
    expected_answer = """"Did you sell a house in 2010?"True
"Did you by a house in 2010?"False
"Did you enter a loan for maintenance/reconstruction?"undefined
"""
    actual_answer = utility.open_file("tests/gui_test_3questions.txt")

    screen.close()
    QtWidgets.QApplication.instance().quit()
    assert expected_answer == actual_answer
Example #2
0
 def __init__(self):
     self.loadSettings()
     self.currentCombat = None
     self.currentProfile = profile.defaultProfile()
     self.engine = fsm.Engine()
     self.running = False
     self.mainWindow = main_window.MainWindow(self)
     self.mainWindow.show()
     roplus.registerCallback("ROPlus.OnPulse", self.onPulseCallback)
Example #3
0
def main():
    app = application.GuiApplication()
    app.initialize()

    mainWindow = main_window.MainWindow(app)
    app.getWindowManager().registerMainWindow(mainWindow)
    mainWindow.showMaximized()
    # mainWindow.show()
    app.startApp()
Example #4
0
 def __new__(cls):
     if MainController.__instance is None:
         MainController.__instance = object.__new__(cls)
         MainController.__instance.window = Window.MainWindow(MainController.__instance)
         MainController.__instance.log = Log.Logger(Log.GUI_MODE | Log.CONSOLE_MODE, MainController.__instance.window)
         MainController.__instance.changed = False
         MainController.__instance.ejecution_mode = False
         propr = CF.ConfigFile()
         MainController.__instance.path = propr.get_value("ruta_trabajo")
     return MainController.__instance
Example #5
0
def test_main_window(qtbot):
    app = QtWidgets.QApplication(sys.argv)
    screen = main_window.MainWindow()
    screen.show()

    screen.initiate_output_frame()

    screen.close()
    QtWidgets.QApplication.instance().quit()
    assert True
Example #6
0
 def __init__(self):
     self.loadSettings()
     self.questCompletors = {}
     self.currentQuestCompletor = None
     self.currentCombat = None
     self.combatState = None
     self.engine = fsm.Engine()
     self.running = False
     self.mainWindow = main_window.MainWindow(self)
     self.mainWindow.show()
     roplus.registerCallback("ROPlus.OnPulse", self.onPulseCallback)
Example #7
0
def main():
    """
    Main program
    """
    # CLI
    parser = argparse.ArgumentParser(prog='Python Questionnaire Language Parser',
                                     description='CLI tool of the python QL/QLS parser with gui. No arguments runs GUI',
                                     formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=45))
    parser.add_argument('-v', '--version', action='store_true',
                        help="Prints the program version.")
    parser.add_argument('-t', '--test', action='store_true',
                        help="Runs the testsuite.")
    parser.add_argument('-g', '--grammar', action='store', type=str, metavar='path',
                        help='Debug grammar. example: python run_app.py tests/forms/ql/pass/money_declare.ql')
    parser.add_argument('-p', '--parser', action='store', type=str.upper, choices=['QL', 'QLS'],
                        help='Generate antlr4 parser.')

    args = parser.parse_args()

    # Run version
    if args.version:
        print('{} {}'.format(config['program']['name'], config['program']['version']))
        sys.exit(0)

    # Run test suite
    if args.test:
        os.system("pytest -vv")
        sys.exit(0)

    # Debug grammar
    if args.grammar:
        g_debug = ParserInterface(args.grammar)
        g_debug.print_structure()
        sys.exit(0)

    # Generate antlr parser
    if args.parser:
        run_antlr_parse_gen(args.parser)
        sys.exit(0)

    # GUI
    app = QtWidgets.QApplication(sys.argv)
    screen = main_window.MainWindow()
    screen.show()

    sys.exit(app.exec_())
Example #8
0
def start_gui():
    core.file.SEARCH_PATH = os.getcwd()
    os.chdir(os.path.dirname(os.path.realpath(__file__)))

    app = QtWidgets.QApplication(sys.argv)
    control = Control()
    window = main_window.MainWindow(control)

    app.setOrganizationName("Forschungszentrum Jülich GmbH")
    app.setOrganizationDomain("fz-juelich.de")
    app.setApplicationName("pyMolDyn 2")

#    filename = '../xyz/generated2.xyz'
#    filename = '../xyz/generated.xyz'
#    filename = '../xyz/traject_200.xyz'
#    filename = '../xyz/GST_111_196_bulk.xyz'
    filename = '../xyz/structure_c.xyz'
#    filename = '../xyz/hexagonal.xyz'

    control = window.control
    # settings = core.calculation.CalculationSettings({filename: [0]},
    #                                                 32,
    #                                                 domains=False,
    #                                                 surface_cavities=False,
    #                                                 center_cavities=False)
    # control.calculate(settings)
    # control.update()
    # window.updatestatus()

    # Let the Python interpreter run every 50ms...
    timer = QtCore.QTimer()
    timer.start(50)
    timer.timeout.connect(lambda: None)
    # ... to allow it to quit the application on SIGINT (Ctrl-C)
    signal.signal(signal.SIGINT, signal.SIG_DFL)


    filenames = sys.argv[1:]
    for filename in filenames:
        if filename:
            window.file_dock.file_tab.disable_files_in_menu_and_open(filename)
            window.update_submenu_recent_files()
    screen_geom = QtWidgets.QDesktopWidget().screenGeometry()
    window.setGeometry((screen_geom.width() - window.width()) / 2, (screen_geom.height() - window.height()) / 2,
                       window.width(), window.height())
    sys.exit(app.exec_())
Example #9
0
  def __init__(self, argv):
    super(MainApp, self).__init__(argv)

    self._window = main_window.MainWindow()
    self._window.show()
    self._window.setWindowTitle('Quaver')

    if self._window._settings.show_updates:
      self._updater_thread = update.UpdateCheckerThread(self)
      self._updater_thread.notifyComplete.connect(self._window.openUpdateDialog)
      self._updater_thread.start()

    try:
      if utils.IS_WINDOWS:
        filepath = sys.argv[1]
        self._window.generateFilepathList([filepath])
      elif utils.IS_LINUX:
        filepaths = []
        [filepaths.append(file) for file in sys.argv[1:]]
        self._window.generateFilepathList(filepaths)
    except:
      pass
Example #10
0
 def __init__(self):
     roplus.log('Bot.__init__')
     self.running = False
     self.mainWindow = main_window.MainWindow(self)
     self.mainWindow.show()
     roplus.registerCallback('ROPlus.OnPulse', self.onPulseCallback)
Example #11
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from config_file import ConfigFile
from gui import main_window

if __name__ == "__main__":
    config_file = ConfigFile()
    main_window.MainWindow(1000, 500, 'logo.ico', 'logo.gif', config_file)
Example #12
0
def main():
    app = QApplication(sys.argv)
    mainWin = main_window.MainWindow()
    mainWin.show()
    app.exec_()
    sys.exit()