Beispiel #1
0
def main():
    w = world.World()
    w.parse_and_add('zones.yaml')
    window = ui.MainWindow()
    window.show_all()
    window.setWorld(w)
    Gtk.main()
Beispiel #2
0
    def __init__(self):
        app = wx.App()
        self.window = ui.MainWindow(parent=None, id=wx.ID_ANY)
        self.window.Show()

        #read unlocked level
        try:
            f = open("unlocked_level.txt", 'r')
        except IOError:
            self.unlocked_level = 1
        else:
            self.unlocked_level = int(f.readline())
            f.close()

        self.load_level(self.get_max_available_level())
        self.window.set_level_list(self.get_max_available_level(),
                                   self.current_level)
        self.update_next_button()

        self.window.Bind(wx.EVT_BUTTON, self.check, self.window.check_button)
        self.window.Bind(wx.EVT_BUTTON, self.load_next_level,
                         self.window.next_button)
        self.window.Bind(wx.EVT_CHOICE, self.change_level,
                         self.window.level_selector)

        app.MainLoop()
Beispiel #3
0
def main(argv=None):
    app = QApplication(argv)
    app.setApplicationName("Timer")

    # Create the main window.
    window = ui.MainWindow()
    window.show()

    # Run the application.
    return app.exec_()
Beispiel #4
0
    def __init__(self, img_path):

        self.ui = ui.MainWindow(800, 600)

        self.ui.connect('load_image', self._load_image)
        self.ui.connect('exit', self.exit)
        self.ui.connect('hflip', self.flip_horizontal)
        self.ui.connect('vflip', self.flip_vertical)
        self.ui.connect('grayscale', self.grayscale)

        if img_path:
            self.load_image(img_path)
            self.ui.update_image(self.img.pixbuf)

        self.ui.show()
Beispiel #5
0
def main():
    logging.basicConfig(format='[%(levelname)s] %(message)s', level='INFO')

    parser = argparse.ArgumentParser(
        description="Simple ISMRMRD data file viewer.")
    parser.add_argument('file', type=str, nargs='?', help="ISMRMRD data file.")
    args = parser.parse_args()

    app = QtWidgets.QApplication(sys.argv)
    app.setApplicationName("ismrmrd-viewer")

    main = ui.MainWindow()
    main.resize(800, 600)
    main.show()

    if args.file:
        main.open_file(args.file)

    sys.exit(app.exec_())
Beispiel #6
0
import ui
if __name__ == '__main__':
    win=ui.MainWindow()
    win.mainloop()
    
Beispiel #7
0
# -*- coding: utf-8 -*-
import ui
from core import logger
from core.item import Item
from core import config
import xbmc

logger.info("pelisalacarta 4 ui begin")
config.verify_directories_created()
# Open main window
ui.MainWindow("MainWindow.xml", config.get_runtime_path()).Start()
import sys
from PySide2.QtCore import Qt, Slot
from PySide2.QtGui import QPainter
from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
                               QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
                               QVBoxLayout, QWidget, QFileDialog, QTextEdit, QTabWidget)
from PySide2.QtCharts import QtCharts

from pdfminer.layout import LAParams, LTTextBox
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator

import  ui, pdf_actions

if __name__ == "__main__":
    # Qt Application
    app = QApplication(sys.argv)
    # QWidget
    widget = ui.Widget()
    # QMainWindow using QWidget as central widget
    window = ui.MainWindow(widget)
    window.resize(800, 600)
    window.show()

    # Execute application
    sys.exit(app.exec_())
Beispiel #9
0
import sys
import ui
from PyQt5.QtWidgets import (QApplication)

if __name__ == '__main__':

    app = QApplication(sys.argv)
    ex = ui.MainWindow()
    sys.exit(app.exec_())
Beispiel #10
0
def main():
    application = QtGui.QApplication(sys.argv)
    window = ui.MainWindow()
    sys.exit(application.exec_())
Beispiel #11
0
def main():
    # Set up GPIO
    GPIO.setmode(GPIO.BCM)
    #GPIO.setwarnings(False)
    GPIO.setup(PIN.YELLOW_LED, GPIO.OUT)
    GPIO.setup(PIN.BLUE_LED, GPIO.OUT)
    GPIO.setup(PIN.MOTOR, GPIO.OUT)
    GPIO.setup(PIN.WATER_PUMP, GPIO.OUT)

    GPIO.setup(PIN.PUSH_BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(PIN.WATER_LEVEL_SENSOR, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

    ### initialize software modals of connected gpio hardwares ###

    settings = db.get_setting()  #user settings

    # Lid
    lid = Lid(PIN.PUSH_BUTTON)
    GPIOController.add_component(lid)

    # Lights
    main_light = LED(PIN.YELLOW_LED)
    main_light.timer = LightTimer(main_light, settings["light_hour"],
                                  settings["light_duration"])
    GPIOController.add_component(main_light)

    secondary_light = LED(PIN.BLUE_LED)
    GPIOController.add_component(secondary_light)

    # Temperature Sensor
    tsensor = temperature.TemperatureSensor(PIN.TEMPERATURE_SENSOR)
    GPIOController.add_component(tsensor)

    # Water Sensor
    wsensor = water.WaterSensor(PIN.WATER_LEVEL_SENSOR)
    GPIOController.add_component(wsensor)

    # Pump
    wpump = pump.WaterPump(PIN.WATER_PUMP)
    GPIOController.add_component(wpump)

    # Motor
    motr = motor.Motor(*PIN.MOTOR, enable_timer=True)
    GPIOController.add_component(motr)

    # Lid open/close event listen
    GPIO.add_event_detect(lid.pin, GPIO.BOTH, callback=lid.open_close)

    try:
        # start QT UI
        sargv = sys.argv + ['-style', 'material']
        app = QGuiApplication(sargv)
        font = QFont()
        font.setFamily("Ariel")

        app.setFont(font)
        # manually detect lid open close event from the start
        lid.open_close()

        slots.syncdb()

        # Instantiate the UI
        UIController.MAIN_UI = ui.MainWindow()
        print("UI inited")
        UIController.MAIN_UI.root.show()
        if os.name == "posix" and os.uname().nodename.startswith(
                "raspberrypi"):
            UIController.MAIN_UI.root.showFullScreen()

        # Start threads and timers
        tsensor.start()
        slots.REFRESH_TIMER.activate()
        main_light.timer.activate()
        wpump.timer.activate()
        motr.timer.activate()

        # init UI data status for correct icon display
        UIController.MAIN_UI.root.setMainLightStatus(main_light.status)

        ret = app.exec_()

        # Teminate
        sys.exit(ret)

    finally:
        # cleanup and deactive timers
        slots.REFRESH_TIMER.deactivate()
        wpump.timer.deactivate()
        main_light.timer.deactivate()
        motr.timer.deactivate()
        motr.pwm.stop()

        GPIO.cleanup()
Beispiel #12
0
  def __init__(self, parent = None):
    super(MCLogUI, self).__init__(parent)
    self.__init__ui = ui.MainWindow()
    self.ui = ui.MainWindow()

    self.ui.setupUi(self)

    self.tab_re = re.compile('^Plot [0-9]+$')

    self.data = {}

    self.gridStyles = {'left': LineStyle(), 'right': LineStyle(linestyle = ':') }
    self.gridStyleFile = os.path.expanduser("~") + "/.config/mc_log_ui/grid_style.json"
    if os.path.exists(self.gridStyleFile):
      with open(self.gridStyleFile) as f:
        data = json.load(f)
        for k in self.gridStyles.keys():
          if k in data:
            self.gridStyles[k] = LineStyle(**data[k])
    UserPlot.__new__.__defaults__ = (self.gridStyles['left'], self.gridStyles['right'], {}, {}, GraphLabels(), {})

    self.robotFile = os.path.expanduser("~") + "/.config/mc_log_ui/robot"
    self.userPlotFile = os.path.expanduser("~") + "/.config/mc_log_ui/custom_plot.json"
    self.userPlotList = load_UserPlots(self.userPlotFile)
    self.update_userplot_menu()

    self.activeRobotAction = None
    self.rm = None
    if mc_rbdyn is not None:
      rMenu = QtGui.QMenu("Robot", self.ui.menubar)
      rGroup = QtGui.QActionGroup(rMenu)
      rCategoryMenu = {}
      rActions = []
      for r in mc_rbdyn.RobotLoader.available_robots():
        rAct = RobotAction(r, rGroup)
        rAct.setCheckable(True)
        rGroup.addAction(rAct)
        if '/' in r:
          category, name = r.split('/', 1)
          if not category in rCategoryMenu:
            rCategoryMenu[category] = QtGui.QMenu(category)
          rAct.setText(name)
          rAct.actual(r)
          rCategoryMenu[category].addAction(rAct)
        else:
          rActions.append(rAct)
      rMenu.addActions(rActions)
      for category in sorted(rCategoryMenu):
          rMenu.addMenu(rCategoryMenu[category])
      defaultBot = self.getDefaultRobot()
      if defaultBot in mc_rbdyn.RobotLoader.available_robots():
        actionIndex = mc_rbdyn.RobotLoader.available_robots().index(defaultBot)
        defaultBot = rGroup.actions()[actionIndex]
      else:
        defaultBot = rGroup.actions()[0]
      self.activeRobotAction = defaultBot
      self.activeRobotAction.setChecked(True)
      self.setRobot(self.activeRobotAction)
      self.connect(rGroup, QtCore.SIGNAL("triggered(QAction *)"), self.setRobot)
      self.ui.menubar.addMenu(rMenu)

    self.styleMenu = QtGui.QMenu("Style", self.ui.menubar)

    # Line style menu
    self.lineStyleMenu = QtGui.QMenu("Graph", self.styleMenu)
    def fillLineStyleMenu(self):
      self.lineStyleMenu.clear()
      canvas = self.getCanvas()
      def makePlotMenu(self, name, plots, style_fn):
        if not len(plots):
          return
        menu = QtGui.QMenu(name, self.lineStyleMenu)
        group = QtGui.QActionGroup(act)
        action = QtGui.QAction("All", group)
        action.triggered.connect(lambda: AllLineStyleDialog(self, name, self.getCanvas(), plots, style_fn).exec_())
        group.addAction(action)
        sep = QtGui.QAction(group)
        sep.setSeparator(True)
        group.addAction(sep)
        for y in plots:
          style = style_fn(y)
          action = QtGui.QAction(style.label, group)
          action.triggered.connect(lambda yin=y,stylein=style: LineStyleDialog(self, yin, self.getCanvas(), stylein, style_fn).exec_())
          group.addAction(action)
        menu.addActions(group.actions())
        self.lineStyleMenu.addMenu(menu)
      makePlotMenu(self, "Left", canvas.axes_plots.keys(), canvas.style_left)
      makePlotMenu(self, "Right", canvas.axes2_plots.keys(), canvas.style_right)
    self.lineStyleMenu.aboutToShow.connect(lambda: fillLineStyleMenu(self))
    self.styleMenu.addMenu(self.lineStyleMenu)

    # Grid style menu
    self.gridStyleMenu = QtGui.QMenu("Grid", self.styleMenu)
    self.gridDisplayActionGroup = QtGui.QActionGroup(self.gridStyleMenu)
    self.gridDisplayActionGroup.setExclusive(True)
    self.leftGridAction = QtGui.QAction("Left", self.gridDisplayActionGroup)
    self.leftGridAction.triggered.connect(lambda: GridStyleDialog(self, "left", self.getCanvas(), self.getCanvas().grid).exec_())
    self.gridDisplayActionGroup.addAction(self.leftGridAction)
    self.rightGridAction = QtGui.QAction("Right", self.gridDisplayActionGroup)
    self.rightGridAction.triggered.connect(lambda: GridStyleDialog(self, "right", self.getCanvas(), self.getCanvas().grid2).exec_())
    self.gridDisplayActionGroup.addAction(self.rightGridAction)
    self.gridStyleMenu.addActions(self.gridDisplayActionGroup.actions())
    self.styleMenu.addMenu(self.gridStyleMenu)

    # Labels
    self.titleAction = QtGui.QAction("Labels/Title/Fonts", self.styleMenu)
    self.titleAction.triggered.connect(lambda: LabelsTitleEditDialog(self, self.getCanvas()).exec_())
    self.styleMenu.addAction(self.titleAction)

    self.ui.menubar.addMenu(self.styleMenu)

    self.toolsMenu = QtGui.QMenu("Tools", self.ui.menubar)
    act = QtGui.QAction("Dump qOut to seqplay", self.toolsMenu)
    act.triggered.connect(DumpSeqPlayDialog(self).exec_)
    self.toolsMenu.addAction(act)
    self.ui.menubar.addMenu(self.toolsMenu)

    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_O, self.shortcutOpenFile)
    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_W, self.shortcutCloseTab)
    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_PageDown, self.shortcutNextTab)
    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_PageUp, self.shortcutPreviousTab)
    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_T, self.shortcutNewTab)
    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_S, self.save_userplot)
    self.addApplicationShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_A, self.shortcutAxesDialog)
Beispiel #13
0
# With regards to the grid, let it be said that if we're referencing it
# using the grid[x][y] syntax, it will be rotated 90 degrees when printed.
# Logically, it will function the same it just may be a little confusing
# when trying to read the sudoku in printed form

# Module Imports
import sys
from PyQt5 import QtWidgets

# Local Imports
import ui

app = QtWidgets.QApplication(sys.argv)  # Create the base QT Application.
window = ui.MainWindow()  # Create the MainWindow class.

grid = []
for i in range(0, 9):
    grid.append([None, None, None, None, None, None, None, None, None])

def solve():
    for x, grid_column in enumerate(grid):  # Go through the columns of the grid.
        for y in range(len(grid_column)):  # Go through the individual numbers in the column.
            grid_value = window.get_grid_value(x, y)  # Get the value on the UI.
            if grid_value == "":  # If it is blank...
                grid_column[y] = None  # ...put nothing...
            else:  # ...or if there is something...  ( We don't need to validate because we do that in the UI. )
                grid_column[y] = int(grid_value)  # ...put the number in.
    print( grid )
    return

window.solveButton.clicked.connect(solve)  # Attach the solve function to the button on the UI.
Beispiel #14
0
 def setUp(self):
     bk = MagicMock(spec_set=BookContainer)
     self.root = ui.MainWindow(bk)
     self.root.withdraw(
     )  # call root.deiconify followed by pump_events in tests to make the GUI visible
     self.pump_events()
Beispiel #15
0
def window():
    app = QApplication(sys.argv)
    win = ui.MainWindow()

    win.show()
    sys.exit(app.exec_())
Beispiel #16
0
 def __init__(self):
     self.control = Controller()
     self.mWin = ui.MainWindow(self.control)
Beispiel #17
0
def run(bk):
    plug = ui.MainWindow(bk)
    plug.mainloop()
    return 0 if plug.success else 1
Beispiel #18
0
 def show_main(self, site_list_in_excel):
     self.main_window = ui.MainWindow(site_list_in_excel)
     self.main_window.EXECUTION.connect(self.show_table)
     self.main_window.DOWNLOAD.connect(self.make_sitemap_file)
     self.main_window.show()
Beispiel #19
0
 def __init__(self):
     self.m_con = Controller()
     self.m_win = ui.MainWindow(self.m_con)