Пример #1
0
    def display_ui(ui, parent, style):
        """Display the UI."""

        ui.owner.init(ui, parent, style)
        ui.control = ui.owner.control
        ui.control.parent = parent

        try:
            ui.prepare_ui()
        except:
            ui.control.setParent(None)
            ui.control.ui = None
            ui.control = None
            ui.owner = None
            ui.result = False
            raise

        ui.handler.position(ui.info)
        restore_window(ui)

        if style != BaseDialog.NONMODAL:
            ui.control.setModal(True)

        if parent is not None:
            parent.addWindow(ui.control)
        else:
            SimpleApplication.ui = ui.control

            muntjac(SimpleApplication, nogui=True, debug=True)
Пример #2
0
def configure_traits(obj):

#    def app_factory():
#        app = MuntjacApplication(obj)
#        return app

    MuntjacApplication._hasTraits = obj

    muntjac(MuntjacApplication, nogui=True, debug=True)
Пример #3
0
def start_event_loop_muntjac(app=None):
    """Start the Muntjac event loop in a consistent manner."""
    from muntjac.main import muntjac
    from muntjac.terminal.gwt.server.application_servlet \
        import SingletonApplicationServlet

    if app is None:
        app = get_app_muntjac()
    muntjac(app, nogui=True, debug=True,
            servletClass=SingletonApplicationServlet)
Пример #4
0
from muntjac.main import muntjac

from muntjac.application import Application
from muntjac.ui.window import Window

from muntjac.demo.sampler.features.dragndrop.DragDropServerValidationExample \
    import DragDropServerValidationExample as Example


class App(Application):
    def init(self):
        main = Window('Muntjac')
        main.setTheme('sampler-reindeer')
        self.setMainWindow(main)

        main.addComponent(Example())


if __name__ == '__main__':
    muntjac(App, nogui=True, forever=True, debug=True)
Пример #5
0
        l.addComponent(tf)
        l.setComponentAlignment(tf, Alignment.MIDDLE_LEFT)
        tf = TextField('Bottom')
        l.addComponent(tf)
        tf.setWidth('50%')
        l.setComponentAlignment(tf, Alignment.BOTTOM_LEFT)
        if recurse > 0:
            recurse -= 1
            createCoreVertical = self.createCoreVertical(recurse)
            l.addComponent(createCoreVertical)
            l.setExpandRatio(createCoreVertical, 1)
        return l


class LongClickListener(IClickListener):
    def buttonClick(self, event):
        if event.getButton().getCaption() is None:
            event.getButton().setCaption('Long caption')
        else:
            event.getButton().setCaption(None)


class OneClickListener(IClickListener):
    def buttonClick(self, event):
        event.getButton().setWidth('300px')


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(WeelayoutApplication, nogui=True, forever=True, debug=True)
Пример #6
0
def onRemove(event, book):
    book._contactList.removeItem(book._contactList.getValue())
    book._contactList.select(None)


def onContactChange(event, book):
    idd = book._contactList.getValue()

    if idd is None:
        book._contactEditor.setItemDataSource(None)
    else:
        item = book._contactList.getItem(idd)
        book._contactEditor.setItemDataSource(item)

    book._contactRemovalButton.setVisible(idd is not None)


def onFilterChange(event, name, text, book):
    book._addressBookData.removeContainerFilters(name)
    if len(str(text)) > 0 and name != str(text):
        book._addressBookData.addContainerFilter(name, str(text), True, False)

    book.getMainWindow().showNotification("%d matches found" %
                                          book._addressBookData.size())


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(SimpleAddressBook, nogui=True, forever=True, debug=True)
Пример #7
0
class SourceUriHandler(IUriHandler):

    def __init__(self, window):
        self._window = window

    def handleURI(self, context, relativeUri):
        f = FeatureSet.FEATURES.getFeature(relativeUri)
        if f is not None:
            self._window.addComponent(CodeLabel(f.getSource()))
        else:
            lbl = Label('Sorry, no source found for ' + relativeUri)
            self._window.addComponent(lbl)
        return None


class SourceWindowCloseListener(window.ICloseListener):

    def __init__(self, window, app):
        self._app = app
        self._window = window

    def windowClose(self, e):
        self._app.removeWindow(self._window)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(SamplerApplication, nogui=True, forever=True, debug=True,
            widgetset='com.vaadin.demo.sampler.gwt.SamplerWidgetSet')
Пример #8
0
        playback.setComponentAlignment(nextt, Alignment.MIDDLE_LEFT)

        volume.setStyleName('volume')
        mute.setStyleName('mute')
        maxx.setStyleName('max')
        vol.setWidth('78px')

        status.setStyleName('status')
        status.setMargin(True)
        status.setHeight('46px')  # Height of the background image

        toggleVisualization.setStyleName('toggle-vis')
        jumpToTrack.setStyleName('jump')

        viewAsTable.setStyleName('viewmode-table')
        viewAsGrid.setStyleName('viewmode-grid')
        coverflow.setStyleName('viewmode-coverflow')

        sidebar.setStyleName('sidebar')

        music.setStyleName('selected')

        cover.setSource(ThemeResource('images/album-cover.jpg'))
        # Because this is an image, it will retain it's aspect ratio
        cover.setWidth('100%')


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(MuntjacTunesLayout, nogui=True, forever=True, debug=True)
Пример #9
0
        canvas.setHeight('400px')

        # Draw some shapes to the canvas
        canvas.saveContext()
        canvas.clear()
        canvas.translate(175, 175)
        canvas.scale(1.6, 1.6)
        for i in range(1, 6):
            canvas.saveContext()
            canvas.setFillStyle('rgb(%d,%d,255)' % (51 * i, 255 - (51 * i)))

            for _ in range(i * 6):
                canvas.rotate((math.pi * 2) / (i * 6))
                canvas.beginPath()
                canvas.arc(0, i * 12.5, 5, 0, math.pi * 2, True)
                canvas.fill()

            canvas.restoreContext()

        canvas.restoreContext()

        canvas.drawImage(
            'http://www.google.ru/intl/en_com/images/srpr/logo1w.png', 10, 10)

        self.getMainWindow().addComponent(canvas)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(CanvasApp, nogui=True, forever=True, debug=True)
Пример #10
0
        image = Image.new("RGB", (270, 270))
        drawable = ImageDraw.Draw(image)
        drawable.rectangle([0, 0, 270, 270], fill=str(Color.BLUE))
        drawable.rectangle([1, 1, 268, 268], fill=str(self._bgColor))
        drawable.ellipse([25, 25, 245, 245], fill=str(self._fgColor))
        drawable.text((50, 100),
                      'r=' + str(self._fgColor.getRed()) + ',g=' +
                      str(self._fgColor.getGreen()) + ',b=' +
                      str(self._fgColor.getBlue()),
                      fill=str(Color.BLACK))
        drawable.text((5, 15),
                      'r=' + str(self._bgColor.getRed()) + ',g=' +
                      str(self._bgColor.getGreen()) + ',b=' +
                      str(self._bgColor.getBlue()),
                      fill=str(Color.BLACK))

        del drawable

        try:
            # Write the image to a buffer.
            self._imagebuffer = StringIO()
            image.save(self._imagebuffer, 'PNG')
            return self._imagebuffer
        except IOError:
            return None


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(ColorPickerApplication, nogui=True, forever=True, debug=True)
Пример #11
0
        # Draw some shapes to the canvas
        canvas.saveContext()
        canvas.clear()
        canvas.translate(175, 175)
        canvas.scale(1.6, 1.6)
        for i in range(1, 6):
            canvas.saveContext()
            canvas.setFillStyle('rgb(%d,%d,255)' % (51 * i, 255 - (51 * i)))

            for _ in range(i * 6):
                canvas.rotate((math.pi * 2) / (i * 6))
                canvas.beginPath()
                canvas.arc(0, i * 12.5, 5, 0, math.pi * 2, True)
                canvas.fill()

            canvas.restoreContext()

        canvas.restoreContext()

        canvas.drawImage(
                'http://www.google.ru/intl/en_com/images/srpr/logo1w.png',
                10, 10)

        self.getMainWindow().addComponent(canvas)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(CanvasApp, nogui=True, forever=True, debug=True)
Пример #12
0
                    float('' + requestedOperation))
            return self._current

        last = self._lastOperationRequested
        if last == '+':
            self._stored += self._current
        elif last == '-':
            self._stored -= self._current
        elif last == '/':
            try:
                self._stored /= self._current
            except ZeroDivisionError:
                pass
        elif last == '*':
            self._stored *= self._current
        elif last == 'C':
            self._stored = self._current

        self._lastOperationRequested = requestedOperation
        self._current = 0.0

        if requestedOperation == 'C':
            self._stored = 0.0

        return self._stored


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(Calc, nogui=True, forever=True, debug=True)
Пример #13
0

class DrawClickListener(_MapListener, IClickListener):
    def buttonClick(self, event):
        # Location of Vaadin Ltd offices
        c = (22.3, 60.4522)
        delta = 0.75
        corners = [(c[0] - delta, c[1] + delta), (c[0] + delta, c[1] + delta),
                   (c[0] + delta, c[1] - delta), (c[0] - delta, c[1] - delta),
                   (c[0] - delta, c[1] + delta)]
        poly = Polygon(getrandbits(48), corners, '#f04040', 5, 0.8, '#1010ff',
                       0.2, False)
        self._app._googleMap.addPolyOverlay(poly)


class RemovePolygonClickListener(_MapListener, IClickListener):
    def buttonClick(self, event):
        overlays = self._app._googleMap.getOverlays()
        if len(overlays) > 0:
            self._app._googleMap.removeOverlay(overlays[-1])
            self._app.getMainWindow().showNotification(
                'Overlay removed', Notification.TYPE_TRAY_NOTIFICATION)
        else:
            self._app.getMainWindow().showNotification(
                'No overlays to remove', Notification.TYPE_TRAY_NOTIFICATION)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(GoogleMapWidgetApp, nogui=True, forever=True, debug=True)
Пример #14
0
            l.setCaption(str(prop))
            self._props[prop] = l
            grid.addComponent(l)
        return grid


class GetClickListener(IClickListener):
    def __init__(self, app, target):
        self._app = app
        self._target = target

    def buttonClick(self, event):
        RenderInfo.get(self._target.getValue(), GetCallback(self._app))


class GetCallback(ICallback):
    def __init__(self, app):
        self._app = app

    def infoReceived(self, info):
        for prop in CssProperty.values():
            self._app._props[prop].setValue(str(info.getProperty(prop)))


if __name__ == "__main__":
    from muntjac.main import muntjac

    muntjac(
        CssToolsTestApplication, nogui=True, forever=True, debug=True, widgetset="org.vaadin.csstools.CssToolsWidgetset"
    )
Пример #15
0
class SourceUriHandler(IUriHandler):
    def __init__(self, window):
        self._window = window

    def handleURI(self, context, relativeUri):
        f = FeatureSet.FEATURES.getFeature(relativeUri)
        if f is not None:
            self._window.addComponent(CodeLabel(f.getSource()))
        else:
            lbl = Label('Sorry, no source found for ' + relativeUri)
            self._window.addComponent(lbl)
        return None


class SourceWindowCloseListener(window.ICloseListener):
    def __init__(self, window, app):
        self._app = app
        self._window = window

    def windowClose(self, e):
        self._app.removeWindow(self._window)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(SamplerApplication,
            nogui=True,
            forever=True,
            debug=True,
            widgetset='com.vaadin.demo.sampler.gwt.SamplerWidgetSet')
Пример #16
0
            self._props[prop] = l
            grid.addComponent(l)
        return grid


class GetClickListener(IClickListener):
    def __init__(self, app, target):
        self._app = app
        self._target = target

    def buttonClick(self, event):
        RenderInfo.get(self._target.getValue(), GetCallback(self._app))


class GetCallback(ICallback):
    def __init__(self, app):
        self._app = app

    def infoReceived(self, info):
        for prop in CssProperty.values():
            self._app._props[prop].setValue(str(info.getProperty(prop)))


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(CssToolsTestApplication,
            nogui=True,
            forever=True,
            debug=True,
            widgetset='org.vaadin.csstools.CssToolsWidgetset')
        # Create an image and draw something on it.
        image = Image.new("RGB", (270, 270))
        drawable = ImageDraw.Draw(image)
        drawable.rectangle([0, 0, 270, 270], fill=str(Color.BLUE))
        drawable.rectangle([1, 1, 268, 268], fill=str(self._bgColor))
        drawable.ellipse([25, 25, 245, 245], fill=str(self._fgColor))
        drawable.text((50, 100),
                'r=' + str(self._fgColor.getRed()) +
                ',g=' + str(self._fgColor.getGreen()) +
                ',b=' + str(self._fgColor.getBlue()), fill=str(Color.BLACK))
        drawable.text((5, 15),
                'r=' + str(self._bgColor.getRed()) +
                ',g=' + str(self._bgColor.getGreen()) +
                ',b=' + str(self._bgColor.getBlue()), fill=str(Color.BLACK))

        del drawable

        try:
            # Write the image to a buffer.
            self._imagebuffer = StringIO()
            image.save(self._imagebuffer, 'PNG')
            return self._imagebuffer
        except IOError:
            return None


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(ColorPickerApplication, nogui=True, forever=True, debug=True)
Пример #18
0
            return False
        return self._isAppRunningOnGAE

    def init(self):
        self.setMainWindow(InvientChartsDemoWin())
        self.getMainWindow().showNotification(
            'To hide a series, click on its legend label.')

    def onRequestStart(self, request, response):
        if self._isAppRunningOnGAE is None:
            self._isAppRunningOnGAE = False


#            serverInfo = request.getSession().getServletContext().getServerInfo()  FIXME
#            if serverInfo is not None and 'Google' in serverInfo:
#                self._isAppRunningOnGAE = True

    def onRequestEnd(self, request, response):
        pass

if __name__ == '__main__':
    from muntjac.main import muntjac
    from invient_demo_app_servlet import InvientChartsDemoAppServlet

    muntjac(
        InvientChartsDemoApp,
        nogui=True,
        forever=True,
        debug=True,
        #            servletClass=InvientChartsDemoAppServlet,
        contextRoot='.')
Пример #19
0
class CopyClickListener(IClickListener):
    def __init__(self, code1, code2):
        self._code1 = code1
        self._code2 = code2

    def buttonClick(self, event):
        self._code2.setValue(self._code1.getValue())


class CodeThemeChangeListener(IValueChangeListener):
    def __init__(self, code, codeTheme):
        self._code = code
        self._codeTheme = codeTheme

    def valueChange(self, event):
        self._code.setCodeTheme(self._codeTheme.getValue())


class ShowLineNumbersListener(IClickListener):
    def __init__(self, code):
        self._code = code

    def buttonClick(self, event):
        self._code.setShowLineNumbers(event.getButton().booleanValue())


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(CodeMirrorApplication, nogui=True, forever=True, debug=True)
Пример #20
0
        return self._isAppRunningOnGAE

    def init(self):
        self.setMainWindow(InvientChartsDemoWin())
        self.getMainWindow().showNotification("To hide a series, click on its legend label.")

    def onRequestStart(self, request, response):
        if self._isAppRunningOnGAE is None:
            self._isAppRunningOnGAE = False

    #            serverInfo = request.getSession().getServletContext().getServerInfo()  FIXME
    #            if serverInfo is not None and 'Google' in serverInfo:
    #                self._isAppRunningOnGAE = True

    def onRequestEnd(self, request, response):
        pass


if __name__ == "__main__":
    from muntjac.main import muntjac
    from invient_demo_app_servlet import InvientChartsDemoAppServlet

    muntjac(
        InvientChartsDemoApp,
        nogui=True,
        forever=True,
        debug=True,
        #            servletClass=InvientChartsDemoAppServlet,
        contextRoot=".",
    )
Пример #21
0
class DrawClickListener(_MapListener, IClickListener):

    def buttonClick(self, event):
        # Location of Vaadin Ltd offices
        c = (22.3, 60.4522)
        delta = 0.75
        corners = [(c[0] - delta, c[1] + delta), (c[0] + delta, c[1] + delta),
                   (c[0] + delta, c[1] - delta), (c[0] - delta, c[1] - delta),
                   (c[0] - delta, c[1] + delta)]
        poly = Polygon(getrandbits(48), corners, '#f04040', 5, 0.8,
                '#1010ff', 0.2, False)
        self._app._googleMap.addPolyOverlay(poly)


class RemovePolygonClickListener(_MapListener, IClickListener):

    def buttonClick(self, event):
        overlays = self._app._googleMap.getOverlays()
        if len(overlays) > 0:
            self._app._googleMap.removeOverlay(overlays[-1])
            self._app.getMainWindow().showNotification('Overlay removed',
                    Notification.TYPE_TRAY_NOTIFICATION)
        else:
            self._app.getMainWindow().showNotification('No overlays to remove',
                    Notification.TYPE_TRAY_NOTIFICATION)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(GoogleMapWidgetApp, nogui=True, forever=True, debug=True)
Пример #22
0
            button = Button(caption)
            button.addListener(self)

            # Add the button to our main layout
            layout.addComponent(button)


    def buttonClick(self, event):
        # Event handler for button clicks. Called for all the buttons in
        # the application.

        # Get the button that was clicked
        button = event.getButton()

        # Get the requested operation from the button caption
        requestedOperation = button.getCaption()[0]

        self.pure_calc.proc_char(requestedOperation)
        if self.pure_calc.digit_operation(requestedOperation):
            newValue = self.pure_calc._current
        else:
            newValue = self.pure_calc._stored

        # Update the result label with the new value
        self._display.setValue(newValue)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(Calc2, nogui=True, forever=True, debug=True)
Пример #23
0
from muntjac.api import Application, Window, Label


class HelloWorld(Application):

    def init(self):
        """Init is invoked on application load (when a user accesses
        the application for the first time).
        """
        # Main window is the primary browser window
        main = Window('Hello window')
        self.setMainWindow(main)

        # "Hello world" text is added to window as a Label component
        main.addComponent( Label('Hello World!') )


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(HelloWorld, nogui=False)
Пример #24
0
def onRemove(event, book):
    book._contactList.removeItem( book._contactList.getValue() )
    book._contactList.select(None)


def onContactChange(event, book):
    idd = book._contactList.getValue()

    if idd is None:
        book._contactEditor.setItemDataSource(None)
    else:
        item = book._contactList.getItem(idd)
        book._contactEditor.setItemDataSource(item)

    book._contactRemovalButton.setVisible(idd is not None)


def onFilterChange(event, name, text, book):
    book._addressBookData.removeContainerFilters(name)
    if len(str(text)) > 0 and name != str(text):
        book._addressBookData.addContainerFilter(name, str(text), True, False)

    book.getMainWindow().showNotification("%d matches found" %
            book._addressBookData.size())


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(SimpleAddressBook, nogui=True, forever=True, debug=True)
        tf = TextField('Bottom')
        l.addComponent(tf)
        tf.setWidth('50%')
        l.setComponentAlignment(tf, Alignment.BOTTOM_LEFT)
        if recurse > 0:
            recurse -= 1
            createCoreVertical = self.createCoreVertical(recurse)
            l.addComponent(createCoreVertical)
            l.setExpandRatio(createCoreVertical, 1)
        return l


class LongClickListener(IClickListener):

    def buttonClick(self, event):
        if event.getButton().getCaption() is None:
            event.getButton().setCaption('Long caption')
        else:
            event.getButton().setCaption(None)


class OneClickListener(IClickListener):

    def buttonClick(self, event):
        event.getButton().setWidth('300px')


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(WeelayoutApplication, nogui=True, forever=True, debug=True)
Пример #26
0
                 isRegisterEvents=True,
                 isRegisterSVGEvent=True,
                 isSetHeight=True):

        chart.setSizeFull()
        chart.setStyleName('v-chart-min-width')
        if isSetHeight:
            chart.setHeight('410px')

        self.mainLayout.removeAllComponents()
        # Add chart
        self.mainLayout.addComponent(chart)


class HelloPlot(Application):
    def init(self):
        """Init is invoked on application load (when a user accesses
        the application for the first time).
        """
        # Application.init is called once for each application. Here it
        # creates the UI and connects it to the business logic.
        # Create the main layout for our application
        mainWindow = PlotWindow()

        self.setMainWindow(mainWindow)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(HelloPlot, nogui=True, debug=True, contextRoot='.')
Пример #27
0
        mainWindow = Window("Color Picker Demo Application")
        label = Label("Hello Muntjac user")
        mainWindow.addComponent(label)
        self.setMainWindow(mainWindow)

        # Create the color picker
        cp = ColorPicker("Our ColorPicker", Color.RED)
        mainWindow.addComponent(cp)

        # Set the button caption
        cp.setButtonCaption("Our color")

        # Hide the color history

    #        cp.setHistoryVisibility(False)

    # Hide the HSV tab
    #        cp.setHSVVisibility(False)

    # Hide the RGB tab
    #        cp.setRGBVisibility(False)

    def colorChanged(self, event):
        self.getMainWindow().showNotification("Color changed!")


if __name__ == "__main__":
    from muntjac.main import muntjac

    muntjac(ColorPickerDemo, nogui=True, forever=True, debug=True)
    def __init__(self, code1, code2):
        self._code1 = code1
        self._code2 = code2

    def buttonClick(self, event):
        self._code2.setValue(self._code1.getValue())


class CodeThemeChangeListener(IValueChangeListener):

    def __init__(self, code, codeTheme):
        self._code = code
        self._codeTheme = codeTheme

    def valueChange(self, event):
        self._code.setCodeTheme(self._codeTheme.getValue())


class ShowLineNumbersListener(IClickListener):

    def __init__(self, code):
        self._code = code

    def buttonClick(self, event):
        self._code.setShowLineNumbers(event.getButton().booleanValue())


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(CodeMirrorApplication, nogui=True, forever=True, debug=True)
Пример #29
0
    def init(self):
        mainWindow = Window("Color Picker Demo Application")
        label = Label("Hello Muntjac user")
        mainWindow.addComponent(label)
        self.setMainWindow(mainWindow)

        # Create the color picker
        cp = ColorPicker("Our ColorPicker", Color.RED)
        mainWindow.addComponent(cp)

        # Set the button caption
        cp.setButtonCaption("Our color")

        # Hide the color history


#        cp.setHistoryVisibility(False)

# Hide the HSV tab
#        cp.setHSVVisibility(False)

# Hide the RGB tab
#        cp.setRGBVisibility(False)

    def colorChanged(self, event):
        self.getMainWindow().showNotification("Color changed!")

if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(ColorPickerDemo, nogui=True, forever=True, debug=True)
Пример #30
0
from muntjac.main import muntjac

from muntjac.application import Application
from muntjac.ui.window import Window

from muntjac.demo.sampler.features.dragndrop.DragDropServerValidationExample \
    import DragDropServerValidationExample as Example


class App(Application):

    def init(self):
        main = Window('Muntjac')
        main.setTheme('sampler-reindeer')
        self.setMainWindow(main)

        main.addComponent(Example())


if __name__ == '__main__':
    muntjac(App, nogui=True, forever=True, debug=True)
        self._running = False

    def run(self):
        startTime = 1000 * time.time()
        lifetime = 1000 * 60
        # live for a minute.
        try:
            while 1000 * time.time() < startTime + lifetime:
                if self._running:
                    # synchronize with the application, to avoid concurrent
                    # edits on the label's value.
                    number = self._renderLabel.getData()
                    self._renderLabel.setValue(number)
                    self._renderLabel.setData(number + 1)
                time.sleep(SLEEP_TIME_IN_MILLIS)
            self._renderLabel.setValue('[ counter thread expired ]')
        except KeyboardInterrupt:
            self._renderLabel.setValue('[ counter thread interrupted ]')

    def startCounting(self):
        self._running = True

    def stopCounting(self):
        self._running = False


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(RefresherApplication, nogui=True, debug=True,
            contextRoot='.')
Пример #32
0
                isRegisterSVGEvent=True, isSetHeight=True):

        chart.setSizeFull()
        chart.setStyleName('v-chart-min-width')
        if isSetHeight:
            chart.setHeight('410px')


        self.mainLayout.removeAllComponents()
        # Add chart
        self.mainLayout.addComponent(chart)



class HelloPlot(Application):
    def init(self):
        """Init is invoked on application load (when a user accesses
        the application for the first time).
        """
        # Application.init is called once for each application. Here it
        # creates the UI and connects it to the business logic.
        # Create the main layout for our application
        mainWindow = PlotWindow()

        self.setMainWindow(mainWindow)


if __name__ == '__main__':
    from muntjac.main import muntjac
    muntjac(HelloPlot, nogui=True, debug=True, contextRoot='.')