Beispiel #1
0
 def moveDownClicked(self, button):
     index = self.getSelectedIndex()
     if index is None:
         return
     t = self.trees
     if index < 0 or index >= len(t) - 1:
         gdk.beep()
         return
     t.swap(t.get_iter(index), t.get_iter(index + 1))
     self.treev.set_cursor(index + 1)
Beispiel #2
0
    def prompt(self, actions):
        """ Prompt player to act. """
        index = 0
        logger.debug("Prompting with actions:")

        # Happens before NewHandStarted, clear actions from the last hand:
        if self.clean_actions:
            self.clean_actions = False
            for seat in self.gui_seats:
                if seat.is_occupied():
                    seat.clear_action()
                    seat.clear_hole_cards()

        beep()
        for action in actions:
            logger.debug("   %s" % action)
            if isinstance(action, PostBlind):
                self.call_button.set_label("Post blind: $%s" % action.amount)
                self.call_button.set_sensitive(True)
                if self.__call_handler_id != None:
                    self.call_button.disconnect(self.__call_handler_id)
                self.__call_handler_id = self.call_button.connect("clicked", self.handle_call_button, (index, action))

            elif isinstance(action, Call):
                if action.amount == 0:
                    self.call_button.set_label("Check" % action.amount)
                else:
                    self.call_button.set_label("Call: $%s" % action.amount)
                self.call_button.set_sensitive(True)
                if self.__call_handler_id != None:
                    self.call_button.disconnect(self.__call_handler_id)
                self.__call_handler_id = self.call_button.connect("clicked", self.handle_call_button, (index, action))

            elif isinstance(action, Raise):
                # TODO: Note this is only for limit holdem currently:
                if action.current_bet == 0:
                    self.raise_button.set_label("Bet: $%s" % action.min_bet)
                else:
                    self.raise_button.set_label("Raise: $%s" % action.min_bet)
                self.raise_button.set_sensitive(True)
                if self.__raise_handler_id != None:
                    self.raise_button.disconnect(self.__raise_handler_id)
                self.__raise_handler_id = self.raise_button.connect(
                    "clicked", self.handle_raise_button, (index, action, action.min_bet, action.current_bet)
                )

            elif isinstance(action, Fold):
                self.fold_button.set_label("Fold")
                self.fold_button.set_sensitive(True)
                if self.__fold_handler_id != None:
                    self.fold_button.disconnect(self.__fold_handler_id)
                self.__fold_handler_id = self.fold_button.connect("clicked", self.handle_fold_button, (index, action))

            index = index + 1
Beispiel #3
0
 def plugTreeviewDown(self, button):
     cur = self.plugTreeview.get_cursor()[0]
     if cur==None:
         return
     i = cur[0]
     t = self.plugTreestore
     if i<0 or i>=len(t)-1:
         gdk.beep()
         return
     t.swap(t.get_iter(i), t.get_iter(i+1))
     self.plugTreeview.set_cursor(i+1)
Beispiel #4
0
 def moveDownClicked(self, button):
     cur = self.treev.get_cursor()
     if not cur:
         return
     i = cur[0]
     t = self.trees
     if i<0 or i>=len(t)-1:
         gdk.beep()
         return
     t.swap(t.get_iter(i), t.get_iter(i+1))
     self.treev.set_cursor(i+1)
Beispiel #5
0
 def moveUpClicked(self, button):
     cur = self.treev.get_cursor()
     if not cur:
         return
     i = cur[0]
     t = self.trees
     if i<=0 or i>=len(t):
         gdk.beep()
         return
     t.swap(t.get_iter(i-1), t.get_iter(i))
     self.treev.set_cursor(i-1)
Beispiel #6
0
 def start_drag(self, event):
   '''
   Filtered event from GuiControl.
   Overrides GuiControl.start_drag()
   This defines that can't drag an ordinary menu item.
   But GuiControl already changed drag state?
   cancel drag on mouse_exit?
   '''
   #TODO 
   gdk.beep()
   print "?????????????????Dragging a menu item"
   pass
Beispiel #7
0
 def plugTreeviewBottom(self, button):
     cur = self.plugTreeview.get_cursor()[0]
     if cur==None:
         return
     i = cur[0]
     t = self.plugTreestore
     if i<0 or i>=len(t)-1:
         gdk.beep()
         return
     t.append(t[i])
     t.remove(t.get_iter(i))
     self.plugTreeview.set_cursor(len(t)-1)
Beispiel #8
0
 def plugTreeviewTop(self, button):
     cur = self.plugTreeview.get_cursor()[0]
     if cur==None:
         return
     i = cur[0]
     t = self.plugTreestore
     if i<=0 or i>=len(t):
         gdk.beep()
         return
     t.prepend(t[i])
     t.remove(t.get_iter(i+1))
     self.plugTreeview.set_cursor(0)
Beispiel #9
0
 def accountsDownClicked(self, button):
     cur = self.accountsTreeview.get_cursor()[0]
     if cur==None:
         return
     index = cur[0]
     t = self.accountsTreestore
     if index<0 or index>=len(t)-1:
         gdk.beep()
         return
     ui.eventAccounts.moveDown(index)
     ui.eventAccounts.save()
     t.swap(t.get_iter(index), t.get_iter(index+1))
     self.accountsTreeview.set_cursor(index+1)
Beispiel #10
0
 def plugAddDialogOK(self, obj):
     cur = self.plugAddTreeview.get_cursor()[0]
     if cur==None:
         gdk.beep()
         return
     i = cur[0]
     j = self.plugAddItems[i]
     cur2 = self.plugTreeview.get_cursor()[0]
     if cur2==None:
         pos = len(self.plugTreestore)
     else:
         pos = cur2[0]+1
     self.plugTreestore.insert(pos, [j, True, False, core.allPlugList[j].desc])
     self.plugAddTreestore.remove(self.plugAddTreestore.get_iter(i))
     self.plugAddItems.pop(i)
     self.plugAddDialog.hide()
     self.plugTreeview.set_cursor(pos)### pos==1- #????????
Beispiel #11
0
 def plugTreeviewDel(self, button):
     cur = self.plugTreeview.get_cursor()[0]
     if cur==None:
         return
     i = cur[0]
     t = self.plugTreestore
     n = len(t)
     if i<0 or i>=n:
         gdk.beep()
         return
     j = t[i][0]
     t.remove(t.get_iter(i))
     ### j
     self.plugAddItems.append(j)
     desc = core.allPlugList[j].desc
     self.plugAddTreestore.append([desc])
     print 'deleting', desc
     self.plugButtonAdd.set_sensitive(True)
     if n>1:
         self.plugTreeview.set_cursor(min(n-2, i))
Beispiel #12
0
 def downClicked(self, button):
     model = self.model
     index_list = self.treev.get_cursor()[0]
     if not index_list:
         return
     i = index_list[-1]
     if len(index_list)==1:
         if i<0 or i>=len(model)-1:
             gdk.beep()
             return
         ###
         self.widget.moveItemUp(i+1)
         model.swap(model.get_iter(i), model.get_iter(i+1))
         self.treev.set_cursor(i+1)
     else:
         if i<0:
             gdk.beep()
             return
         ###
         root = self.getItemByPath(index_list[:-1])
         if i>=len(root.items)-1:
             gdk.beep()
             return
         ###
         root.moveItemUp(i+1)
         index_list2 = index_list[:-1] + (i+1,)
         model.swap(model.get_iter(index_list), model.get_iter(index_list2))
         self.treev.set_cursor(index_list2)
Beispiel #13
0
def alert(msg):
    gdk.beep()
    print msg
Beispiel #14
0
def alert(msg):
  gdk.beep()
  print msg