class vtkRegistration(QtGui.QApplication):
    def __init__(self, imgDims, stlPath, camMatrix, sys_argv):
        super(vtkRegistration, self).__init__(sys_argv)
        self.model = MainModel(imgDims, stlPath, camMatrix)
        self.controller = MainController(self.model)
        self.view = MainView(self.model, self.controller)
        self.view.show()
예제 #2
0
 def __init__(self, sys_argv):
     super(App, self).__init__(sys_argv)
     # Connect everything together
     self.model = Model()
     self.main_ctrl = MainController(self.model)
     self.main_view = MainView(self.model, self.main_ctrl)
     self.main_view.show()
예제 #3
0
 def __init__(self):
     self.ca = None
     self.rules = Rules()
     root = Tk()
     self.main_view = MainView(root, self)
     self.reload()
     root.mainloop()
예제 #4
0
class MainController():
    """ Controller for the Main View.
    """
    def __init__(self):
        self.ca = None
        self.rules = Rules()
        root = Tk()
        self.main_view = MainView(root, self)
        self.reload()
        root.mainloop()

    def reload(self):
        self.main_view.resize_cells()

        # Get the set of rules
        rule = self.main_view.cbx_rules.get()
        rules = self.rules.get(rule)
        self.ca = CellularAutomaton(rules)

        # Get the number of generations
        gens = int(self.main_view.spx_gens.get())
        for gen in range(gens):
            # Draw the generation
            self.main_view.draw_generation(self.ca.cells, gen)

            # Add the generation as a row
            self.ca.add_row(gen)

            # The CA evolves!
            self.ca.evolve()

        # Write the cellular automaton in a file
        self.ca.save(rule, gens)
예제 #5
0
 def __init__(self, argv):
     super(QApplication,self).__init__(argv)
     
     self.model = MainModel()
     self.controller = MainController(self.model)
     self.mainView = MainView(self.model,self.controller)
     self.mainView.show()
예제 #6
0
 def __init__(self, sys_argv):
     super(App,self).__init__(sys_argv)
 
     self._model =Model()
     self._main_controller = MainController(self._model)
     self._main_view = MainView(self._model,self._main_controller)
     self._main_view.show()
    def __init__(self, argv):
        super(App, self).__init__(argv)
        self.setStyle('Macintosh')
        self.model = Model()
        self.file_table_model = fileTableModel(data=[],
                                               header=[
                                                   "File path",
                                                   "Has segmentation mask?",
                                                   "Segmentation mask path",
                                                   "Scale"
                                               ])
        self.filter_table_model = filterTableModel(
            data=[], header=["Object", "Function", "Value"])
        self.main_controller = ImageDisplayController(self.model)

        self.image_manager_controller = ImageManagerController(
            self.file_table_model)
        self.filter_controller = FilterController(
            self.model, self.filter_table_model,
            self.model.current_image_model)

        self.main_view = MainView(self.model, self.file_table_model,
                                  self.filter_table_model,
                                  self.main_controller,
                                  self.image_manager_controller,
                                  self.filter_controller)
        self.main_view.show()
예제 #8
0
class App(QApplication):
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)
        self.model = Model()
        self.main_controller = MainController(self.model)
        self.main_view = MainView(self.model, self.main_controller)
        self.main_view.show()
예제 #9
0
    def __init__(self, sys_argv):
        super(Autonimo, self).__init__(sys_argv)

        # model
        self.model = Model(self)

        # controllers
        self.comp_ctrl = ComponentController(self.model)
        self.task_ctrl = TaskController(self.model)
        # self.task_ctrl.import_tasks('tasks')

        # views
        self.main_view = MainView(self.model, self.comp_ctrl, self.task_ctrl)
        self.main_view.show()
예제 #10
0
class Autonimo(QtGui.QApplication):
    def __init__(self, sys_argv):
        super(Autonimo, self).__init__(sys_argv)

        # model
        self.model = Model(self)

        # controllers
        self.comp_ctrl = ComponentController(self.model)
        self.task_ctrl = TaskController(self.model)
        # self.task_ctrl.import_tasks('tasks')


        # views
        self.main_view = MainView(self.model, self.comp_ctrl, self.task_ctrl)
        self.main_view.show()
예제 #11
0
파일: app.py 프로젝트: PinLin/bustw_cli
def main():
    try:
        MainView().main()
    except EOFError:
        print()
        print("Bye!")
    except KeyboardInterrupt:
        pass
예제 #12
0
    def __init__(self, sys_argv):

        super(App, self).__init__(sys_argv)

        self.model = Model()
        self.main_ctrl = MainController(self.model)
        self.main_view = MainView(self.model, self.main_ctrl)

        self.main_view.show()
예제 #13
0
 def __init__(self):
     super().__init__()
     if not Config.exists():
         Config.set_defaults()
     self.watch_only_wallet = WatchOnlyWallet()
     self.main_controller = MainController(self.watch_only_wallet)
     self.main_view = MainView(self.main_controller, self.watch_only_wallet)
     self.main_controller.sync_to_blockchain_loop_async()
     self.main_controller.sync_to_hardware_wallet_loop_async()
예제 #14
0
    def show_main_view(self, from_main):
        """Shows the main window depending on where the application comes from.

        If the from_main flag is true, the configuration comes from the previous GUI views. Otherwise, the configuration
        comes from a configuration file. Eitherway, the main view will be shown with the proper configuration.

        Arguments:
            from_main {bool} -- tells if the configuration comes from either configuration file or GUI.
        """
        if not from_main:
            layout_configuration = self.layout_selector.get_config()
            delete_widgets_from(self.parent.main_layout)
        else:
            layout_configuration = None
        self.main_view = MainView(layout_configuration, self.configuration,
                                  self.controller, self.parent)
        self.parent.main_layout.addWidget(self.main_view)
        self.fadein_animation()
        self.start_thread()
예제 #15
0
파일: app.py 프로젝트: aniawsz/subwoofler
    def __init__(self, window, *a, **kw):
        super(Application, self).__init__(*a, **kw)

        self._window = window

        # Create and start an audio thread.
        # It's going to communicate with the main thread through a thread-safe queue.
        self._notes_queue = Queue(maxsize=1)
        self._rompler = Rompler(name="AudioThread",
                                notes_queue=self._notes_queue)
        self._rompler.start()

        # Create the app's GUI
        self._view = MainView(window, self._rompler)

        # Stop the audio thread when the app is closing
        window.protocol("WM_DELETE_WINDOW", self._on_closing)

        window.bind("<Key>", self._handle_keypress)
        window.bind("<KeyRelease>", self._handle_keyrelease)
예제 #16
0
class App(QtGui.QApplication):
    def __init__(self, sys_argv):

        super(App, self).__init__(sys_argv)

        self.model = Model()
        self.main_ctrl = MainController(self.model)
        self.main_view = MainView(self.model, self.main_ctrl)

        self.main_view.show()

    "Attempt to enable global key presses and key releases"

    def notify(self, receiver, event):

        if self.model.get_output_popup_open_status() == False:

            if event.type() == QtCore.QEvent.KeyPress:
                self.main_view.keyboard.keyPressEvent(event)

            elif event.type() == QtCore.QEvent.KeyRelease:
                self.main_view.keyboard.keyReleaseEvent(event)

        # Call Base Class Method to Continue Normal Event Processing

        return super(App, self).notify(receiver, event)

    def closeEvent(self, event):

        quit_msg = "Are you sure you want to exit the program?"
        reply = QtGui.QMessageBox.question(self, "Message", quit_msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)

        if reply == QtGui.QMessageBox.Yes:
            if self.main_ctrl.output_ctrl.midi_port_open() is True:
                self.main_ctrl.output_ctrl.midiout.close()

            event.accept()
        else:
            event.ignore()
예제 #17
0
파일: app.py 프로젝트: aniawsz/subwoofler
class Application(object):
    def __init__(self, window, *a, **kw):
        super(Application, self).__init__(*a, **kw)

        self._window = window

        # Create and start an audio thread.
        # It's going to communicate with the main thread through a thread-safe queue.
        self._notes_queue = Queue(maxsize=1)
        self._rompler = Rompler(name="AudioThread",
                                notes_queue=self._notes_queue)
        self._rompler.start()

        # Create the app's GUI
        self._view = MainView(window, self._rompler)

        # Stop the audio thread when the app is closing
        window.protocol("WM_DELETE_WINDOW", self._on_closing)

        window.bind("<Key>", self._handle_keypress)
        window.bind("<KeyRelease>", self._handle_keyrelease)

    def _on_closing(self):
        self._rompler.stop.set()
        self._window.destroy()

    def _handle_keypress(self, event):
        try:
            key = event.char
            midi_note = KEYBOARD_KEY_TO_MIDI_NOTE[key]
            self._notes_queue.put(midi_note)
            self._view.on_key_pressed(key)
        except KeyError:
            # note not supported
            pass

    def _handle_keyrelease(self, event):
        key = event.char
        self._view.on_key_released(key)
예제 #18
0
class ViewsController(QMainWindow):
    """This class will handle all the views of the application.

    Responsible for showing the differnet views in a specific order depending on the input of the user. If the
    application is launched with a profile (configuration file), the main view of the application will be shown;
    otherwise, the title and the configuration views will be shown prior to the main view.
    """

    home_singal = pyqtSignal()
    robot_select_signal = pyqtSignal()

    def __init__(self, parent, configuration, controller=None):
        """Constructor of the class.

        Arguments:
            parent {ui.gui.views_controller.ParentWindow} -- Parent of this.
            configuration {utils.configuration.Config} -- Configuration instance of the application

        Keyword Arguments:
            controller {utils.controller.Controller} -- Controller of the application (default: {None})
        """
        QMainWindow.__init__(self)
        self.parent = parent
        self.controller = controller
        self.configuration = configuration
        self.main_view = None
        self.thread_gui = ThreadGUI(self)
        self.thread_gui.daemon = True

        # self.home_singal.connect(self.show_title)
        # self.robot_select_signal.connect(self.show_robot_selection)

    def show_title(self):
        """Shows the title view"""
        title = TitleWindow(self.parent)
        title.switch_window.connect(self.show_robot_selection)
        self.parent.main_layout.addWidget(title)
        self.fadein_animation()

    def show_robot_selection(self):
        """Shows the robot selection view"""
        from views.robot_selection import RobotSelection

        delete_widgets_from(self.parent.main_layout)
        robot_selector = RobotSelection(self.parent)
        robot_selector.switch_window.connect(self.show_world_selection)
        self.parent.main_layout.addWidget(robot_selector, 0)
        self.fadein_animation()

    def show_world_selection(self):
        """Shows the world selection view"""
        from views.world_selection import WorldSelection

        delete_widgets_from(self.parent.main_layout)
        world_selector = WorldSelection(self.parent.robot_selection,
                                        self.configuration, self.parent)
        world_selector.switch_window.connect(self.show_layout_selection)
        self.parent.main_layout.addWidget(world_selector)
        self.fadein_animation()

    def show_layout_selection(self):
        """Show the layout configuration view"""
        delete_widgets_from(self.parent.main_layout)
        self.layout_selector = LayoutSelection(self.configuration, self.parent)
        self.layout_selector.switch_window.connect(self.show_main_view_proxy)
        self.parent.main_layout.addWidget(self.layout_selector)
        self.fadein_animation()

    def show_main_view_proxy(self):
        """Helper function to show the main view. Will close the parent window to create  a new one"""
        # self.show_main_view(False)
        self.parent.close()

    def show_main_view(self, from_main):
        """Shows the main window depending on where the application comes from.

        If the from_main flag is true, the configuration comes from the previous GUI views. Otherwise, the configuration
        comes from a configuration file. Eitherway, the main view will be shown with the proper configuration.

        Arguments:
            from_main {bool} -- tells if the configuration comes from either configuration file or GUI.
        """
        if not from_main:
            layout_configuration = self.layout_selector.get_config()
            delete_widgets_from(self.parent.main_layout)
        else:
            layout_configuration = None
        self.main_view = MainView(layout_configuration, self.configuration,
                                  self.controller, self.parent)
        self.parent.main_layout.addWidget(self.main_view)
        self.fadein_animation()
        self.start_thread()

    def start_thread(self):
        """Start the GUI refresing loop"""
        self.thread_gui.start()

    def fadein_animation(self):
        """Start a fadein animation for views transitions"""
        self.w = QFrame(self.parent)
        # self.parent.main_layout.addWidget(self.w, 0)
        self.w.setFixedSize(WIDTH, HEIGHT)
        self.w.setStyleSheet('background-color: rgba(51,51,51,1)')
        self.w.show()

        effect = QGraphicsOpacityEffect()
        self.w.setGraphicsEffect(effect)

        self.animation = QPropertyAnimation(effect, b"opacity")
        self.animation.setDuration(500)
        self.animation.setStartValue(1)
        self.animation.setEndValue(0)

        self.animation.start(QPropertyAnimation.DeleteWhenStopped)
        self.animation.finished.connect(self.fade_animation)

    def fade_animation(self):
        """Safe kill the animation"""
        self.w.close()
        del self.w
        del self.animation

    def update_gui(self):
        """Update the GUI. Called from the refresing loop thread"""
        while not self.parent.closing:
            if self.main_view:
                self.main_view.update_gui()
            time.sleep(0.1)
예제 #19
0
	def __init__(self):
		window = tk.Tk()
		MainController(MainView(window),MasterTransceiverInterface())
		window.mainloop()
예제 #20
0
class App(QApplication):
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)
        self.main_view = MainView()
        self.main_view.show()
예제 #21
0
 def __init__(self, sys_argv):
     super(App, self).__init__(sys_argv)
     self.main_view = MainView()
     self.main_view.show()
예제 #22
0
def main():
    v = MainView.load_view()
    v.present(style='fullscreen', orientations=['portrait'])
예제 #23
0
def demo():

    app = QApplication(sys.argv)
    app_window = MainView()
    sys.exit(app.exec_())
예제 #24
0
    if skip_bgs or bg is None:
      return
    self.cur_bg = bg.name
    self.cur_bg_src_short = bg.source
    self.cur_traits = bg.get_traits_as_str()
    

  def pick(self, even=False, skip_race=False, skip_class=False, skip_spec=False, skip_bg=False, sources=None):
    self._shuffle_race(even, skip_race, sources)
    self._shuffle_class(even, skip_class, skip_spec, sources)
    self._shuffle_bg(skip_bg, sources)
    # self.print_race_class_with_short_sources()

  def print_race_class(self):
    print(self.cur_race)
    print(self.cur_class)

  def print_race_class_with_sources(self):
    print('%s  |  %s' % (self.cur_race, self.cur_race_src))
    print('%s  |  %s' % (self.cur_class, self.cur_class_src))

  def print_race_class_with_short_sources(self):
    print('%s  |  %s' % (self.cur_race, self.cur_race_src_short))
    print('%s  |  %s' % (self.cur_class, self.cur_class_src_short))


if __name__ == '__main__':
  rnd = Randomizer()
  v = MainView.load_view(rnd)
  v.present(style='fullscreen')
예제 #25
0
from tools.framebuffer import Framebuffer
from views.main_view import MainView

import traceback

try:
    framebuffer = Framebuffer()
    surface = framebuffer.get_framebuffer_suface()
    v = MainView(surface)
    while True:
        v.update(surface)
except Exception:
    print(traceback.format_exc(Exception))