def onModuleLoad(self):
        self.singleton = self

        topPanel = TopPanel()
        rightPanel = VerticalPanel()
        self.mailDetail = MailDetail()
        self.shortcuts = Shortcuts()

        topPanel.setWidth("100%")

        # MailList uses Mail.get() in its constructor, so initialize it after
        # 'singleton'.
        mailList = MailList(self.singleton)
        mailList.setWidth("100%")
        
        # Create the right panel, containing the email list & details.
        rightPanel.add(mailList)
        rightPanel.add(self.mailDetail)
        mailList.setWidth("100%")
        self.mailDetail.setWidth("100%")

        # Create a dock panel that will contain the menu bar at the top,
        # the shortcuts to the left, and the mail list & details taking the rest.
        outer = DockPanel()
        outer.add(topPanel, DockPanel.NORTH)
        outer.add(self.shortcuts, DockPanel.WEST)
        outer.add(rightPanel, DockPanel.CENTER)
        outer.setWidth("100%")

        outer.setSpacing(4)
        outer.setCellWidth(rightPanel, "100%")

        # Hook the window resize event, so that we can adjust the UI.
        #FIXME need implementation # Window.addWindowResizeListener(this)
        #Window.addWindowResizeListener(self)

        # Get rid of scrollbars, and clear out the window's built-in margin,
        # because we want to take advantage of the entire client area.
        Window.enableScrolling(False)
        Window.setMargin("0px")
        
        # Finally, add the outer panel to the RootPanel, so that it will be
        # displayed.
        #RootPanel.get().add(outer) # FIXME get#
        RootPanel().add(outer)
        RootPanel().add(Logger())
        
        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        # FIXME - need implementation#
        #     DeferredCommand.add(onWindowResized(Window.getClientWidth(), Window.getClientHeight()))

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Esempio n. 2
0
class Mail:
    def get(self):
        return self.singleton

    def onModuleLoad(self):
        self.singleton = self

        topPanel = TopPanel()
        rightPanel = VerticalPanel()
        self.mailDetail = MailDetail()
        self.shortcuts = Shortcuts()

        topPanel.setWidth("100%")

        # MailList uses Mail.get() in its constructor, so initialize it after
        # 'singleton'.
        mailList = MailList(self.singleton)
        mailList.setWidth("100%")

        # Create the right panel, containing the email list & details.
        rightPanel.add(mailList)
        rightPanel.add(self.mailDetail)
        mailList.setWidth("100%")
        self.mailDetail.setWidth("100%")

        # Create a dock panel that will contain the menu bar at the top,
        # the shortcuts to the left, and the mail list & details taking the rest.
        outer = DockPanel()
        outer.add(topPanel, DockPanel.NORTH)
        outer.add(self.shortcuts, DockPanel.WEST)
        outer.add(rightPanel, DockPanel.CENTER)
        outer.setWidth("100%")

        outer.setSpacing(4)
        outer.setCellWidth(rightPanel, "100%")

        # Hook the window resize event, so that we can adjust the UI.
        #FIXME need implementation # Window.addWindowResizeListener(this)
        Window.addWindowResizeListener(self)

        # Get rid of scrollbars, and clear out the window's built-in margin,
        # because we want to take advantage of the entire client area.
        Window.enableScrolling(False)
        Window.setMargin("0px")

        # Finally, add the outer panel to the RootPanel, so that it will be
        # displayed.
        #RootPanel.get().add(outer) # FIXME get#
        RootPanel().add(outer)
        RootPanel().add(Logger())

        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        DeferredCommand.add(self)

    def execute(self):
        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())

    def onWindowResized(self, width, height):
        # Adjust the shortcut panel and detail area to take up the available room
        # in the window.
        #Logger("Window resized", "width: " + width+ ", height: " + height)

        shortcutHeight = height - self.shortcuts.getAbsoluteTop() - 8
        if (shortcutHeight < 1):
            shortcutHeight = 1
        self.shortcuts.setHeight("%dpx" % shortcutHeight)

        # Give the mail detail widget a chance to resize itself as well.
        self.mailDetail.adjustSize(width, height)

    def displayItem(self, item):
        self.mailDetail.setItem(item)
Esempio n. 3
0
File: Mail.py Progetto: Afey/pyjs
class Mail:

    def get(self):
        return self.singleton

    def onModuleLoad(self):
        self.singleton = self

        topPanel = TopPanel()
        rightPanel = VerticalPanel()
        self.mailDetail = MailDetail()
        self.shortcuts = Shortcuts()

        topPanel.setWidth("100%")

        # MailList uses Mail.get() in its constructor, so initialize it after
        # 'singleton'.
        mailList = MailList(self.singleton)
        mailList.setWidth("100%")

        # Create the right panel, containing the email list & details.
        rightPanel.add(mailList)
        rightPanel.add(self.mailDetail)
        mailList.setWidth("100%")
        self.mailDetail.setWidth("100%")

        # Create a dock panel that will contain the menu bar at the top,
        # the shortcuts to the left, and the mail list & details taking the rest.
        outer = DockPanel()
        outer.add(topPanel, DockPanel.NORTH)
        outer.add(self.shortcuts, DockPanel.WEST)
        outer.add(rightPanel, DockPanel.CENTER)
        outer.setWidth("100%")

        outer.setSpacing(4)
        outer.setCellWidth(rightPanel, "100%")

        # Hook the window resize event, so that we can adjust the UI.
        #FIXME need implementation # Window.addWindowResizeListener(this)
        Window.addWindowResizeListener(self)

        # Get rid of scrollbars, and clear out the window's built-in margin,
        # because we want to take advantage of the entire client area.
        Window.enableScrolling(False)
        Window.setMargin("0px")

        # Finally, add the outer panel to the RootPanel, so that it will be
        # displayed.
        #RootPanel.get().add(outer) # FIXME get#
        RootPanel().add(outer)
        RootPanel().add(Logger())

        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        DeferredCommand.add(self)

    def execute(self):
        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())

    def onWindowResized(self, width, height):
        # Adjust the shortcut panel and detail area to take up the available room
        # in the window.
        #Logger("Window resized", "width: " + width+ ", height: " + height)

        shortcutHeight = height - self.shortcuts.getAbsoluteTop() - 8
        if (shortcutHeight < 1):
            shortcutHeight = 1
        self.shortcuts.setHeight("%dpx" % shortcutHeight)

        # Give the mail detail widget a chance to resize itself as well.
        self.mailDetail.adjustSize(width, height)

    def displayItem(self, item):
        self.mailDetail.setItem(item)
Esempio n. 4
0
    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(50, 50, 800, 400)

        # Set window background color
        #self.setAutoFillBackground(True)
        #p = self.palette()
        #p.setColor(self.backgroundRole(), QColor(45, 45, 45))
        #self.setPalette(p)

        self.shell = Shell(self.writer)

        log.init(self)

        self.field = Field(self)
        self.data = [Data(self, 0), Data(self, 1)]
        self.shortcuts = Shortcuts(self)

        self.coms = [params.get("com0"), params.get("com1")]

        self.serials = []
        for com in self.coms:
            try:
                self.serials.append(
                    serial.Serial("COM" + str(int(com)),
                                  115200,
                                  parity=serial.PARITY_NONE,
                                  stopbits=serial.STOPBITS_ONE,
                                  timeout=0))
                l_complete("Succesful connect to {}".format("COM" +
                                                            str(int(com))))
            except:
                pass

        names = ["Calibrate"]
        commands = ["!c"]

        self.playingFuncs = [[], []]

        self.buttons = []
        for index in [0, 1]:
            self.buttons.append(
                ButtonsSet(self, index, names, [(cmd + " " + str(index + 1))
                                                for cmd in commands], log))

            try:
                self.addPlayingFunc(index, self.buttons[-1].buttons[0].updater)
            except:
                print("bad")
                pass

        self.menubar = MenuBar(self)

        self.show()

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.updateSerial)
        self.timer.start(8)

        self.timer2 = QTimer(self)
        self.timer2.timeout.connect(self.field.update)
        self.timer2.start(100)

        l_log("Initialization finished")