Example #1
0
        def createImageView():
            widget = Widget(200, 32)
            self.addView(widget)

            imageView = Image(
                get_file_path(ImageViewerApp.IMAGE_LIST[self._image_index]))
            imageView.setSize(0, 0, 200, 32)
            imageView.addOnTouchViewListener(self)
            widget.addParts(imageView)
            self.setView(imageView, 'image_view')
Example #2
0
        def createMenu():
            # create weahter app icon
            iconWeather = Image(
                os.path.normpath(os.path.join(dir,
                                              './assets/icon_weather.png')))
            iconWeather.addOnTouchViewListener(self)
            self.setView(iconWeather, 'icon_weather')

            # create thermostat app icon
            iconThermo = Image(
                os.path.normpath(os.path.join(dir,
                                              './assets/icon_thermo.png')))
            iconThermo.addOnTouchViewListener(self)
            self.setView(iconThermo, 'icon_thermo')

            # create wi-fi setting app icon
            iconWiFi = Image(
                os.path.normpath(
                    os.path.join(dir, './assets/icon_wifi_enable.png')))
            iconWiFi.addOnTouchViewListener(self)
            self.setView(iconWiFi, 'icon_wifi')

            # create menu widget
            menu = Widget((iconWeather.width + iconThermo.width + 2), 22)
            menu.setPos(0, 11)
            self.addView(menu)

            # add icons to menu widget
            menu.addParts(iconWeather)

            iconThermo.x = iconWeather.width + 2
            menu.addParts(iconThermo)

            iconWiFi.x = iconWeather.width + 2
            iconWiFi.y = 11
            menu.addParts(iconWiFi)
Example #3
0
        def createWeatherForecastUI():
            widget = Widget(189, 32)
            widget.visible = False
            self.addView(widget)
            self.setView(widget, 'forecast_view')

            dateText = Text()
            dateText.setSize(9, 3, 80, 8)
            widget.addParts(dateText)
            self.setView(dateText, 'dateText')

            wIcon = Image()
            wIcon.setSize(15, 18, 26, 14)
            widget.addParts(wIcon)
            self.setView(wIcon, 'wIcon')

            highTemp = Text()
            highTemp.setSize(85, 3, 35, 8)
            widget.addParts(highTemp)
            self.setView(highTemp, 'hTemp')

            tempIconName = './assets/weather/icon_f.png' if self._lang == 'en-US' else './assets/weather/icon_c.png'
            tempIconPath = os.path.normpath(os.path.join(dir, tempIconName))

            hTempIcon = Image(tempIconPath)
            hTempIcon.setSize(98, 3, 9, 7)
            widget.addParts(hTempIcon)
            self.setView(hTempIcon, 'hTempIcon')

            lowTemp = Text()
            lowTemp.setSize(85, 21, 35, 8)
            widget.addParts(lowTemp)
            self.setView(lowTemp, 'lTemp')

            lTempIcon = Image(tempIconPath)
            lTempIcon.setSize(98, 21, 9, 7)
            widget.addParts(lTempIcon)
            self.setView(lTempIcon, 'lTempIcon')

            pIcon = Image()
            pIcon.setSize(134, 3, 9, 10)
            widget.addParts(pIcon)
            self.setView(pIcon, 'pIcon')

            pText = Text()
            pText.setSize(148, 3, 32, 8)
            widget.addParts(pText)
            self.setView(pText, 'pText')

            percentIconName = './assets/weather/icon_percent.png'
            percentIconPath = os.path.normpath(
                os.path.join(dir, percentIconName))

            percentIcon = Image(percentIconPath)
            percentIcon.setSize(160, 3, 3, 7)
            widget.addParts(percentIcon)
            self.setView(percentIcon, 'percentIcon')

            widget.visible = False
Example #4
0
        def createMenu():
            # create weahter app icon
            iconWeather = Image(get_file_path('./assets/icon_weather.png'))
            iconWeather.addOnTouchViewListener(self)
            self.setView(iconWeather, 'icon_weather')

            # create thermostat app icon
            iconThermo = Image(get_file_path('./assets/icon_thermo.png'))
            iconThermo.addOnTouchViewListener(self)
            self.setView(iconThermo, 'icon_thermo')

            # create image viewer app icon
            iconImage = Image(get_file_path('./assets/icon_pen.png'))
            iconImage.addOnTouchViewListener(self)
            self.setView(iconImage, 'icon_image')

            # create wi-fi setting app icon
            iconWiFi = Image(get_file_path('./assets/icon_wifi_enable.png'))
            iconWiFi.addOnTouchViewListener(self)
            self.setView(iconWiFi, 'icon_wifi')

            # create menu widget
            menu = Widget((iconWeather.width + iconThermo.width + 2 +
                           iconImage.width + 2), 22)
            menu.setPos(0, 11)
            self.addView(menu)

            # add icons to menu widget
            menu.addParts(iconWeather)

            iconThermo.x = iconWeather.width + 2
            menu.addParts(iconThermo)

            iconImage.x = iconThermo.x + iconThermo.width + 2
            menu.addParts(iconImage)

            iconWiFi.x = iconWeather.width + 2
            iconWiFi.y = 11
            menu.addParts(iconWiFi)
Example #5
0
        def createInputSSIDPanel():
            inputSSIDPanel = Widget(200, 32)
            inputSSIDPanel.visible = False

            inputSSIDCaption = Text('ssid: ')
            inputSSIDCaption.setSize(0, 0, 32, 8)
            inputSSIDPanel.addParts(inputSSIDCaption)

            inputSSIDArea = Text('')
            inputSSIDArea.setSize(36, 0, 168 - 36, 8)
            inputSSIDPanel.addParts(inputSSIDArea)
            self.setView(inputSSIDArea, 'inputSSIDArea')

            keyboardSSID = Keyboard(listener=self)
            keyboardSSID.setSize(0, 11, keyboardSSID.width,
                                 keyboardSSID.height)
            keyboardSSID.addOnUpdateViewListener(self)
            inputSSIDPanel.addParts(keyboardSSID)

            btnInputSSIDOk = Text('>>')
            btnInputSSIDOk.setSize(158, 24, 10, 8)
            btnInputSSIDOk.addOnTouchViewListener(self)
            inputSSIDPanel.addParts(btnInputSSIDOk)
            self.setView(btnInputSSIDOk, 'btnInputSSIDOk')

            btnInputSSIDBack = Text('<<')
            btnInputSSIDBack.setSize(140, 24, 10, 8)
            btnInputSSIDBack.addOnTouchViewListener(self)
            inputSSIDPanel.addParts(btnInputSSIDBack)
            self.setView(btnInputSSIDBack, 'btnInputSSIDBack')

            self.addView(inputSSIDPanel)
            self.setView(inputSSIDPanel, 'panelInputSSID')
Example #6
0
        def createCurrentSettingPanel():
            showCurrentSetting = Widget(200, 32)

            wifiCaption = Text('Wi-Fi')
            wifiCaption.setSize(0, 0, 30, 8)
            showCurrentSetting.addParts(wifiCaption)

            self._icon_wifi_enable = os.path.normpath(
                os.path.join(dir, './assets/icon_wifi_enable.png'))
            self._icon_wifi_disable = os.path.normpath(
                os.path.join(dir, './assets/icon_wifi_disable.png'))
            connectionStatus = Image(self._icon_wifi_disable)
            connectionStatus.setSize(36, 0, 11, 11)
            connectionStatus.offset_y = 2
            showCurrentSetting.addParts(connectionStatus)
            self.setView(connectionStatus, 'connectionStatus')

            currentIP = Text('')
            currentIP.setTextAlignment(TextAlignment.RIGHT)
            currentIP.setSize(65, 0, 168 - 65, 8)
            showCurrentSetting.addParts(currentIP)
            self.setView(currentIP, 'IPAddress')

            currentSSID = Text('')
            currentSSID.setSize(0, 24, 130, 8)
            showCurrentSetting.addParts(currentSSID)
            self.setView(currentSSID, 'SSID')

            btnNext = Text('>>')
            btnNext.setSize(158, 24, 10, 8)
            btnNext.addOnTouchViewListener(self)
            showCurrentSetting.addParts(btnNext)
            self.setView(btnNext, 'btnNext')

            self.addView(showCurrentSetting)
            self.setView(showCurrentSetting, 'panelShowWiFi')
Example #7
0
        def createSecurityKeyInputPanel():
            inputPassPanel = Widget(200, 32)
            inputPassPanel.visible = False

            inputPassCaption = Text('pw: ')
            inputPassCaption.setSize(0, 0, 18, 8)
            inputPassPanel.addParts(inputPassCaption)

            passArea = Text('')
            passArea.setSize(22, 0, 140, 8)
            inputPassPanel.addParts(passArea)
            self.setView(passArea, 'passArea')

            keyboardPass = Keyboard(listener=self)
            keyboardPass.setSize(0, 11, keyboardPass.width,
                                 keyboardPass.height)
            keyboardPass.addOnUpdateViewListener(self)
            inputPassPanel.addParts(keyboardPass)

            btnConnectWiFi = Text('>>')
            btnConnectWiFi.setSize(158, 24, 10, 8)
            btnConnectWiFi.addOnTouchViewListener(self)
            inputPassPanel.addParts(btnConnectWiFi)
            self.setView(btnConnectWiFi, 'btnConnectWiFi')

            btnConnectWiFiBack = Text('<<')
            btnConnectWiFiBack.setSize(140, 24, 10, 8)
            btnConnectWiFiBack.addOnTouchViewListener(self)
            inputPassPanel.addParts(btnConnectWiFiBack)
            self.setView(btnConnectWiFiBack, 'btnConnectWiFiBack')

            self.addView(inputPassPanel)
            self.setView(inputPassPanel, 'panelInputPass')
Example #8
0
        def createSelectSecurityTypePanel():
            selectSecurityPanel = Widget(200, 32)
            selectSecurityPanel.visible = False

            securityCaption = Text('security type')
            securityCaption.setSize(0, 0, 120, 8)
            selectSecurityPanel.addParts(securityCaption)

            securityArea = Text('WPA-PSK')
            securityArea.setSize(20, 18, 140, 10)
            selectSecurityPanel.addParts(securityArea)
            self.setView(securityArea, 'securityArea')

            btnUpSec = Text('↑')
            btnUpSec.setSize(10, 12, 8, 8)
            btnUpSec.addOnTouchViewListener(self)
            btnUpSec.visible = False
            selectSecurityPanel.addParts(btnUpSec)
            self.setView(btnUpSec, 'btnUpSec')

            btnDownSec = Text('↓')
            btnDownSec.setSize(10, 23, 8, 8)
            btnDownSec.addOnTouchViewListener(self)
            selectSecurityPanel.addParts(btnDownSec)
            self.setView(btnDownSec, 'btnDownSec')

            btnSecurityOk = Text('>>')
            btnSecurityOk.setSize(158, 24, 10, 8)
            btnSecurityOk.addOnTouchViewListener(self)
            selectSecurityPanel.addParts(btnSecurityOk)
            self.setView(btnSecurityOk, 'btnSecurityOk')

            btnSecurityBack = Text('<<')
            btnSecurityBack.setSize(140, 24, 10, 8)
            btnSecurityBack.addOnTouchViewListener(self)
            selectSecurityPanel.addParts(btnSecurityBack)
            self.setView(btnSecurityBack, 'btnSecurityBack')

            self.addView(selectSecurityPanel)
            self.setView(selectSecurityPanel, 'panelSecurity')