Merge branch 'master' of git://git.assembla.com/fpdboz
This commit is contained in:
		
						commit
						6883e5c6e3
					
				| 
						 | 
					@ -382,6 +382,7 @@ class Database:
 | 
				
			||||||
                    print msg
 | 
					                    print msg
 | 
				
			||||||
                    raise FpdbError(msg)
 | 
					                    raise FpdbError(msg)
 | 
				
			||||||
        elif backend == Database.SQLITE:
 | 
					        elif backend == Database.SQLITE:
 | 
				
			||||||
 | 
					            create = True
 | 
				
			||||||
            import sqlite3
 | 
					            import sqlite3
 | 
				
			||||||
            if use_pool:
 | 
					            if use_pool:
 | 
				
			||||||
                sqlite3 = pool.manage(sqlite3, pool_size=1)
 | 
					                sqlite3 = pool.manage(sqlite3, pool_size=1)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -505,9 +505,14 @@ class DerivedStats():
 | 
				
			||||||
        """Returns true if player bet/raised the street as their first action"""
 | 
					        """Returns true if player bet/raised the street as their first action"""
 | 
				
			||||||
        betOrRaise = False
 | 
					        betOrRaise = False
 | 
				
			||||||
        for act in self.hand.actions[street]:
 | 
					        for act in self.hand.actions[street]:
 | 
				
			||||||
            if act[0] == player and act[1] in ('bets', 'raises'):
 | 
					            if act[0] == player:
 | 
				
			||||||
 | 
					                if act[1] in ('bets', 'raises'):
 | 
				
			||||||
                    betOrRaise = True
 | 
					                    betOrRaise = True
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
 | 
					                    # player found but did not bet or raise as their first action
 | 
				
			||||||
 | 
					                    pass
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
 | 
					            #else:
 | 
				
			||||||
 | 
					                # haven't found player's first action yet
 | 
				
			||||||
        return betOrRaise
 | 
					        return betOrRaise
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,11 @@ log = logging.getLogger("logview")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAX_LINES = 100000         # max lines to display in window
 | 
					MAX_LINES = 100000         # max lines to display in window
 | 
				
			||||||
EST_CHARS_PER_LINE = 150   # used to guesstimate number of lines in log file
 | 
					EST_CHARS_PER_LINE = 150   # used to guesstimate number of lines in log file
 | 
				
			||||||
 | 
					LOGFILES = [ [ 'Fpdb Errors', 'fpdb-errors.txt', False ]  # label, filename, start value
 | 
				
			||||||
 | 
					           , [ 'Fpdb Log',    'fpdb-log.txt',    True ]
 | 
				
			||||||
 | 
					           , [ 'HUD Errors',  'HUD-errors.txt',  False ]
 | 
				
			||||||
 | 
					           , [ 'HUD Log',     'HUD-log.txt',     False ]
 | 
				
			||||||
 | 
					           ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GuiLogView:
 | 
					class GuiLogView:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +46,7 @@ class GuiLogView:
 | 
				
			||||||
        self.main_window = mainwin
 | 
					        self.main_window = mainwin
 | 
				
			||||||
        self.closeq = closeq
 | 
					        self.closeq = closeq
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.logfile = self.config.log_file    # name of logfile
 | 
					        self.logfile = os.path.join(self.config.dir_log, LOGFILES[1][1])
 | 
				
			||||||
        self.dia = gtk.Dialog(title="Log Messages"
 | 
					        self.dia = gtk.Dialog(title="Log Messages"
 | 
				
			||||||
                             ,parent=None
 | 
					                             ,parent=None
 | 
				
			||||||
                             ,flags=gtk.DIALOG_DESTROY_WITH_PARENT
 | 
					                             ,flags=gtk.DIALOG_DESTROY_WITH_PARENT
 | 
				
			||||||
| 
						 | 
					@ -69,10 +74,19 @@ class GuiLogView:
 | 
				
			||||||
        scrolledwindow.add(self.listview)
 | 
					        scrolledwindow.add(self.listview)
 | 
				
			||||||
        self.vbox.pack_start(scrolledwindow, expand=True, fill=True, padding=0)
 | 
					        self.vbox.pack_start(scrolledwindow, expand=True, fill=True, padding=0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        hb = gtk.HBox(False, 0)
 | 
				
			||||||
 | 
					        grp = None
 | 
				
			||||||
 | 
					        for logf in LOGFILES:
 | 
				
			||||||
 | 
					            rb = gtk.RadioButton(group=grp, label=logf[0], use_underline=True)
 | 
				
			||||||
 | 
					            if grp is None: grp = rb
 | 
				
			||||||
 | 
					            rb.set_active(logf[2])
 | 
				
			||||||
 | 
					            rb.connect('clicked', self.__set_logfile, logf[0])
 | 
				
			||||||
 | 
					            hb.pack_start(rb, False, False, 3)
 | 
				
			||||||
        refreshbutton = gtk.Button("Refresh")
 | 
					        refreshbutton = gtk.Button("Refresh")
 | 
				
			||||||
        refreshbutton.connect("clicked", self.refresh, None)
 | 
					        refreshbutton.connect("clicked", self.refresh, None)
 | 
				
			||||||
        self.vbox.pack_start(refreshbutton, False, False, 3)
 | 
					        hb.pack_start(refreshbutton, False, False, 3)
 | 
				
			||||||
        refreshbutton.show()
 | 
					        refreshbutton.show()
 | 
				
			||||||
 | 
					        self.vbox.pack_start(hb, False, False, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.listview.show()
 | 
					        self.listview.show()
 | 
				
			||||||
        scrolledwindow.show()
 | 
					        scrolledwindow.show()
 | 
				
			||||||
| 
						 | 
					@ -90,6 +104,14 @@ class GuiLogView:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.dia.connect('response', self.dialog_response_cb)
 | 
					        self.dia.connect('response', self.dialog_response_cb)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __set_logfile(self, w, file):
 | 
				
			||||||
 | 
					        #print "w is", w, "file is", file, "active is", w.get_active()
 | 
				
			||||||
 | 
					        if w.get_active():
 | 
				
			||||||
 | 
					            for logf in LOGFILES:
 | 
				
			||||||
 | 
					                if logf[0] == file:
 | 
				
			||||||
 | 
					                    self.logfile = os.path.join(self.config.dir_log, logf[1])
 | 
				
			||||||
 | 
					            self.refresh(w, file)  # params are not used
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def dialog_response_cb(self, dialog, response_id):
 | 
					    def dialog_response_cb(self, dialog, response_id):
 | 
				
			||||||
        # this is called whether close button is pressed or window is closed
 | 
					        # this is called whether close button is pressed or window is closed
 | 
				
			||||||
        self.closeq.put(self.__class__)
 | 
					        self.closeq.put(self.__class__)
 | 
				
			||||||
| 
						 | 
					@ -131,11 +153,14 @@ class GuiLogView:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            l = 0
 | 
					            l = 0
 | 
				
			||||||
            for line in open(self.logfile):
 | 
					            for line in open(self.logfile):
 | 
				
			||||||
                # eg line:
 | 
					                # example line in logfile format:
 | 
				
			||||||
                # 2009-12-02 15:23:21,716 - config       DEBUG    config logger initialised
 | 
					                # 2009-12-02 15:23:21,716 - config       DEBUG    config logger initialised
 | 
				
			||||||
                l = l + 1
 | 
					                l = l + 1
 | 
				
			||||||
                if l > startline and len(line) > 49:
 | 
					                if l > startline:
 | 
				
			||||||
 | 
					                    if len(line) > 49 and line[23:26] == ' - ' and line[34:39] == '     ':
 | 
				
			||||||
                        iter = self.liststore.append( (line[0:23], line[26:32], line[39:46], line[48:].strip(), True) )
 | 
					                        iter = self.liststore.append( (line[0:23], line[26:32], line[39:46], line[48:].strip(), True) )
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        iter = self.liststore.append( ('', '', '', line.strip(), True) )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def sortCols(self, col, n):
 | 
					    def sortCols(self, col, n):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,7 +142,7 @@ class GuiPlayerStats (threading.Thread):
 | 
				
			||||||
        self.stats_frame = gtk.Frame()
 | 
					        self.stats_frame = gtk.Frame()
 | 
				
			||||||
        self.stats_frame.show()
 | 
					        self.stats_frame.show()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.stats_vbox = gtk.VBox(False, 0)
 | 
					        self.stats_vbox = gtk.VPaned()
 | 
				
			||||||
        self.stats_vbox.show()
 | 
					        self.stats_vbox.show()
 | 
				
			||||||
        self.stats_frame.add(self.stats_vbox)
 | 
					        self.stats_frame.add(self.stats_vbox)
 | 
				
			||||||
        # self.fillStatsFrame(self.stats_vbox)
 | 
					        # self.fillStatsFrame(self.stats_vbox)
 | 
				
			||||||
| 
						 | 
					@ -155,12 +155,15 @@ class GuiPlayerStats (threading.Thread):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # make sure Hand column is not displayed
 | 
					        # make sure Hand column is not displayed
 | 
				
			||||||
        [x for x in self.columns if x[0] == 'hand'][0][1] = False
 | 
					        [x for x in self.columns if x[0] == 'hand'][0][1] = False
 | 
				
			||||||
 | 
					        self.last_pos = -1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_vbox(self):
 | 
					    def get_vbox(self):
 | 
				
			||||||
        """returns the vbox of this thread"""
 | 
					        """returns the vbox of this thread"""
 | 
				
			||||||
        return self.main_hbox
 | 
					        return self.main_hbox
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def refreshStats(self, widget, data):
 | 
					    def refreshStats(self, widget, data):
 | 
				
			||||||
 | 
					        self.last_pos = self.stats_vbox.get_position()
 | 
				
			||||||
        try: self.stats_vbox.destroy()
 | 
					        try: self.stats_vbox.destroy()
 | 
				
			||||||
        except AttributeError: pass
 | 
					        except AttributeError: pass
 | 
				
			||||||
        self.liststore = []
 | 
					        self.liststore = []
 | 
				
			||||||
| 
						 | 
					@ -170,6 +173,8 @@ class GuiPlayerStats (threading.Thread):
 | 
				
			||||||
        self.stats_vbox.show()
 | 
					        self.stats_vbox.show()
 | 
				
			||||||
        self.stats_frame.add(self.stats_vbox)
 | 
					        self.stats_frame.add(self.stats_vbox)
 | 
				
			||||||
        self.fillStatsFrame(self.stats_vbox)
 | 
					        self.fillStatsFrame(self.stats_vbox)
 | 
				
			||||||
 | 
					        if self.last_pos > 0:
 | 
				
			||||||
 | 
					            self.stats_vbox.set_position(self.last_pos)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def fillStatsFrame(self, vbox):
 | 
					    def fillStatsFrame(self, vbox):
 | 
				
			||||||
        sites = self.filters.getSites()
 | 
					        sites = self.filters.getSites()
 | 
				
			||||||
| 
						 | 
					@ -208,6 +213,7 @@ class GuiPlayerStats (threading.Thread):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def createStatsTable(self, vbox, playerids, sitenos, limits, type, seats, groups, dates, games):
 | 
					    def createStatsTable(self, vbox, playerids, sitenos, limits, type, seats, groups, dates, games):
 | 
				
			||||||
        starttime = time()
 | 
					        starttime = time()
 | 
				
			||||||
 | 
					        show_detail = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Scrolled window for summary table
 | 
					        # Scrolled window for summary table
 | 
				
			||||||
        swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
 | 
					        swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
 | 
				
			||||||
| 
						 | 
					@ -224,6 +230,11 @@ class GuiPlayerStats (threading.Thread):
 | 
				
			||||||
        self.addGrid(swin, 'playerDetailedStats', flags, playerids
 | 
					        self.addGrid(swin, 'playerDetailedStats', flags, playerids
 | 
				
			||||||
                    ,sitenos, limits, type, seats, groups, dates, games)
 | 
					                    ,sitenos, limits, type, seats, groups, dates, games)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if 'allplayers' in groups and groups['allplayers']:
 | 
				
			||||||
 | 
					            # can't currently do this combination so skip detailed table
 | 
				
			||||||
 | 
					            show_detail = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if show_detail: 
 | 
				
			||||||
            # Separator
 | 
					            # Separator
 | 
				
			||||||
            vbox2 = gtk.VBox(False, 0)
 | 
					            vbox2 = gtk.VBox(False, 0)
 | 
				
			||||||
            heading = gtk.Label(self.filterText['handhead'])
 | 
					            heading = gtk.Label(self.filterText['handhead'])
 | 
				
			||||||
| 
						 | 
					@ -421,6 +432,7 @@ class GuiPlayerStats (threading.Thread):
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    treerow.append(' ')
 | 
					                    treerow.append(' ')
 | 
				
			||||||
            iter = self.liststore[grid].append(treerow)
 | 
					            iter = self.liststore[grid].append(treerow)
 | 
				
			||||||
 | 
					            #print treerow
 | 
				
			||||||
            sqlrow += 1
 | 
					            sqlrow += 1
 | 
				
			||||||
            row += 1
 | 
					            row += 1
 | 
				
			||||||
        vbox.show_all()
 | 
					        vbox.show_all()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,8 +50,8 @@ class PokerStars(HandHistoryConverter):
 | 
				
			||||||
          (?P<BUYIN>([%(LS)s\+\d\.]+\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?)|Freeroll)\s+)?                          
 | 
					          (?P<BUYIN>([%(LS)s\+\d\.]+\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?)|Freeroll)\s+)?                          
 | 
				
			||||||
          # close paren of tournament info
 | 
					          # close paren of tournament info
 | 
				
			||||||
          (?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
 | 
					          (?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
 | 
				
			||||||
          (?P<GAME>Hold\'em|Razz|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
 | 
					          (?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
 | 
				
			||||||
          (?P<LIMIT>No\sLimit|Limit|Pot\sLimit)\)?,?\s
 | 
					          (?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\)?,?\s
 | 
				
			||||||
          (-\sLevel\s(?P<LEVEL>[IVXLC]+)\s)?
 | 
					          (-\sLevel\s(?P<LEVEL>[IVXLC]+)\s)?
 | 
				
			||||||
          \(?                            # open paren of the stakes
 | 
					          \(?                            # open paren of the stakes
 | 
				
			||||||
          (?P<CURRENCY>%(LS)s|)?
 | 
					          (?P<CURRENCY>%(LS)s|)?
 | 
				
			||||||
| 
						 | 
					@ -148,12 +148,13 @@ class PokerStars(HandHistoryConverter):
 | 
				
			||||||
                     '1000.00': ('250.00', '500.00')}
 | 
					                     '1000.00': ('250.00', '500.00')}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl' }
 | 
					        limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
 | 
				
			||||||
        games = {                          # base, category
 | 
					        games = {                          # base, category
 | 
				
			||||||
                              "Hold'em" : ('hold','holdem'), 
 | 
					                              "Hold'em" : ('hold','holdem'), 
 | 
				
			||||||
                                'Omaha' : ('hold','omahahi'),
 | 
					                                'Omaha' : ('hold','omahahi'),
 | 
				
			||||||
                          'Omaha Hi/Lo' : ('hold','omahahilo'),
 | 
					                          'Omaha Hi/Lo' : ('hold','omahahilo'),
 | 
				
			||||||
                                 'Razz' : ('stud','razz'), 
 | 
					                                 'Razz' : ('stud','razz'), 
 | 
				
			||||||
 | 
					                                 'RAZZ' : ('stud','razz'), 
 | 
				
			||||||
                          '7 Card Stud' : ('stud','studhi'),
 | 
					                          '7 Card Stud' : ('stud','studhi'),
 | 
				
			||||||
                    '7 Card Stud Hi/Lo' : ('stud','studhilo'),
 | 
					                    '7 Card Stud Hi/Lo' : ('stud','studhilo'),
 | 
				
			||||||
                               'Badugi' : ('draw','badugi'),
 | 
					                               'Badugi' : ('draw','badugi'),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2101,6 +2101,7 @@ class Sql:
 | 
				
			||||||
                              ,plposition
 | 
					                              ,plposition
 | 
				
			||||||
                              ,upper(gt.limitType)
 | 
					                              ,upper(gt.limitType)
 | 
				
			||||||
                              ,s.name
 | 
					                              ,s.name
 | 
				
			||||||
 | 
					                      having 1 = 1 <havingclause>
 | 
				
			||||||
                      order by hp.playerId
 | 
					                      order by hp.playerId
 | 
				
			||||||
                              ,gt.base
 | 
					                              ,gt.base
 | 
				
			||||||
                              ,gt.category
 | 
					                              ,gt.category
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user