当前位置: 首页>>代码示例>>Python>>正文


Python Charset.to_utf8方法代码示例

本文整理汇总了Python中Charset.to_utf8方法的典型用法代码示例。如果您正苦于以下问题:Python Charset.to_utf8方法的具体用法?Python Charset.to_utf8怎么用?Python Charset.to_utf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Charset的用法示例。


在下文中一共展示了Charset.to_utf8方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fillStatsFrame

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def fillStatsFrame(self, vbox):
        sites = self.filters.getSites()
        heroes = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        limits  = self.filters.getLimits()
        seats  = self.filters.getSeats()
        sitenos = []
        playerids = []

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _q = self.sql.query['getPlayerId']
                _name = Charset.to_utf8(heroes[site])
                #print 'DEBUG(_name) :: %s' % _name
                self.cursor.execute(_q, (_name,)) # arg = tuple
                result = self.db.cursor.fetchall()
                if len(result) == 1:
                    playerids.append(result[0][0])

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            sitenos = [2]
        if not playerids:
            print _("No player ids found")
            return
        if not limits:
            print _("No limits found")
            return

        self.createStatsPane(vbox, playerids, sitenos, limits, seats)
开发者ID:grindi,项目名称:fpdb-grindi,代码行数:35,代码来源:GuiSessionViewer.py

示例2: fillStatsFrame

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def fillStatsFrame(self, vbox):
        sites = self.filters.getSites()
        heroes = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        limits  = self.filters.getLimits()
        type   = self.filters.getType()
        seats  = self.filters.getSeats()
        groups = self.filters.getGroups()
        dates = self.filters.getDates()
        games = self.filters.getGames()
        sitenos = []
        playerids = []

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            sitenos = [2]
        if not playerids:
            print _("No player ids found")
            return
        if not limits:
            print _("No limits found")
            return

        self.createStatsTable(vbox, playerids, sitenos, limits, type, seats, groups, dates, games)
开发者ID:kangaderoo,项目名称:fpdb-kangaderoo,代码行数:36,代码来源:GuiRingPlayerStats.py

示例3: fillStatsFrame

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def fillStatsFrame(self, vbox):
        tourneyTypes = self.filters.getTourneyTypes()
        #tourneys = self.tourneys.getTourneys()
        sites = self.filters.getSites()
        heroes = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        seats  = self.filters.getSeats()
        dates = self.filters.getDates()
        sitenos = []
        playerids = []
        tourneysName = []

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            sitenos = [2]
        if not playerids:
            print _("No player ids found")
            return
        
        self.createStatsTable(vbox, tourneyTypes, playerids, sitenos, seats)
开发者ID:bagage,项目名称:fpdb,代码行数:32,代码来源:GuiTourneyPlayerStats.py

示例4: fillStatsFrame

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def fillStatsFrame(self, vbox):
        sites = self.filters.getSites()
        heroes = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        games  = self.filters.getGames()
        currencies = self.filters.getCurrencies()
        limits  = self.filters.getLimits()
        seats  = self.filters.getSeats()
        sitenos = []
        playerids = []

        for i in ('show', 'none'):
            if i in limits:
                limits.remove(i)

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(result)

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            sitenos = [2]
        if not games:
            print _("No games found")
            return
        if not currencies:
            print _("No currencies found")
            return
        if not playerids:
            print _("No player ids found")
            return
        if not limits:
            print _("No limits found")
            return

        self.createStatsPane(vbox, playerids, sitenos, games, currencies, limits, seats)
开发者ID:alexsuslin,项目名称:FPDB,代码行数:44,代码来源:GuiSessionViewer.py

示例5: main

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
def main():
    #Initialize Everything
    pygame.init()
    clock = pygame.time.Clock()
    screen = pygame.display.set_mode((640, 480))
    table_no = 1
    table_title = "Valparaíso / aaaaaaaaaaaaaaaaa"
    pygame.display.set_caption(Charset.to_utf8(table_title))
    pygame.mouse.set_visible(0)

    # Load background image
    bgimage, rect = load_image('../gfx/Table.png')
    background = pygame.Surface(screen.get_size())
    background.blit(bgimage, (0, 0))

    #Put Text On The Background, Centered
    if pygame.font:
        font = pygame.font.Font(None, 24)
        text = font.render("Yarmouth Texas Hold'em NL -$0.01/$0.02", 1, (10, 10, 10))
        textpos = text.get_rect(centerx=background.get_width()/2)
        background.blit(text, textpos)

    #Display The Background
    screen.blit(background, (0, 0))
    pygame.display.flip()

    going = True
    while going:
        clock.tick(6000)
        # Draw 
        screen.blit(background, (0, 0))
        # Change table #
        #table_no += 1
        #table_title = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" % table_no
        #pygame.display.set_caption(table_title)
        time.sleep(10)
开发者ID:Fulvio75,项目名称:fpdb,代码行数:38,代码来源:HHReplayer.py

示例6: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        self.clearGraphData()

        sitenos = []
        playerids = []

        sites   = self.filters.getSites()
        heroes  = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            self.db.rollback()
            return

        if not playerids:
            print _("No player ids found")
            self.db.rollback()
            return

        #Set graph properties
        self.ax = self.fig.add_subplot(111)

        #Get graph data from DB
        starttime = time()
        green = self.getData(playerids, sitenos)
        print _("Graph generated in: %s") %(time() - starttime)


        #Set axis labels and grid overlay properites
        self.ax.set_xlabel(_("Tournaments"), fontsize = 12)
        self.ax.set_ylabel("$", fontsize = 12)
        self.ax.grid(color='g', linestyle=':', linewidth=0.2)
        if green == None or green == []:
            self.ax.set_title(_("No Data for Player(s) Found"))
            green = ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        500.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,
                        1000., 1000.,  1000.,  1000.,  1000.,  1000.,   875.,   750.,
                        625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            red   =  ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        0.,   0.,     0.,     0.,     0.,     0.,   125.,   250.,
                        375.,   500.,   500.,   500.,   500.,   500.,   500.,   500.,
                        500.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            blue =    ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                          700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                          0.,     0.,     0.,     0.,     0.,     0.,   125.,   250.,
                          375.,   500.,   625.,   750.,   875.,  1000.,   875.,   750.,
                          625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])

            self.ax.plot(green, color='green', label=_('Tournaments') + ': %d\n' % len(green) + _('Profit') + ': $%.2f' % green[-1])
            self.graphBox.add(self.canvas)
            self.canvas.show()
            self.canvas.draw()

            #TODO: Do something useful like alert user
        else:
            self.ax.set_title(_("Tournament Results"))

            #Draw plot
            self.ax.plot(green, color='green', label=_('Tournaments') + ': %d\n' % len(green) + _('Profit') + ': $%.2f' % green[-1])

            legend = self.ax.legend(loc='upper left', fancybox=True, shadow=True, prop=FontProperties(size='smaller'))
            legend.draggable(True)
            
            self.graphBox.add(self.canvas)
            self.canvas.show()
            self.canvas.draw()
开发者ID:Tuxik,项目名称:fpdb,代码行数:87,代码来源:GuiTourneyGraphViewer.py

示例7: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        self.clearGraphData()

        sitenos = []
        playerids = []

        sites   = self.filters.getSites()
        heroes  = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            self.db.rollback()
            return

        if not playerids:
            print _("No player ids found")
            self.db.rollback()
            return

        #Set graph properties
        self.ax = self.fig.add_subplot(111)

        #Get graph data from DB
        starttime = time()
        (green, dates, transfersAmount, transfersDate, transferType) = self.getData(playerids, sitenos)
        print _("Graph generated in: %s") %(time() - starttime)


        #Set axis labels and grid overlay properites
        self.ax.set_ylabel("$", fontsize = 12)
        self.ax.grid(color='g', linestyle=':', linewidth=0.2)

        if green == None or green == []:
            self.ax.set_title(_("No Data for Player(s) Found"))
            green = ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        500.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,
                        1000., 1000.,  1000.,  1000.,  1000.,  1000.,   875.,   750.,
                        625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            red   =  ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        0.,   0.,     0.,     0.,     0.,     0.,   125.,   250.,
                        375.,   500.,   500.,   500.,   500.,   500.,   500.,   500.,
                        500.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            blue =    ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                          700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                          0.,     0.,     0.,     0.,     0.,     0.,   125.,   250.,
                          375.,   500.,   625.,   750.,   875.,  1000.,   875.,   750.,
                          625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])

            self.ax.plot(green, color='green', label=_('Bankroll') + _('Profit') + ': $%.2f' % green[-1])
            self.graphBox.add(self.canvas)
            self.canvas.show()
            self.canvas.draw()

            #TODO: Do something useful like alert user
        else:
            self.ax.set_title(_("Bankroll Results"))
            useDates = True

            #nothing to draw
            if (len(green) == 0):
                return
            #Get the dates of the action (transfert / cg hand / tourney)
            #if it has no date, get the most ancient date and assume it's its one
            if dates[0] is None:
                i = 1
                while i < len(dates) and type(dates[i]) is None:
                    i = i+1
                if i == len(dates):
                    print "Wow wow wow : no dates in your whole database"
                    useDates = False
                else:
                    dates[0] = dates[i]

            #now, convert date to dateTime format
            if useDates:
                for i in range(0, len(dates)):
                    if dates[i] is None:
                        dates[i] = dates[i-1]
                    #~else:
                        #~dates[i] = datetime.datetime.strptime(dates[i], "%Y-%m-%d %H:%M:%S")

#.........这里部分代码省略.........
开发者ID:bagage,项目名称:fpdb,代码行数:103,代码来源:GuiBankrollGraphViewer.py

示例8: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        self.clearGraphData()

        sitenos = []
        playerids = []

        sites = self.filters.getSites()
        heroes = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        limits = self.filters.getLimits()
        games = self.filters.getGames()
        currencies = self.filters.getCurrencies()
        graphops = self.filters.getGraphOps()
        names = ""

        for i in ("show", "none"):
            if i in limits:
                limits.remove(i)
        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))
                    names = names + "\n" + _hname + " on " + site

        if not sitenos:
            # Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            self.db.rollback()
            return

        if not playerids:
            print _("No player ids found")
            self.db.rollback()
            return

        if not limits:
            print _("No limits found")
            self.db.rollback()
            return

        # Set graph properties
        self.ax = self.fig.add_subplot(111)

        # Get graph data from DB
        starttime = time()
        (green, blue, red, orange) = self.getRingProfitGraph(
            playerids, sitenos, limits, games, currencies, graphops["dspin"]
        )
        print _("Graph generated in: %s") % (time() - starttime)

        # Set axis labels and grid overlay properites
        self.ax.set_xlabel(_("Hands"))
        # SET LABEL FOR X AXIS
        self.ax.set_ylabel(graphops["dspin"])
        self.ax.grid(color="g", linestyle=":", linewidth=0.2)
        if green == None or green == []:
            self.ax.set_title(_("No Data for Player(s) Found"))
            green = [
                0.0,
                0.0,
                0.0,
                0.0,
                500.0,
                1000.0,
                900.0,
                800.0,
                700.0,
                600.0,
                500.0,
                400.0,
                300.0,
                200.0,
                100.0,
                0.0,
                500.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                1000.0,
                875.0,
                750.0,
                625.0,
                500.0,
                375.0,
                250.0,
                125.0,
                0.0,
#.........这里部分代码省略.........
开发者ID:gempacked,项目名称:fpdb,代码行数:103,代码来源:GuiGraphViewer.py

示例9: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        try:
            self.clearGraphData()

            sitenos = []
            playerids = []

            sites   = self.filters.getSites()
            heroes  = self.filters.getHeroes()
            siteids = self.filters.getSiteIds()
            
            # Which sites are selected?
            for site in sites:
                if sites[site] == True:
                    sitenos.append(siteids[site])
                    _hname = Charset.to_utf8(heroes[site])
                    result = self.db.get_player_id(self.conf, site, _hname)
                    if result is not None:
                        playerids.append(int(result))

            if not sitenos:
                #Should probably pop up here.
                print _("No sites selected - defaulting to PokerStars")
                self.db.rollback()
                return

            if not playerids:
                print _("No player ids found")
                self.db.rollback()
                return

            #Set graph properties
            self.ax = self.fig.add_subplot(111)

            #Get graph data from DB
            starttime = time()
            green = self.getData(playerids, sitenos)
            print _("Graph generated in: %s") %(time() - starttime)


            #Set axis labels and grid overlay properites
            self.ax.set_xlabel(_("Tournaments"), fontsize = 12)
            self.ax.set_ylabel("$", fontsize = 12)
            self.ax.grid(color='g', linestyle=':', linewidth=0.2)
            if green == None or green == []:
                self.ax.set_title(_("No Data for Player(s) Found"))
                green = ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                            700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                            500.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,
                            1000., 1000.,  1000.,  1000.,  1000.,  1000.,   875.,   750.,
                            625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                            0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                            400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
                red   =  ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                            700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                            0.,   0.,     0.,     0.,     0.,     0.,   125.,   250.,
                            375.,   500.,   500.,   500.,   500.,   500.,   500.,   500.,
                            500.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                            0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                            400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
                blue =    ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                              700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                              0.,     0.,     0.,     0.,     0.,     0.,   125.,   250.,
                              375.,   500.,   625.,   750.,   875.,  1000.,   875.,   750.,
                              625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                            0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                            400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])

                self.ax.plot(green, color='green', label=_('Tournaments: %d\nProfit: $%.2f') %(len(green), green[-1]))
                #self.ax.plot(blue, color='blue', label=_('Showdown: $%.2f') %(blue[-1]))
                #self.ax.plot(red, color='red', label=_('Non-showdown: $%.2f') %(red[-1]))
                self.graphBox.add(self.canvas)
                self.canvas.show()
                self.canvas.draw()

                #TODO: Do something useful like alert user
                #print "No hands returned by graph query"
            else:
                self.ax.set_title(_("Tournament Results"))

                #Draw plot
                self.ax.plot(green, color='green', label=_('Tournaments: %d\nProfit: $%.2f') %(len(green), green[-1]))
                #self.ax.plot(blue, color='blue', label=_('Showdown: $%.2f') %(blue[-1]))
                #self.ax.plot(red, color='red', label=_('Non-showdown: $%.2f') %(red[-1]))
                if sys.version[0:3] == '2.5':
                    self.ax.legend(loc='upper left', shadow=True, prop=FontProperties(size='smaller'))
                else:
                    self.ax.legend(loc='upper left', fancybox=True, shadow=True, prop=FontProperties(size='smaller'))

                self.graphBox.add(self.canvas)
                self.canvas.show()
                self.canvas.draw()
                #self.exportButton.set_sensitive(True)
        except:
            err = traceback.extract_tb(sys.exc_info()[2])[-1]
            print _("Error:")+" "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
开发者ID:kangaderoo,项目名称:fpdb-kangaderoo,代码行数:98,代码来源:GuiTourneyGraphViewer.py

示例10: do_tip

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
def do_tip(widget, tip):
    _tip = Charset.to_utf8(tip)
    widget.set_tooltip_text(_tip)
开发者ID:CountLuckula,项目名称:FPDB-for-OSX,代码行数:5,代码来源:Stats.py

示例11: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        self.clearGraphData()

        sitenos = []
        playerids = []

        sites   = self.filters.getSites()
        heroes  = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        limits  = self.filters.getLimits()
        games   = self.filters.getGames()
        currencies = self.filters.getCurrencies()
        graphops = self.filters.getGraphOps()
        names   = ""

        for i in ('show', 'none'):
            if i in limits:
                limits.remove(i)
        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))
                    names = names + "\n"+_hname + " on "+site

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            self.db.rollback()
            return

        if not playerids:
            print _("No player ids found")
            self.db.rollback()
            return

        if not limits:
            print _("No limits found")
            self.db.rollback()
            return

        #Set graph properties
        self.ax = self.fig.add_subplot(111)

        #Get graph data from DB
        starttime = time()
        (green, blue, red, orange) = self.getRingProfitGraph(playerids, sitenos, limits, games, currencies, graphops['dspin'])
        print _("Graph generated in: %s") %(time() - starttime)

        #Set axis labels and grid overlay properites
        self.ax.set_xlabel(_("Hands"))
        # SET LABEL FOR X AXIS
        self.ax.set_ylabel(graphops['dspin'])
        self.ax.grid(color='g', linestyle=':', linewidth=0.2)
        if green == None or green == []:
            self.ax.set_title(_("No Data for Player(s) Found"))
            green = ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        500.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,
                        1000., 1000.,  1000.,  1000.,  1000.,  1000.,   875.,   750.,
                        625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            red   =  ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        0.,   0.,     0.,     0.,     0.,     0.,   125.,   250.,
                        375.,   500.,   500.,   500.,   500.,   500.,   500.,   500.,
                        500.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            blue =    ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                          700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                          0.,     0.,     0.,     0.,     0.,     0.,   125.,   250.,
                          375.,   500.,   625.,   750.,   875.,  1000.,   875.,   750.,
                          625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])

            self.ax.plot(green, color='green', label=_('Hands') + ': %d\n' % len(green) + _('Profit') + ': %.2f' % green[-1])
            self.ax.plot(blue, color='blue', label=_('Showdown') + ': $%.2f' %(blue[-1]))
            self.ax.plot(red, color='red', label=_('Non-showdown') + ': $%.2f' %(red[-1]))
            self.graphBox.add(self.canvas)
            self.canvas.show()
            self.canvas.draw()
        else:
            self.ax.set_title((_("Profit graph for ring games")+names))

            #Draw plot
            self.ax.plot(green, color='green', label=_('Hands') + ': %d\n' % len(green) + _('Profit') + ': (%s): %.2f' % (graphops['dspin'], green[-1]))
            if graphops['showdown'] == 'ON':
                self.ax.plot(blue, color='blue', label=_('Showdown') + ' (%s): %.2f' %(graphops['dspin'], blue[-1]))
            if graphops['nonshowdown'] == 'ON':
                self.ax.plot(red, color='red', label=_('Non-showdown') + ' (%s): %.2f' %(graphops['dspin'], red[-1]))
            if graphops['ev'] == 'ON':
                self.ax.plot(orange, color='orange', label=_('All-in EV') + ' (%s): %.2f' %(graphops['dspin'], orange[-1]))

            if sys.version[0:3] == '2.5':
#.........这里部分代码省略.........
开发者ID:forrestdg,项目名称:fpdb,代码行数:103,代码来源:GuiGraphViewer.py

示例12: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        try:
            self.clearGraphData()

            sitenos = []
            playerids = []

            sites   = self.filters.getSites()
            heroes  = self.filters.getHeroes()
            siteids = self.filters.getSiteIds()
            limits  = self.filters.getLimits()
            games   = self.filters.getGames()
            
            for i in ('show', 'none'):
                if i in limits:
                    limits.remove(i)
            # Which sites are selected?
            for site in sites:
                if sites[site] == True:
                    sitenos.append(siteids[site])
                    _hname = Charset.to_utf8(heroes[site])
                    result = self.db.get_player_id(self.conf, site, _hname)
                    if result is not None:
                        playerids.append(int(result))

            if not sitenos:
                #Should probably pop up here.
                print "No sites selected - defaulting to PokerStars"
                self.db.rollback()
                return

            if not playerids:
                print "No player ids found"
                self.db.rollback()
                return

            if not limits:
                print "No limits found"
                self.db.rollback()
                return

            #Set graph properties
            self.ax = self.fig.add_subplot(111)

            #Get graph data from DB
            starttime = time()
            (green, blue, red) = self.getRingProfitGraph(playerids, sitenos, limits, games)
            print "Graph generated in: %s" %(time() - starttime)


            #Set axis labels and grid overlay properites
            self.ax.set_xlabel("Hands", fontsize = 12)
            self.ax.set_ylabel("$", fontsize = 12)
            self.ax.grid(color='g', linestyle=':', linewidth=0.2)
            if green == None or green == []:
                self.ax.set_title("No Data for Player(s) Found")
                green = ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                            700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                            500.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,
                            1000., 1000.,  1000.,  1000.,  1000.,  1000.,   875.,   750.,
                            625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                            0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                            400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
                red   =  ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                            700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                            0.,   0.,     0.,     0.,     0.,     0.,   125.,   250.,
                            375.,   500.,   500.,   500.,   500.,   500.,   500.,   500.,
                            500.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                            0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                            400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
                blue =    ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                              700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                              0.,     0.,     0.,     0.,     0.,     0.,   125.,   250.,
                              375.,   500.,   625.,   750.,   875.,  1000.,   875.,   750.,
                              625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                            0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                            400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])

                self.ax.plot(green, color='green', label='Hands: %d\nProfit: $%.2f' %(len(green), green[-1]))
                self.ax.plot(blue, color='blue', label='Showdown: $%.2f' %(blue[-1]))
                self.ax.plot(red, color='red', label='Non-showdown: $%.2f' %(red[-1]))
                self.graphBox.add(self.canvas)
                self.canvas.show()
                self.canvas.draw()

                #TODO: Do something useful like alert user
                #print "No hands returned by graph query"
            else:
                self.ax.set_title("Profit graph for ring games")
                #text = "Profit: $%.2f\nTotal Hands: %d" %(green[-1], len(green))
                #self.ax.annotate(text,
                #                 xy=(10, -10),
                #                 xycoords='axes points',
                #                 horizontalalignment='left', verticalalignment='top',
                #                 fontsize=10)

                #Draw plot
                self.ax.plot(green, color='green', label='Hands: %d\nProfit: $%.2f' %(len(green), green[-1]))
                self.ax.plot(blue, color='blue', label='Showdown: $%.2f' %(blue[-1]))
                self.ax.plot(red, color='red', label='Non-showdown: $%.2f' %(red[-1]))
#.........这里部分代码省略.........
开发者ID:sigmike,项目名称:fpdb,代码行数:103,代码来源:GuiGraphViewer.py

示例13: generateGraph

# 需要导入模块: import Charset [as 别名]
# 或者: from Charset import to_utf8 [as 别名]
    def generateGraph(self, widget, data):
        self.clearGraphData()

        sitenos = []
        playerids = []

        sites   = self.filters.getSites()
        heroes  = self.filters.getHeroes()
        siteids = self.filters.getSiteIds()
        currencies = self.filters.getCurrencies()

        # Which sites are selected?
        for site in sites:
            if sites[site] == True:
                sitenos.append(siteids[site])
                _hname = Charset.to_utf8(heroes[site])
                result = self.db.get_player_id(self.conf, site, _hname)
                if result is not None:
                    playerids.append(int(result))

        if not sitenos:
            #Should probably pop up here.
            print _("No sites selected - defaulting to PokerStars")
            self.db.rollback()
            return

        if not playerids:
            print _("No player ids found")
            self.db.rollback()
            return

        #Set graph properties
        self.ax = self.fig.add_subplot(111)

        #Get graph data from DB
        starttime = time()
        (green, datesXAbs) = self.getData(playerids, sitenos, currencies)
        print _("Graph generated in: %s") %(time() - starttime)

        currencyLabel = ','.join(['%s' % key for key in currencies.keys()])

        #Set axis labels and grid overlay properites
        self.ax.set_ylabel(currencyLabel, fontsize = 12)
        self.ax.grid(color='g', linestyle=':', linewidth=0.2)
        if green == None or green == []:
            self.ax.set_title(_("No Data for Player(s) Found"))
            green = ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        500.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,  1000.,
                        1000., 1000.,  1000.,  1000.,  1000.,  1000.,   875.,   750.,
                        625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            red   =  ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                        700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                        0.,   0.,     0.,     0.,     0.,     0.,   125.,   250.,
                        375.,   500.,   500.,   500.,   500.,   500.,   500.,   500.,
                        500.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])
            blue =    ([    0.,     0.,     0.,     0.,   500.,  1000.,   900.,   800.,
                          700.,   600.,   500.,   400.,   300.,   200.,   100.,     0.,
                          0.,     0.,     0.,     0.,     0.,     0.,   125.,   250.,
                          375.,   500.,   625.,   750.,   875.,  1000.,   875.,   750.,
                          625.,   500.,   375.,   250.,   125.,     0.,     0.,     0.,
                        0.,   500.,  1000.,   900.,   800.,   700.,   600.,   500.,
                        400.,   300.,   200.,   100.,     0.,   500.,  1000.,  1000.])

            self.ax.plot(green, color='green', label=_('Tournaments') + ': %d\n' % len(green) + _('Profit') + '(' + currencyLabel + '): %.2f' % green[-1])
            self.graphBox.add(self.canvas)
            self.canvas.show()
            self.canvas.draw()

            #TODO: Do something useful like alert user
        else:
            self.ax.set_title(_("Tournament Results"))
            useDates = True

            #nothing to draw
            if (len(green) == 0):
                return
            #Get the dates of tourneys
            #if first tourney has no date, get the most ancient date and assume it's his one
            if datesXAbs[0] is None:
                i = 1
                while i < len(datesXAbs) and type(datesXAbs[i]) is None:
                    i = i+1
                if i == len(datesXAbs):
                    print "Wow wow wow : no dates in your whole tourneys"
                    useDates = False
                else:
                    datesXAbs[0] = datesXAbs[i]

            #now convert date to dateTime format
            if useDates:
                for i in range(0, len(datesXAbs)):
                    if datesXAbs[i] is None:
                        datesXAbs[i] = datesXAbs[i-1]
                    else:
                        datesXAbs[i] = datetime.datetime.strptime(datesXAbs[i], "%Y-%m-%d %H:%M:%S")
#.........这里部分代码省略.........
开发者ID:bagage,项目名称:fpdb,代码行数:103,代码来源:GuiTourneyGraphViewer.py


注:本文中的Charset.to_utf8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。