Ejemplo n.º 1
0
class PointInSpace:
    def __init__(self):
        self.main_window = MainWindow()

    def run(self):
        if self.main_window:
            self.main_window.show()
Ejemplo n.º 2
0
    def create_new_project(self):
        # TODO create a new file?
        project = {"path": "tmp.eproj"}

        self.main_window = MainWindow(self.ctx, project)
        self.main_window.show()
        self.close()
Ejemplo n.º 3
0
class Game:
    def __init__(self):
        self.background = pyglet.graphics.Batch()
        self.width = 1280
        self.height = 960

        with open('./level/levels.json', "r") as levels:
            self.levels = json.load(levels)
        print(self.levels)
        self.resource_handler = ResourceHandler()
        self.resource_handler.load_font()
        
        self.cursor = Cursor(self.background)
        self.pause_menu = Menu(self.width, self.height)
        self.game_window = MainWindow(self.cursor,
                                      self.levels['levels'],
                                      self.pause_menu, 
                                      self.background, 
                                      self.width, 
                                      self.height,
                                      'Shoot Em’ Up!', 
                                      resizable=True)

        self.game_window.set_mouse_visible(False)  # Hide the mouse cursor

        pyglet.clock.schedule_interval(self.game_window.update, 1/120.0)
        pyglet.app.run()
Ejemplo n.º 4
0
def main():
    print 'Starting Central Access Reader...'

    import sys
    import os

    from PyQt4.QtGui import QApplication, QPixmap, QSplashScreen
    app = QApplication(sys.argv)

    # Create a splash screen
    from forms import resource_rc
    pixmap = QPixmap(':/icons/icons/CAR Splash.png')
    splash = QSplashScreen(pixmap)
    splash.show()
    app.processEvents()

    # Check to see if my folders in my paths exist. If they don't, make them
    from misc import program_path, app_data_path, temp_path

    if not os.path.exists(os.path.dirname(program_path('test.txt'))):
        os.makedirs(os.path.dirname(program_path('test.txt')))
    if not os.path.exists(os.path.dirname(app_data_path('test.txt'))):
        os.makedirs(os.path.dirname(app_data_path('test.txt')))
    if not os.path.exists(os.path.dirname(temp_path('test.txt'))):
        os.makedirs(os.path.dirname(temp_path('test.txt')))

    from gui.main_window import MainWindow

    window = MainWindow(app)
    window.show()
    splash.finish(window)
    sys.exit(app.exec_())
Ejemplo n.º 5
0
 def start(self):
     self._manager = Manager()
     settings.load()
     downloads_file.load()
     self._main_window = MainWindow(self._manager)
     self._main_window.start()
     downloads_file.save()
     settings.save()
Ejemplo n.º 6
0
def _main():
    # Must assign an instance of QApplication to a variable otherwise a Segmentation Fault will occur.
    app = QApplication(sys.argv)
    # Must assign an instance of MainWindow to a variable otherwise the main window won't display.
    main_window = MainWindow(sys.argv[1])

    main_window.show()
    # Keep the program running.
    sys.exit(app.exec_())
Ejemplo n.º 7
0
def main():
    '''Main loop which initialises embedder application'''

    app = QtGui.QApplication(sys.argv)

    w = MainWindow()
    w.show()

    sys.exit(app.exec_())
Ejemplo n.º 8
0
class SEASideApp:
    def __init__(self):
        self._app = QApplication(sys.argv)
        self._w = MainWindow()
        self._w.setWindowIcon(QtGui.QIcon(resource_path("icons/icon.ico")))

    def run(self):
        self._w.show()
        self._app.exec_()
Ejemplo n.º 9
0
    def __init__(self):
        self.root = tk.Tk()

        self.size = tk.StringVar()
        self.num_mines = tk.StringVar()
        self.size.set(6)
        self.num_mines.set(3)

        self.model = Game(int(self.size.get()), int(self.num_mines.get()))
        self.view = MainWindow(self.root, self.model, self.reveal_field, self.reset_game, self.size, self.num_mines)
Ejemplo n.º 10
0
 def open_existing_project(self):
     try:
         project = self.open_project()
         self.main_window = MainWindow(self.ctx, project)
         self.main_window.show()
         self.close()
     except UserCancelledError:
         return
     except Exception as e:
         show_error(e)
Ejemplo n.º 11
0
class GUI:
    def __init__(self, fslapp):
        self.fslapp = fslapp
        self.app = QApplication([])
        self.main_window = MainWindow(self)

    def start(self):
        """ BLOCKING """
        self.main_window.show()
        self.app.exec_()
Ejemplo n.º 12
0
def bootstrap():
    '''Launches the GUI'''
    global main_window

    if (main_window != None):
        return

    from gui.main_window import MainWindow
    main_window = MainWindow()
    main_window.mainloop()
Ejemplo n.º 13
0
def main():
    sys._excepthook = sys.excepthook

    def my_exception_hook(exctype, value, traceback):
        print(exctype, value, traceback)
        sys._excepthook(exctype, value, traceback)
        sys.exit(1)

    sys.excepthook = my_exception_hook

    app = QApplication(sys.argv)
    w = MainWindow()
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 14
0
class Controller:
    def __init__(self):
        self.root = tk.Tk()

        self.size = tk.StringVar()
        self.num_mines = tk.StringVar()
        self.size.set(6)
        self.num_mines.set(3)

        self.model = Game(int(self.size.get()), int(self.num_mines.get()))
        self.view = MainWindow(self.root, self.model, self.reveal_field, self.reset_game, self.size, self.num_mines)

    def run(self):
        self.root.title("Minesweeper")
        self.root.deiconify()
        self.root.mainloop()

    def reset_game(self):
        try:
            self.model = Game(int(self.size.get()), int(self.num_mines.get()))
        except ValueError:
            self.model = Game()

        self.view.reset_view(self.model, self.reveal_field)

    def game_over(self):
        if self.model.victory:
            play_again = tkMessageBox.askyesno("Game over", "Congratulations, you won! Do you want to play again?")
            if play_again:
                self.reset_game()
            else:
                sys.exit()
        else:
            play_again = tkMessageBox.askyesno("Game over", "You're a loser! Do you want to play again?")
            if play_again:
                self.reset_game()
            else:
                sys.exit()

    def reveal_field(self, x_coord, y_coord):
        # Update the model
        revealed = self.model.reveal_field(x_coord, y_coord)

        # Update the view
        self.view.update_game_view(revealed)

        # Check if game is over
        if self.model.gameOver:
            self.game_over()
Ejemplo n.º 15
0
 def __init__(self, parent=None):
     QtWidgets.QMainWindow.__init__(self, parent=parent)
     self.ui = MainWindow()
     self.ui.setup_ui(self)
     # self.ui.mdiArea.subWindowActivated.connect(self.updateMenus)
     self.ui.windowMapper.mapped[QWidget].connect(self.setActiveSubWindow)
     self.ui.choice_interface.triggered.connect(self.newFile)
     self.ui.exit_action.triggered.connect(qApp.quit)
     self.threadpool = QThreadPool()
     self.ui.open_act.triggered.connect(self.open)
     self.ui.save_act.triggered.connect(self.save)
     self.ui.save_as_act.triggered.connect(self.saveAs)
     # self.ui.new_act.triggered.connect()
     self.ui.cut_act.triggered.connect(self.cut)
     self.ui.copy_act.triggered.connect(self.copy)
     self.ui.paste_act.triggered.connect(self.paste)
Ejemplo n.º 16
0
    def setUp(self):
        super().setUp()
        panels.add("a")
        panels.add("b")
        panels.hide("b")
        panels.add("c")

        categories.add("cat1")
        categories.add("cat2")
        products.add("prod1_cat1", category_name="cat1")
        products.add("prod2_cat1", category_name="cat1")
        products.add("prod1_cat2", category_name="cat2")
        products.add("prod2_cat2", category_name="cat2")

        self.default_products_tree = [{
            ('cat1', ): [{
                ('prod1_cat1', ): []
            }, {
                ('prod2_cat1', ): []
            }]
        }, {
            ('cat2', ): [{
                ('prod1_cat2', ): []
            }, {
                ('prod2_cat2', ): []
            }]
        }]
        self.main = MainWindow()
        self.menu = MenuBar(self.main)
        self.win = PanelsManagementWindow(self.menu)
Ejemplo n.º 17
0
class SplashScreen(QtWidgets.QMainWindow):
    def __init__(self, ctx):
        super(SplashScreen, self).__init__()
        self.ctx = ctx
        self.main_window = None
        uic.loadUi(ctx.get_resource("ui/splash_screen.ui"), self)
        self.setWindowIcon(QtGui.QIcon(ctx.get_resource("Icon.ico")))

        self.create_new_project_button.clicked.connect(self.create_new_project)
        self.open_existing_project_button.clicked.connect(
            self.open_existing_project)
        self.exit_button.clicked.connect(self.exit)

    def create_new_project(self):
        # TODO create a new file?
        project = {"path": "tmp.eproj"}

        self.main_window = MainWindow(self.ctx, project)
        self.main_window.show()
        self.close()

    # move code to project service?
    def open_project(self):
        project_file = QtWidgets.QFileDialog.getOpenFileName(
            self, "Projektdatei auswählen.", "C:\\",
            "Edaid Project Files (*.eproj)")
        if project_file:
            if project_file[0]:
                # TODO open the project. Check if there are settings inside.
                return {"path": project_file[0]}
            else:
                raise UserCancelledError("User pressed the cancel button.")
        raise FileNotFoundError

    def open_existing_project(self):
        try:
            project = self.open_project()
            self.main_window = MainWindow(self.ctx, project)
            self.main_window.show()
            self.close()
        except UserCancelledError:
            return
        except Exception as e:
            show_error(e)

    def exit(self):
        self.close()
Ejemplo n.º 18
0
def launch_gui():
    import gi
    gi.require_version('Gtk', '3.0')
    from gi.repository import Gtk, GdkPixbuf, GObject, GLib
    from gui.main_window import MainWindow

    main_window = MainWindow()
    Gtk.main()
Ejemplo n.º 19
0
class CinemolApp(object):
    def __init__(self):
        pass

    def launch(self):
        self.app = QApplication(sys.argv)
        self.app.setOrganizationName("rotatingpenguin.com")
        self.app.setApplicationName("Cinemol")
        self.mainWin = MainWindow()
        self.renderer = CinemolRenderer()
        # self.renderer.actors.append(Sphere2TestScene())
        self.renderer.actors.append(FiveBallScene())
        # self.renderer.actors.append(TeapotActor())
        self.mainWin.ui.glCanvas.set_gl_renderer(self.renderer)
        console_context.cm._set_app(self)
        self.mainWin.show()
        sys.exit(self.app.exec_())
Ejemplo n.º 20
0
    def __init__(self):
        '''
        Constructor
        '''
        main_window = MainWindow()
        self.dialog_new_game = QDialog()
        self.ui = Ui_DialogNewGame()
        self.ui.setupUi(self.dialog_new_game)

        self.user_input = UserInput(main_window, self)
        self.board = None
        self.over = False
        self.ai_player = None

        self.new_game()

        main_window.show()
Ejemplo n.º 21
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.settings_model = SettingsModel()
     self.manager_model = manager_model.Model(
         self.settings_model.get("DatabasePath"))
     self.queue_manager = queue_manager.QueueManager(self.manager_model)
     self.player_object = QMediaPlayer()
     self.player_object.setPlaylist(self.queue_manager)
     self.queue_manager.player_object = self.player_object
     self.main_window = MainWindow(self.settings_model, self.manager_model,
                                   self.queue_manager)
     self.queue_manager.player_widget = self.main_window.playerWidget
     self.main_window.playerWidget.queue_manager = self.queue_manager
     self.queue_manager.queue_widget = self.main_window.queueWidget
     self.main_window.queueWidget.queue_manager = self.queue_manager
     self.queue_manager.setup_signals()
     self.main_window.show()
Ejemplo n.º 22
0
    def __init__(self, days_to_run: List[int], start_hour: int,
                 start_minute: int, end_hour: int, end_minute: int,
                 cta_train_api_key: str, stop_id: int):
        self._mainWindow = MainWindow.get()
        super().__init__(days_to_run, start_hour, start_minute, end_hour,
                         end_minute, self._mainWindow, tk.NE, 25, 15)

        self._ctaTrainClient = CtaTrainClient(cta_train_api_key)
        self._stop_id = stop_id
Ejemplo n.º 23
0
    def __init__(self, days_to_run: List[int], start_hour: int,
                 start_minute: int, end_hour: int, end_minute: int, zip: str,
                 openweather_api_key: str):
        self._mainWindow = MainWindow.get()

        super().__init__(days_to_run, start_hour, start_minute, end_hour,
                         end_minute, self._mainWindow, tk.SW, 25, 15)

        self._openweatherClient = OpenweatherClient(openweather_api_key)
        self._zip = zip
Ejemplo n.º 24
0
 def __init__(self, days_to_run: List[int], start_hour: int,
              start_minute: int, end_hour: int, end_minute: int,
              unplash_api_key: str, orientation: str,
              unsplash_collections: list):
     super().__init__(days_to_run, start_hour, start_minute, end_hour,
                      end_minute)
     self._unsplashClient = UnsplashClient(unplash_api_key)
     self._mainWindow = MainWindow.get()
     self._orientation = orientation
     self._photoImage = None
     self._backgroundImage = None
     self._collections = unsplash_collections
Ejemplo n.º 25
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.stacked_widget = QtWidgets.QStackedWidget()
        self.setCentralWidget(self.stacked_widget)

        self.m_pages = {}

        ten_o_pitches_window = TenOPitchesWindow()
        self.register(ten_o_pitches_window.instruction_window,
                      "ten_o_pitches_instruction_page")
        self.register(ten_o_pitches_window.main_window, "ten_o_pitches_page")
        self.register(ten_o_pitches_window.generator_window,
                      "ten_o_pitches_generator_page")
        self.register(ten_o_pitches_window.setting_window,
                      "ten_o_pitches_settings_page")

        intervals_window = IntervalsWindow()
        self.register(intervals_window.instruction_window,
                      "intervals_instruction_page")
        self.register(intervals_window.main_window, "intervals_page")
        self.register(intervals_window.generator_window,
                      "intervals_generator_page")
        self.register(intervals_window.setting_window,
                      "intervals_settings_page")

        voices_window = VoicesWindow()
        self.register(voices_window.instruction_window,
                      "voices_instruction_page")
        self.register(voices_window.main_window, "voices_page")
        self.register(voices_window.generator_window, "voices_generator_page")
        self.register(voices_window.setting_window, "voices_settings_page")

        microtones_window = MicrotonesWindow()
        self.register(microtones_window.instruction_window,
                      "microtones_instruction_page")
        self.register(microtones_window.main_window, "microtones_page")
        self.register(microtones_window.generator_window,
                      "microtones_generator_page")
        self.register(microtones_window.setting_window,
                      "microtones_settings_page")

        detuning_window = DetuningWindow()
        self.register(detuning_window.instruction_window,
                      "detuning_instruction_page")
        self.register(detuning_window.main_window, "detuning_page")
        self.register(detuning_window.generator_window,
                      "detuning_generator_page")
        self.register(detuning_window.setting_window, "detuning_settings_page")

        self.register(MainWindow(voices_window=voices_window), "main_page")

        self.goto("main_page")
Ejemplo n.º 26
0
def main(args, data_logger):
    devices = []
    try:
        if args.devices is not None:
            devices = files.read_device_list(args.devices)
    except FileNotFoundError:
        LOGGER.error(f'No such file: {args.devices}')
    except ValueError:
        LOGGER.error(f'Failed to parse device list')

    win = MainWindow(devices, data_logger)
    win.connect('destroy', Gtk.main_quit)
    if args.profile is not None:
        win.set_profile(args.profile, None)
    win.show_all()
    Gtk.main()
Ejemplo n.º 27
0
def run(args):

    #if img_symlink_dir:

        #print 'creating image symlinks...'

        #if not os.path.isdir(img_symlink_dir):
            #os.mkdir(img_symlink_dir)

        #for i in xrange(len(pdc.images)):

            #img = pdc.images[i]
            #imgId = img.index
            #imgFiles = img.imageFiles

            #for name,path in imgFiles:
                #symlink_name = '%04d_%s.tif' % (imgId, name)
                #symlink_path = os.path.join(img_symlink_dir, symlink_name)
                #os.symlink(path, symlink_path)

        #print 'finished creating image symlinks'

    TRY_OPENGL = args.opengl
    project_file = args.project_file
    start_pipeline = args.run_filtering

    app = QApplication(sys.argv)

    #mainwindow = MainWindow(simple_ui)
    mainwindow = MainWindow()
    mainwindow.show()

    if project_file:
        mainwindow.load_project_file(project_file)
        if start_pipeline:
            mainwindow.on_start_cancel()

    app.exec_()
    mainwindow.close()

    """importer = mainwindow.importer
Ejemplo n.º 28
0
    def start(self):
        settings.load_configuration()
        settings.set_window_manager(self.window_manager)
        self.window_manager.start()
        self.audio_manager.start()

        app = QApplication(sys.argv)
        main_window = MainWindow()

        if not QSystemTrayIcon.isSystemTrayAvailable():
            QMessageBox.critical(None, self.APP_NAME,
                                 "I couldn't detect any system tray on this system.")
            sys.exit(1)

        app.setQuitOnLastWindowClosed(False)

        window = TrayWindow(main_window)
        sys.exit(app.exec_())
#!/usr/bin/env python3

import wx

from gui.main_window import MainWindow

app = wx.App()

main_frame = MainWindow(None)
main_frame.Show()

app.MainLoop()
Ejemplo n.º 30
0
 def __init__(self):
     self._app = QApplication(sys.argv)
     self._w = MainWindow()
     self._w.setWindowIcon(QtGui.QIcon(resource_path("icons/icon.ico")))
Ejemplo n.º 31
0
def main():
    app = QtGui.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())
Ejemplo n.º 32
0
import sys

from PyQt5.QtWidgets import QApplication
from gui.main_window import MainWindow 

if __name__ == '__main__':
    """ Inicializa a aplicação, criando a janela principal. """
    
    app = QApplication(sys.argv)
    w = MainWindow()
    sys.exit(app.exec_())
Ejemplo n.º 33
0
from PyQt4 import QtGui
from gui.main_window import MainWindow
import sys
from gui.direct_view_window import DirectViewWindow, DirectViewer

'''
Later configure from here in some code lines: GUI On GUI off, want to have view x and view y

maybe a api for gui ?

'''

q_app = QtGui.QApplication(sys.argv)       
gui = MainWindow()
# a = NewSimulationWindow(gui)
gui.show()
        
# sys.exit(q_app.exec_())
Ejemplo n.º 34
0
    parser = argparse.ArgumentParser(description="Koshka - MSP project")

    parser.add_argument("score", nargs="?", type=str, default=DEFAULT_SCORE_FILE)
    parser.add_argument("--no_gui", type=bool, default=False, const=True, nargs="?")
    parser.add_argument("-l", "--loop", type=int, default=0, const=GridSequencer.INFINIT_LOOP, nargs="?")
    namespace = parser.parse_args()

    if namespace.no_gui:
        dac = DAC()
        dac.start()
        try:
            sequencer = GridSequencer(namespace.score, buffer_size=dac.bufferSize, sample_rate=dac.getSamplerate())
            dac.connect(sequencer.callback)
            sequencer.play(namespace.loop)

            while sequencer.running:
                sleep(0.1)

        finally:
            dac.stop()

    else:
        from gui.main_window import MainWindow

        window = MainWindow(namespace)

        window.mainloop()
        window = None

    exit()
Ejemplo n.º 35
0
#! /bin/python

from PyQt5.QtWidgets import *
from gui.frist_dialog import FirstDialog
from gui.main_window import MainWindow


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    dialog = FirstDialog()
    dialog.setModal(True)
    if dialog.exec() == QDialog.Accepted:
        main_window = MainWindow(file=dialog.get_log_path())
        main_window.show()
    else:
        sys.exit(0)
    sys.exit(app.exec_())
Ejemplo n.º 36
0
def initialise_gui(obj, data):
    app = QtGui.QApplication(sys.argv)
    window = MainWindow(data, obj)
    window.show()
    app.exec_()
Ejemplo n.º 37
0
from example_interactive_water_particles.water_particle import WaterParticle
from gui.input_listeners.game_like_input_listener import GameLikeInputListener
from gui.main_window import MainWindow
from gui.paintables.paintable_polyhedron import PaintablePolyhedron
from physics.force_generator.gravity_force_generator import GravityForceGenerator
from physics.physics_simulator import PhysicsSimulator


# Controls the number of simulated particles.
N_PARTICLES = 500


if __name__ == '__main__':
    main_window = MainWindow("Water Particles Example", 400, 400)
    main_window.setInputListener(GameLikeInputListener(main_window))

    simulator = PhysicsSimulator()
    for i in xrange(N_PARTICLES):
        # Add particle to simulator
        particle = WaterParticle()
        simulator.addForceGenerator(GravityForceGenerator(particle))
        simulator.addBody(particle)
        # Add particle to scene
        particle_painter = PaintablePolyhedron(particle.geometry)
        main_window.addObject(particle_painter)

    main_window.addBeforeDrawSceneCallback(simulator.update)
    main_window.mainLoop()
Ejemplo n.º 38
0
from gui.main_window import MainWindow
import resources.resources_rcc

if __name__ == '__main__':
    import sys
    from PyQt5.QtWidgets import QApplication

    app = QApplication(sys.argv)
    app.setOrganizationName("Sonance")
    app.setApplicationName("Sonance")
    
    player = MainWindow()
    player.show()

    sys.exit(app.exec_())
Ejemplo n.º 39
0
import shutil

from example_rendered_water_particles.clip_generator import SimulationClipGenerator
from example_rendered_water_particles.simulation_parameters import SIMULATION_TIMESTEP, \
    SIMULATION_N_PARTICLES, OUTPUT_FILE_PATH, TMP_FOLDER
from example_rendered_water_particles.water_particle import WaterParticle
from gui.main_window import MainWindow
from gui.paintables.paintable_polyhedron import PaintablePolyhedron
from physics.delta_t_calculators import FixedDeltaTCalculator
from physics.force_generator.gravity_force_generator import GravityForceGenerator
from physics.physics_simulator import PhysicsSimulator


if __name__ == '__main__':
    main_window = MainWindow('Water Particles Example', 400, 400)
    main_window.calculateDeltaT = FixedDeltaTCalculator(delta_t=SIMULATION_TIMESTEP)
    simulator = PhysicsSimulator()
    for i in xrange(SIMULATION_N_PARTICLES):
        # Add particle to simulator
        particle = WaterParticle()
        simulator.addForceGenerator(GravityForceGenerator(particle))
        simulator.addBody(particle)
        # Add particle to scene
        particle_painter = PaintablePolyhedron(particle.geometry)
        main_window.addObject(particle_painter)

    main_window.addBeforeDrawSceneCallback(simulator.update)
    simulation_clip_generator = SimulationClipGenerator(main_window)
    simulation_clip_generator.generateClip(OUTPUT_FILE_PATH)

    # Comment this line if you want to see the generated frames in the TMP_FOLDER
Ejemplo n.º 40
0
    logging.basicConfig(level=logging.DEBUG)
    app = QtGui.QApplication(sys.argv)
    QtGui.QFontDatabase.addApplicationFont('media/fonts')
    app.setStyle(QtGui.QStyleFactory.create('Plastique'))
    app.setWindowIcon(QtGui.QIcon('icons/copper_icon.png'))

    # Create and display the splash screen
    splash_pix = QtGui.QPixmap('media/splash_screen.png')
    splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.show()
    app.processEvents()

    # Create main window
    from gui.main_window import MainWindow
    
    window = MainWindow()
    window.load_style()

    # Move main window to desktop center
    desktop = QtGui.QApplication.desktop()
    screenWidth = desktop.width()
    screenHeight = desktop.height()
    x = (screenWidth - window.width()) / 2
    y = (screenHeight - window.height()) / 2
    window.move(x, y)

    # Show main window
    window.show()
    splash.finish(window)
    window.raise_()
    window.activateWindow()
Ejemplo n.º 41
0
from physics.particle import Particle
from physics.physics_simulator import PhysicsSimulator
from readers.ply_reader import readPly
import numpy as np


def createParticle(mass, color):
    particle = Particle(mass)
    particle.setGeometry(readPly('../objects/sphere.ply'))
    particle.geometry.scale(np.repeat(mass / 2.0, 3))
    particle.geometry.setColor(color)
    return particle


if __name__ == '__main__':
    main_window = MainWindow("Spring Example", 400, 400)
    main_window.setInputListener(GameLikeInputListener(main_window))

    simulator = PhysicsSimulator()

    particle1 = createParticle(0.1, np.array([0.6, 0.2, 0.6]))
    particle2 = createParticle(0.5, np.array([0.2, 0.6, 0.6]))
    particle3 = createParticle(0.2, np.array([0.8, 0.2, 0.2]))

    simulator.addBody(particle1)
    simulator.addBody(particle2)
    simulator.addBody(particle3)

    main_window.addObject(PaintablePolyhedron(particle1.geometry))
    main_window.addObject(PaintablePolyhedron(particle2.geometry))
    main_window.addObject(PaintablePolyhedron(particle3.geometry))
Ejemplo n.º 42
0
 def __init__(self, fslapp):
     self.fslapp = fslapp
     self.app = QApplication([])
     self.main_window = MainWindow(self)
Ejemplo n.º 43
0
import os
import sys

try:
    # try to import GTK
    import pygtk
    pygtk.require20()
    import gtk

except:
    # print error and die
    print "Error starting My File Manager, missing GTK 2.0+"
    sys.exit(1)

# add search path
path_application = os.path.abspath(os.path.dirname(sys.argv[0]))
sys.path.insert(1, path_application)

# initialise threads
gtk.gdk.threads_init()

# change working directory
os.chdir(os.path.dirname(path_application))

# construct main application object
from gui.main_window import MainWindow

app = MainWindow()
app.run()