예제 #1
0
파일: page.py 프로젝트: WayneSan/launcher
    def Adjust(self):  ## default init way,
        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

        if self._Align == ALIGN["HLeft"]:
            start_x = (self._Width -
                       self._IconNumbers * icon_width) / 2 + icon_width / 2
            start_y = self._Height / 2

            for i in range(0, self._IconNumbers):
                it = self._Icons[i]
                it._Parent = self
                it._Index = i
                it.Adjust(start_x + i * icon_width, start_y, icon_width,
                          icon_height, 0)

            ps = PageSelector()
            ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
            ps._Parent = self
            ps.Init(start_x, start_y, 92, 92, 128)
            self._Ps = ps
            self._PsIndex = 0
            self._OnShow = False
        elif self._Align == ALIGN["SLeft"]:
            start_x = (self._PageIconMargin + icon_width +
                       self._PageIconMargin) / 2
            start_y = self._Height / 2

            for i in range(0, self._IconNumbers):
                it = self._Icons[i]
                it._Parent = self
                it._Index = i
                it.Adjust(start_x + i * self._PageIconMargin + i * icon_width,
                          start_y, icon_width, icon_height, 0)

            ps = PageSelector()
            ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
            ps._Parent = self
            ps.Init(start_x, start_y - self._SelectedIconTopOffset, 92, 92,
                    128)

            self._Ps = ps
            self._PsIndex = 0
            self._OnShow = False

            if self._IconNumbers > 1:
                self._PsIndex = 1
                self._IconIndex = self._PsIndex
                self._PrevIconIndex = self._IconIndex
                self._Icons[
                    self._IconIndex]._PosY -= self._SelectedIconTopOffset
예제 #2
0
파일: page.py 프로젝트: WayneSan/launcher
    def Init(self):  ## default init way,
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._CanvasHWND = self._Screen._CanvasHWND

        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

        start_x = (self._Width -
                   self._IconNumbers * icon_width) / 2 + icon_width / 2
        start_y = self._Height / 2

        for i in range(0, self._IconNumbers):
            it = IconItem()
            it._Parent = self
            it._Index = i
            it.Init(start_x + i * icon_width, start_y, icon_width, icon_height,
                    0)
            self._Icons.append(it)

        if self._IconNumbers > 0:
            ps = PageSelector()
            ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
            ps._Parent = self
            ps.Init(start_x, start_y, icon_width + 4, icon_height + 4, 128)
            self._Ps = ps
            self._PsIndex = 0
            self._OnShow = False
예제 #3
0
파일: page.py 프로젝트: WayneSan/launcher
    def InitLeftAlign(self):
        self._PosX = self._Index * Width
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        cols = int(self._Width / icon_width)
        rows = int((self._IconNumbers * icon_width) / self._Width + 1)
        if rows < 1:
            rows = 1
        cnt = 0
        for i in range(0, rows):
            for j in range(0, cols):
                start_x = icon_width / 2 + j * icon_width
                start_y = TitleBar._BarHeight + icon_height / 2 + i * icon_height
                icon = IconItem()
                icon.Init(start_x, start_y, icon_width - 4, icon_height - 4, 0)
                icon._Index = cnt
                icon._Parent = self
                self._Icons.append(icon)
                if cnt >= (self._IconNumbers - 1):
                    break
                cnt += 1

        ps = PageSelector()
        ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
        ps._Parent = self
        ps.Init(icon_width / 2, icon_height / 2, 92, 92, 128)
        self._Ps = ps
        self._PsIndex = 0
        self._OnShow = False
예제 #4
0
파일: page.py 프로젝트: WayneSan/launcher
    def AdjustSLeftAlign(
            self):  ## adjust coordinator and append the PageSelector
        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        start_x = (self._PageIconMargin + icon_width +
                   self._PageIconMargin) / 2
        start_y = self._Height / 2

        for i in range(0, self._IconNumbers):
            it = self._Icons[i]
            it._Parent = self
            it._Index = i
            it.Adjust(start_x + i * self._PageIconMargin + i * icon_width,
                      start_y, icon_width - 6, icon_height - 6, 0)
            it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,
                                                       (it._Width, it._Height))

        ps = PageSelector()
        ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
        ps._Parent = self
        ps.Init(start_x, start_y, 92, 92, 128)

        self._Ps = ps
        self._PsIndex = 0
        self._OnShow = False

        if self._IconNumbers > 1:
            self._PsIndex = 1
            self._IconIndex = self._PsIndex
            self._PrevIconIndex = self._IconIndex
            self._Icons[self._IconIndex]._PosY -= self._SelectedIconTopOffset
예제 #5
0
파일: page.py 프로젝트: WayneSan/launcher
    def AdjustHLeftAlign(
            self):  ## adjust coordinator and append the PageSelector
        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        cols = int(Width / icon_width)
        rows = int((self._IconNumbers * icon_width) / Width + 1)
        if rows < 1:
            rows = 1

        cnt = 0

        for i in range(0, rows):
            for j in range(0, cols):
                start_x = icon_width / 2 + j * icon_width
                start_y = icon_height / 2 + i * icon_height
                icon = self._Icons[cnt]
                icon.Adjust(start_x, start_y, icon_width - 4, icon_height - 4,
                            0)
                icon._Index = cnt
                icon._Parent = self
                if cnt >= (self._IconNumbers - 1):
                    break
                cnt += 1

        ps = PageSelector()
        ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
        ps._Parent = self
        ps.Init(icon_width / 2, TitleBar._BarHeight + icon_height / 2, 92, 92,
                128)
        self._Ps = ps
        self._PsIndex = 0
        self._OnShow = False
예제 #6
0
    def Init(self, screen):
        self._HWND = screen
        self._CanvasHWND = pygame.Surface((Width, int(self._BarHeight)))

        self.ReadFootBarIcons(icon_base_path)

        round_corners = MultiIconItem()
        round_corners._IconWidth = 10
        round_corners._IconHeight = 10

        round_corners._MyType = ICON_TYPES["STAT"]
        round_corners._Parent = self
        round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
        round_corners.Adjust(0, 0, 10, 10, 0)

        self._Icons["round_corners"] = round_corners
예제 #7
0
    def Init(self, screen):

        start_x = 0
        self._CanvasHWND = pygame.Surface((self._Width, self._Height))
        self._HWND = screen

        icon_wifi_status = MultiIconItem()
        icon_wifi_status._MyType = ICON_TYPES["STAT"]
        icon_wifi_status._ImageName = icon_base_path + "wifi.png"
        icon_wifi_status._Parent = self
        icon_wifi_status.Adjust(
            start_x + self._icon_width + 5,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)
        self._Icons["wifistatus"] = icon_wifi_status

        battery_charging = MultiIconItem()
        battery_charging._MyType = ICON_TYPES["STAT"]
        battery_charging._Parent = self
        battery_charging._ImageName = icon_base_path + "withcharging.png"
        battery_charging.Adjust(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)

        self._Icons["battery_charging"] = battery_charging

        battery_discharging = MultiIconItem()
        battery_discharging._MyType = ICON_TYPES["STAT"]
        battery_discharging._Parent = self
        battery_discharging._ImageName = icon_base_path + "without_charging.png"
        battery_discharging.Adjust(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)

        self._Icons["battery_discharging"] = battery_discharging

        battery_unknown = IconItem()
        battery_unknown._MyType = ICON_TYPES["STAT"]
        battery_unknown._Parent = self
        battery_unknown._ImageName = icon_base_path + "battery_unknown.png"
        battery_unknown.Adjust(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)

        self._Icons["battery_unknown"] = battery_unknown

        self.CheckBatteryStat()

        sound_volume = MultiIconItem()
        sound_volume._MyType = ICON_TYPES["STAT"]
        sound_volume._Parent = self
        sound_volume._ImageName = icon_base_path + "soundvolume.png"
        sound_volume.Adjust(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)

        self._Icons["soundvolume"] = sound_volume

        self.SyncSoundVolume()

        bluetooth = MultiIconItem()
        bluetooth._MyType = ICON_TYPES["STAT"]
        bluetooth._Parent = self
        bluetooth._ImageName = icon_base_path + "bluetooth.png"
        bluetooth.Adjust(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)

        self._Icons["bluetooth"] = bluetooth
        self.CheckBluetooth()

        round_corners = MultiIconItem()
        round_corners._IconWidth = 10
        round_corners._IconHeight = 10

        round_corners._MyType = ICON_TYPES["STAT"]
        round_corners._Parent = self
        round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
        round_corners.Adjust(0, 0, 10, 10, 0)

        self._Icons["round_corners"] = round_corners

        dlstatus = MultiIconItem()
        dlstatus._MyType = ICON_TYPES["STAT"]
        dlstatus._Parent = self
        if FileExists(icon_base_path + "dlstatus18.png"):
            dlstatus._ImageName = icon_base_path + "dlstatus18.png"
        dlstatus.Adjust(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2,
            self._icon_width, self._icon_height, 0)

        self._Icons["dlstatus"] = dlstatus
        self.UpdateDownloadStatus()

        if is_wifi_connected_now():
            print("wifi is connected")
            print(wifi_strength())
        else:
            out = commands.getstatusoutput(
                'sudo rfkill list | grep yes | cut -d " " -f3')
            if out[1] == "yes":
                self._InAirPlaneMode = True
            else:
                self._InAirPlaneMode = False