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


Python Charset类代码示例

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


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

示例1: createPlayerLine

    def createPlayerLine(self, hbox, site, player):
        log.debug('add:"%s"' % player)
        label = gtk.Label(site + " id:")
        hbox.pack_start(label, False, False, 3)

        pname = gtk.Entry()
        pname.set_text(player)
        pname.set_width_chars(20)
        hbox.pack_start(pname, False, True, 0)
        pname.connect("changed", self.__set_hero_name, site)

        # Added EntryCompletion but maybe comboBoxEntry is more flexible? (e.g. multiple choices)
        completion = gtk.EntryCompletion()
        pname.set_completion(completion)
        liststore = gtk.ListStore(gobject.TYPE_STRING)
        completion.set_model(liststore)
        completion.set_text_column(0)
        names = self.db.get_player_names(
            self.conf, self.siteid[site]
        )  # (config=self.conf, site_id=None, like_player_name="%")
        for n in names:  # list of single-element "tuples"
            _n = Charset.to_gui(n[0])
            _nt = (_n,)
            liststore.append(_nt)

        self.__set_hero_name(pname, site)
开发者ID:sigmike,项目名称:fpdb,代码行数:26,代码来源:Filters.py

示例2: fillStatsFrame

    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,代码行数:34,代码来源:GuiRingPlayerStats.py

示例3: fillStatsFrame

    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,代码行数:33,代码来源:GuiSessionViewer.py

示例4: fillStatsFrame

    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,代码行数:30,代码来源:GuiTourneyPlayerStats.py

示例5: fillStatsFrame

    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,代码行数:42,代码来源:GuiSessionViewer.py

示例6: fillPlayerFrame

    def fillPlayerFrame(self, vbox, display):
        top_hbox = gtk.HBox(False, 0)
        vbox.pack_start(top_hbox, False, False, 0)
        lbl_title = gtk.Label(self.filterText['playerstitle'])
        lbl_title.set_alignment(xalign=0.0, yalign=0.5)
        top_hbox.pack_start(lbl_title, expand=True, padding=3)
        showb = gtk.Button(label=_("Refresh"), stock=None, use_underline=True)
        showb.set_alignment(xalign=1.0, yalign=0.5)
        showb.connect('clicked', self.__refresh, 'players')

        vbox1 = gtk.VBox(False, 0)
        vbox.pack_start(vbox1, False, False, 0)
        self.boxes['players'] = vbox1

        for site in self.conf.get_supported_sites():
            hBox = gtk.HBox(False, 0)
            vbox1.pack_start(hBox, False, True, 0)

            player = self.conf.supported_sites[site].screen_name
            _pname = Charset.to_gui(player)
            self.createPlayerLine(hBox, site, _pname)

        if "GroupsAll" in display and display["GroupsAll"] == True:
            hbox = gtk.HBox(False, 0)
            vbox1.pack_start(hbox, False, False, 0)
            cb = gtk.CheckButton(self.filterText['groupsall'])
            cb.connect('clicked', self.__set_group_select, 'allplayers')
            hbox.pack_start(cb, False, False, 0)
            self.sbGroups['allplayers'] = cb
            self.groups['allplayers'] = False

            lbl = gtk.Label(_('Min # Hands:'))
            lbl.set_alignment(xalign=1.0, yalign=0.5)
            hbox.pack_start(lbl, expand=True, padding=3)

            phands = gtk.Entry()
            phands.set_text('0')
            phands.set_width_chars(8)
            hbox.pack_start(phands, False, False, 0)
            phands.connect("changed", self.__set_num_hands, site)
        top_hbox.pack_start(showb, expand=False, padding=1)
开发者ID:kangaderoo,项目名称:fpdb-kangaderoo,代码行数:41,代码来源:Filters.py

示例7: main

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,代码行数:36,代码来源:HHReplayer.py

示例8: generateGraph

    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,代码行数:85,代码来源:GuiTourneyGraphViewer.py

示例9: generateGraph

    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,代码行数:101,代码来源:GuiBankrollGraphViewer.py

示例10: generateGraph

    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,代码行数:101,代码来源:GuiGraphViewer.py

示例11: generateGraph

    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,代码行数:96,代码来源:GuiTourneyGraphViewer.py

示例12: do_tip

def do_tip(widget, tip):
    _tip = Charset.to_utf8(tip)
    widget.set_tooltip_text(_tip)
开发者ID:CountLuckula,项目名称:FPDB-for-OSX,代码行数:3,代码来源:Stats.py

示例13: generateGraph

    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,代码行数:101,代码来源:GuiGraphViewer.py

示例14: generateGraph

    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,代码行数:101,代码来源:GuiGraphViewer.py

示例15: generateGraph

    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,代码行数:101,代码来源:GuiTourneyGraphViewer.py


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