Пример #1
0
 def initialize(self):
     self.w1 = Window(5,
                      5,
                      15,
                      15,
                      title='Window 1',
                      framed=True,
                      window_manager=self.window_manager)
     self.w2 = Window(10,
                      10,
                      20,
                      30,
                      title='Window 2',
                      framed=True,
                      window_manager=self.window_manager)
     self.list_view = ListWindow(tlx=15,
                                 tly=15,
                                 width=20,
                                 height=5,
                                 title='List Window',
                                 framed=True,
                                 window_manager=self.window_manager)
     self.list_view.add_item('An item.', 'An item.')
     self.list_view.add_item('Another item.', 'Uhuh.')
     self.list_view.add_item('Keep going.', 'Number.')
     self.list_view.add_item('Scrolling yet?', 'Scroll')
     self.list_view.add_item('last one', 'the end.')
Пример #2
0
def main(stdscr):
    test = Window(30, 30, 0, 0)
    while True:
        test.clear()
        test.add_str(0, 0,
                     "Lines: {} Colums: {}".format(curses.LINES, curses.COLS))
        test.add_str(1, 0, "{}".format(stdscr.getmaxyx()))
        stdscr.getkey()
Пример #3
0
 def __init__(self, beam_setup, root_frame):
     """Initialise the window"""
     self.window = Window(
         ROOT.gClient.GetRoot(),  # pylint: disable = E1101
         root_frame,
         SHARE_DIR + "twiss_setup.json")
     self.beam_setup = beam_setup
     self.window.set_button_action("&Okay", self.okay_action)
     self.window.set_button_action("&Cancel", self.cancel_action)
Пример #4
0
    def run():
        Log.log_application_name = "Test"
        Log.log("Starting...")
        window = Window()
        window.add_workspace(WsStart)
        window.add_workspace(WsTest)
        window.activate_workspace(WsStart)

        window.run()
Пример #5
0
 def __init__(self, main_window, parent):
     """Initialise the GUI window"""
     self.main_window = main_window
     self.parent = parent
     manipulators = {"magnet_setup_action": self.magnet_setup_action}
     self.window = Window(
         ROOT.gClient.GetRoot(),  # pylint: disable = E1101
         parent,
         data_file=self.share_dir + "magnet_setup.json",
         manipulator_dict=manipulators)
     self.window.set_button_action("&Okay", self.okay_action)
     self.window.set_button_action("&Cancel", self.cancel_action)
Пример #6
0
    def __init__(self, stdscr):
        curses.curs_set(0)
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_MAGENTA)

        self.clipbord = None
        self.tab_manager = Tab_manager(
            os.path.dirname(os.path.abspath(__file__)))
        self.stdscr = Window(curses.LINES, curses.COLS, 0, 0)
        self.stdscr.window = stdscr

        self.stdscr.refresh()
        self.parent_dir_widged = File_viewer(
            self.stdscr.x - 3,
            round(config.parent_dir_width * self.stdscr.y / 100), 1, 0,
            self.tab_manager.selected_tab.current_file.parent_dir,
            self.tab_manager.selected_tab.current_file)
        self.current_dir_widged = File_viewer(
            self.stdscr.x - 3,
            round(config.current_dir_width * self.stdscr.y / 100), 1,
            self.parent_dir_widged.y,
            self.tab_manager.selected_tab.current_file,
            self.tab_manager.selected_tab.selected_file, True)
        self.preview_widged = File_viewer(
            self.stdscr.x - 3, self.stdscr.y - self.parent_dir_widged.y -
            self.current_dir_widged.y - 1, 1,
            self.stdscr.y - (self.stdscr.y - self.parent_dir_widged.y -
                             self.current_dir_widged.y - 1),
            self.tab_manager.selected_tab.selected_file)
        self.statusbar = Statusbar(
            1, self.stdscr.y, 0, 0, getpass.getuser(), socket.gethostname(),
            self.tab_manager.selected_tab.current_file.path,
            self.tab_manager.tab_list)
        self.window_command = Window(1, self.stdscr.y, self.stdscr.x - 1, 0)
        self.window_info = Window(1, self.stdscr.y, self.stdscr.x - 2, 0)
        self.stdscr.refresh()

        #self.resize()
        self.stdscr.refresh()
        self.mainloop()
Пример #7
0
    def __init__(self, main_window, parent):
        """Initialise the window"""
        self.window = Window(
            ROOT.gClient.GetRoot(),  # pylint: disable = E1101
            parent,
            SHARE_DIR + "beam_setup.json")
        self.main_window = main_window
        self.parent = parent
        self.matrix_select = None
        self.matrix = None

        self.window.set_button_action("&Penn", self.penn_action)
        self.window.set_button_action("&Twiss", self.twiss_action)
        self.window.set_button_action("&Okay", self.okay_action)
        self.window.set_button_action("&Cancel", self.cancel_action)
def main():
    window, size = Window()
    sidebar = LoadSidebar(window)
    navigator = LoadNavigator(window, size)
    canvas, charts = LoadCanvas(window, size)

    status = StringVar(value=WAITING)  # 程序状态 1. 未开始 2. 计算中 3. 结果
    updateStatus = bindStatus(status)

    addLabel(navigator, status)
    addCommand(sidebar, COMPUTE_LABEL_P, startFetch(FETCH_P, updateStatus))
    addCommand(sidebar, COMPUTE_LABEL_V, startFetch(FETCH_V, updateStatus))
    addCommand(sidebar, CLEAR_LABEL, clearUI(updateStatus))
    addCommand(sidebar, SAVE_LABEL, save)
    addCommand(sidebar, UPLOAD_LABEL, upload)

    window.mainloop()
Пример #9
0
    def __init__(self):
        self.config_path = join_path('utils/config.json')
        font_id = Qt.QFontDatabase.addApplicationFont(
            join_path("static/iconfont.ttf"))
        self.ico_font = Qt.QFont(
            Qt.QFontDatabase.applicationFontFamilies(font_id)[0], 30)
        self.config = {}
        self.load_config()

        self.Setting = Setting(self)
        self.Window = Window(self)
        self.Tray = Tray(self)

        if self.config['show_setting_window']:
            self.Setting.show()
            self.config['show_setting_window'] = False
            self.dump_config()
Пример #10
0
 def __init__(self):
     """Initialise the main window"""
     self.window = Window(ROOT.gClient.GetRoot(), # pylint: disable=E1101
                          ROOT.gClient.GetRoot(), # pylint: disable=E1101
                          SHARE_DIR+"main_frame.json")
     self.lattice = Lattice()
     self.beam_setup = None
     self.magnet_setup = None
     self.plot_setup = None
     self.plot_setup_options = [{"variable_type":0,
                                 "first_var":0,
                                 "plot_apertures":True}]
     self.window.set_button_action("&Beam Setup", self.beam_button_action)
     self.window.set_button_action("&Magnet Setup",
                                                   self.magnet_button_action)
     self.window.set_button_action("&Plot Setup", self.plot_button_action)
     self.window.set_button_action("E&xit", self.exit_button_action)
     self.update_plot()
Пример #11
0
 def __init__(self, main_window, parent, selected):
     """
     Initialise the window
     """
     self.main_window = main_window
     self.parent = parent
     self.selected = selected
     self.window = Window(
         ROOT.gClient.GetRoot(),  # pylint: disable = E1101
         parent,
         self.share_dir + "plot_setup.json")
     for i, item in enumerate(self.selected):
         self.window.set_action("variable_type_" + str(i), "drop_down",
                                "Selected(Int_t)", self.select_action)
         type_frame = self.window.get_frame("variable_type_" + str(i),
                                            "drop_down")
         type_frame.Select(item["variable_type"])
     self.window.set_button_action("&Okay", self.okay_action)
     self.window.set_button_action("&Cancel", self.cancel_action)
Пример #12
0
def main():
    """main函数"""

    app = Window()
    queue = Queue()

    watcher.start()

    for _ in range(4):
        reg = Recognize(queue, watcher.original_cmd())
        reg.start()

    camera = CameraTools(queue, 8500)
    camera.start_monitor()

    board = BoardTools()
    board.start_monitor()

    app.show()
Пример #13
0
def main(stdscr):
    test = Window(10, 10, 0, 0)

    stdscr.getkey()

    for i in range(test.y):
        test.add_str(i, 0, "+" * test.x)

    test.refresh()

    stdscr.getkey()
    test.clear()
    test.offset_x = 15
    test.clear()
    for i in range(test.y):
        test.add_str(i, 0, "+" * test.x)
    test.refresh()

    stdscr.getkey()
Пример #14
0
 def __init__(self, datacards):
     """Initialise the main window"""
     self.last = datetime.datetime.now()
     self.window = Window(ROOT.gClient.GetRoot(), ROOT.gClient.GetRoot(),
                          SHARE_DIR + "online_gui.json")
     self._set_actions()
     self._docstore = None
     self._datacards = datacards
     self._draw_titles = Queue.Queue()
     for title in datacards["online_gui_default_canvases"]:
         self._draw_titles.put(title)
     self._canvases_read = Queue.Queue()
     self._canvases_draw = ThreadedValue([])
     self._redraw_target = None
     self._paused = ThreadedValue(False)
     rotate_tmp = self.window.get_text_entry("Rotate period", type(1.))
     self._rotate_period = ThreadedValue(rotate_tmp)
     reload_tmp = self.window.get_text_entry("Reload period", type(1.))
     self._reload_period = ThreadedValue(reload_tmp)
     self._poll_period = ThreadedValue(0.1)
     self._collections = ThreadedValue([])
     self._init_docstore()
     self._start_polling()
Пример #15
0
    def configure(self, parent):
        """ Show the configuration window """
        if self.cfgWin is None:
            from gui.window import Window

            self.cfgWin = Window('Covers.ui', 'vbox1', __name__,
                                 MOD_INFO[modules.MODINFO_L10N], 320, 265)
            self.cfgWin.getWidget('btn-ok').connect('clicked', self.onBtnOk)
            self.cfgWin.getWidget('img-lastfm').set_from_file(
                os.path.join(consts.dirPix, 'audioscrobbler.png'))
            self.cfgWin.getWidget('btn-help').connect('clicked',
                                                      self.onBtnHelp)
            self.cfgWin.getWidget('chk-downloadCovers').connect(
                'toggled', self.onDownloadCoversToggled)
            self.cfgWin.getWidget('btn-cancel').connect(
                'clicked', lambda btn: self.cfgWin.hide())

        if not self.cfgWin.isVisible():
            downloadCovers = prefs.get(__name__, 'download-covers',
                                       PREFS_DFT_DOWNLOAD_COVERS)
            preferUserCovers = prefs.get(__name__, 'prefer-user-covers',
                                         PREFS_DFT_PREFER_USER_COVERS)
            userCoverFilenames = prefs.get(__name__, 'user-cover-filenames',
                                           PREFS_DFT_USER_COVER_FILENAMES)

            self.cfgWin.getWidget('btn-ok').grab_focus()
            self.cfgWin.getWidget('txt-filenames').set_text(
                ', '.join(userCoverFilenames))
            self.cfgWin.getWidget('chk-downloadCovers').set_active(
                downloadCovers)
            self.cfgWin.getWidget('chk-preferUserCovers').set_active(
                preferUserCovers)
            self.cfgWin.getWidget('chk-preferUserCovers').set_sensitive(
                downloadCovers)

        self.cfgWin.show()
Пример #16
0
 def quick_actions(title):
     return Window(title, 3, 0, 0, 0, self)
Пример #17
0
 def main_window(title):
     return Window(title, -2, 0, 2, 0, self)
Пример #18
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from PyQt5 import QtWidgets

from gui.window import Window

if __name__ == "__main__":
    import sys

    app = QtWidgets.QApplication(sys.argv)
    w = Window()
    w.show()
    sys.exit(app.exec_())
Пример #19
0
 def OnInit(self):
     window = Window(title="MusicFun", size=(880, 480))
     window.Show()
     return True
Пример #20
0
 def plot_window_provider(title):
     return Window(title, 3, 4 + len("Plot"), 0, 5 + len("Back"),
                   self.window.internal_renderer)
Пример #21
0
 def run(self):
     logger.debug(f'{self.__class__.__name__} started')
     self.window = Window()
     logger.debug(f'{self.__class__.__name__} ready')
     self.window.work()
     logger.debug(f'{self.__class__.__name__} finished')
Пример #22
0
from gui.window import Window
from PyQt5.QtWidgets import QApplication
import sys


if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = Window()

    win.show()
    app.aboutToQuit.connect(lambda: win.back_to_login())

    sys.exit(app.exec_())
Пример #23
0
# /gui/main.py
import sys
from PyQt5.QtWidgets import QApplication
from gui.window import Window
from PyQt5.QtCore import QEventLoop, QTimer

number_of_lines = 7
number_of_cols = 8

app = QApplication(sys.argv)
win = Window(number_of_cols, number_of_lines)
win.display()
loop = QEventLoop()
QTimer.singleShot(5000, loop.quit)
loop.exec_()
win.clear()
win.display()
sys.exit(app.exec_())
Пример #24
0
 def viewer_window_provider(title):
     return Window(None, -3, -1, 3, 0, self.window.internal_renderer)
Пример #25
0
    def run(self):
        print("Initialized the application @app class")
        window_generator = WindowGenerator()
        windows = window_generator.define_windows()
        # set main menu as starting window
        current_params = window_generator.get_windowparameters_by_title(windows, "Raspberry Pi Gaming Station")
        # initalize pygame submodules
        os.environ['SDL_VIDEO_WINDOW_POS'] = "0,0"
        pygame.init()
        # disable mouse cursor
        pygame.mouse.set_visible(0)
        # create a pygame default window
        info = pygame.display.Info()
        screen = pygame.display.set_mode((info.current_w, info.current_h), pygame.NOFRAME)
        while True:
            current_window = Window(screen=screen, 
                                    title=current_params.title, 
                                    choices=current_params.options, 
                                    extend_window=current_params.extend_window)
            result = current_window.display()
            if result == "Exit":
                current_params = window_generator.get_windowparameters_by_id(windows, current_params.previous_id)
                if current_params == None:
                    #TODO: ask to shutdown the system
                    break
            elif '.' in result:
                cm = ControlManager(platform=current_params.title.lower())
                cm.restore_control_config()
                # run a game
                gm = GameRunner(platform=current_params.title, file_name=result)
                gm.run()
            else:
                if result == "Start":
                    result = "Platforms"
                new_params = window_generator.get_windowparameters_by_title(windows, result)
                if new_params != None:
                    # if the window is a control window
                    current_params = new_params
                # figure out how to distinguish control from hotkeys
                elif current_params.title == "Hotkeys":
                    current_params.refresh_hotkeys()
                    # run control prompt
                    cw = ControlPrompt(screen, control_to_change=result)
                    cw.display()
                    # detect pressed control
                    control = ControlDetector.detect_control()
                    # run HotkeyManager to configure the json with hotkeys
                    hm = create_hotkey_manager()
                    hm.change_hotkey(opt=result, new_control=control)
                    cw.destroy()
                    current_params.refresh_hotkeys()

                elif current_params.extend_window:
                    # show a new window to prompt for controls
                    current_params.refresh_options(platform=current_params.title.replace(' ', '').lower())
                    cw = ControlPrompt(screen=screen,
                                        control_to_change=result)
                    cw.display()
                    # detect pressed control
                    control = ControlDetector.detect_control()
                    # platform is current window title minus the trailing space
                    cm = ControlManager(platform=current_params.title.replace(' ', '').lower())
                    cm.update_control_value(result, control)
                    # run ControlManager to configure the cfg file
                    # destroy the screen
                    cw.destroy()
                    current_params.refresh_options(platform=current_params.title.replace(' ', '').lower())

        pygame.display.quit()
        pygame.quit()
Пример #26
0
from pyglet import app

from gui.models.movable import MovableMixin
from gui.window import Window

if __name__ == "__main__":
    win = Window(width=1024, height=768)
    button = MovableMixin(10, 100, 10, 100)
    win.add_component(button)
    app.run()
Пример #27
0
def main():
    root = Tk()
    root.title("MAD-mazes")
    window = Window(root)
    root.mainloop()