code
stringlengths
1
1.72M
language
stringclasses
1 value
import unittest from pychess.Utils.lutils.lmovegen import genAllMoves, genCheckEvasions from pychess.Utils.lutils.LBoard import LBoard from pychess.Utils.lutils.bitboard import toString, iterBits from pychess.Utils.lutils.ldata import * from pychess.Utils.lutils.validator import validateMove from pychess.Utils.lutils...
Python
import unittest from pychess.Utils.const import WHITE, ANALYZING, INVERSE_ANALYZING from pychess.Utils.lutils.ldata import MATE_VALUE from pychess.Utils.Move import listToMoves from pychess.Utils.Cord import Cord from pychess.Utils.Board import Board from pychess.Players.CECPEngine import CECPEngine from Queue import...
Python
import unittest modules_to_test = ( 'ficsmanagers', "bitboard", "draw", "eval", "fen", "frc_castling", "frc_movegen", "move", "movegen", "pgn", "zobrist", 'analysis', ) def suite(): tests = unittest.TestSuite() for module in map(__import__, modules_to_test)...
Python
import sys import unittest from pychess.Utils.Board import Board from pychess.Utils.Move import Move from pychess.Utils.Move import parseSAN, parseFAN, toFAN from pychess.Utils.lutils.lmovegen import genAllMoves class MoveTestCase(unittest.TestCase): def setUp(self): self.board = Board() def ...
Python
import unittest from pychess.Utils.const import * from pychess.Utils.Board import Board from pychess.Utils.lutils.leval import LBoard from pychess.Utils.lutils.lmove import parseAN FEN = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1" class ZobristTestCase(unittest.TestCase): def make_mov...
Python
import unittest from pychess.Utils.const import * from pychess.Utils.lutils.LBoard import LBoard from pychess.Utils.lutils.leval import evaluateComplete from pychess.Utils.lutils import leval class EvalTestCase(unittest.TestCase): def setUp (self): self.board = LBoard(NORMALCHESS) self.boar...
Python
import sys import unittest from pychess.Utils.Board import Board from pychess.Utils.lutils.LBoard import LBoard from pychess.Savers.pgn import load, walk, movre from pychess.Utils.const import * class PgnTestCase(unittest.TestCase): def test_movre(self): """Testing movre regexp""" moves = "e4 fxg...
Python
import unittest import datetime from pychess.Utils.const import WHITE from pychess.ic import * from pychess.ic.FICSObjects import * from pychess.ic.FICSConnection import Connection from pychess.ic.VerboseTelnet import PredictionsTelnet from pychess.ic.managers.AdjournManager import AdjournManager from pychess.ic.manag...
Python
from __future__ import with_statement import unittest from pychess.Savers import pgn from pychess.Utils.lutils import ldraw class DrawTestCase(unittest.TestCase): def setUp(self): with open('gamefiles/3fold.pgn') as f1: self.PgnFile1 = pgn.load(f1) with open('gamefiles/bilba...
Python
import unittest from pychess.Utils.lutils.lmovegen import genAllMoves, genCheckEvasions from pychess.Utils.lutils.LBoard import LBoard from pychess.Utils.lutils.bitboard import toString, iterBits from pychess.Utils.lutils.ldata import * from pychess.Utils.lutils.validator import validateMove from pychess.Utils.lutils...
Python
import unittest import random import operator from pychess.Utils.lutils.bitboard import * class BitboardTestCase(unittest.TestCase): def setUp (self): self.positionSets = [] # Random positions. Ten of each length. Will also include range(64) and # range(0) for i in xrange(10)...
Python
import unittest from pychess.Utils.Board import Board from pychess.Utils.lutils.LBoard import LBoard import sys class FenTestCase(unittest.TestCase): def setUp(self): self.positions = [] for line in open('gamefiles/perftsuite.epd'): semi = line.find(" ;") self.positio...
Python
import unittest from pychess.Utils.const import * from pychess.Utils.lutils.leval import LBoard from pychess.Utils.lutils.lmove import newMove, FLAG from pychess.Utils.lutils.lmovegen import genCastles # TODO: add more test data data = ( ("r3k2r/8/8/8/8/8/8/R3K2R w AH - 0 1", [(E1, G1, KING_CASTLE), (E1, C1, QUEEN_C...
Python
#!/usr/bin/python # -*- coding: UTF-8 -*- import sys, inspect, os from os import listdir, chdir, getcwd from os.path import isdir, join, split docdir = getcwd() print repr ("cd %s" % sys.argv[1]) chdir(sys.argv[1]) todir = "./" def search (path, extension): for file in listdir(path): file = join (path, f...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import with_statement import collections ############################# # Configuration starts here # ############################# FILENAME = 'TRANSLATORS' POOLSIZE = 7 ########################### # Configuration ends here # ########################### from...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from getpass import getpass from smtplib import SMTP, SMTPConnectError, SMTPAuthenticationError, SMTPRecipientsRefused from email.mime.text import MIMEText mail = 'pychess@gmail.com' passw = getpass('password: ') smtp = 'smtp.gmail.com' to = 'python-announce-lis...
Python
#!/usr/bin/env python """ Which - locate a command * adapted from proposal__ by Erik Demaine and patch__ by Brian Curtin, which adds this feature__ to shutil __ http://bugs.python.org/file8185/find_in_path.py __ http://bugs.python.org/file15381/shutil_which.patch __ http://bugs.python.org/issue444582 ...
Python
""" This is a pool for reusing threads """ from threading import Thread, Condition, Lock import GtkWorker import Queue import inspect import os import sys import threading import traceback import cStringIO import atexit if not hasattr(Thread, "_Thread__bootstrap_inner"): class SafeThread (Thread): def enc...
Python
import os, atexit from pychess.System.Log import log from ConfigParser import SafeConfigParser configParser = SafeConfigParser() from pychess.System.prefix import addUserConfigPrefix section = "General" path = addUserConfigPrefix("config") if os.path.isfile(path): configParser.readfp(open(path)) if not configParse...
Python
from threading import Lock from gobject import GObject, SIGNAL_RUN_FIRST, TYPE_NONE from Log import log try: import pygst pygst.require('0.10') import gst except ImportError, e: log.error("Unable to import gstreamer. All sound will be mute.\n%s" % e) class Player (GObject): __gsignals__ = ...
Python
from array import array class MultiArray: def __init__ (self, oneLineData, *lengths): self.lengths = lengths self.data = oneLineData def get (self, *indexes): index = 0 for depth, i in enumerate(indexes[::-1]): index += i*self.lengths[depth]**depth retu...
Python
""" This is a dictionary, that supports a max of items. This is good for the transportation table, as some old entries might not be useable any more, as the position has totally changed """ from UserDict import UserDict from threading import Lock class LimitedDict (UserDict): def __init__ (self, maxSize):...
Python
import os, sys, time, gobject, traceback, threading from GtkWorker import EmitPublisher, Publisher from prefix import getUserDataPrefix, addUserDataPrefix from pychess.Utils.const import LOG_DEBUG, LOG_LOG, LOG_WARNING, LOG_ERROR from pychess.System.glock import gdklocks from pychess.System.ThreadPool import pool MAXF...
Python
# -*- coding: UTF-8 -*- from gobject import GObject, SIGNAL_RUN_FIRST from pychess.System.Log import log from pychess.System.SubProcess import SubProcess, searchPath import re class Pinger (GObject): """ The recieved signal contains the time it took to get response from the server in millisecconds. -1 mea...
Python
""" This module provides some basic functions for accessing pychess datefiles in system or user space """ import os import sys from os import makedirs from os.path import isdir, join, dirname, abspath ################################################################################ # Locate files in system space ...
Python
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475160 # Was accepted into Python 2.5, but earlier versions still have # to do stuff manually import threading from Queue import Queue def TaskQueue (): if hasattr(Queue, "task_done"): return Queue() return _TaskQueue() class _TaskQueue(Queue)...
Python
import os import sys import signal import errno import time import threading import gtk import gobject from pychess.Utils.const import * from Log import log from which import which from pychess.System.ThreadPool import pool from pychess.System import glock from pychess.System.GtkWorker import EmitPublisher class Sub...
Python
import gconf from os.path import normpath GDIR = '/apps/pychess/' c = gconf.client_get_default() c.add_dir(GDIR[:-1], gconf.CLIENT_PRELOAD_NONE) def notify_add (key, func): key = normpath(GDIR+key) return c.notify_add(key, func) def notify_remove (conid): c.notify_remove(conid) def get (key): key = ...
Python
""" This is a threadsafe wrapper sqlite. It is not classbased, so only one database can be open at a time """ import sqlite3 as sqlite import Queue, time, os from threading import Thread sqlqueue = Queue.Queue() SQL_CMD, END_CMD = range(2) class DbWrapper(Thread): def __init__(self, path): Thread.__...
Python
import sys, traceback from threading import RLock, currentThread from gtk.gdk import threads_enter, threads_leave import time from pychess.System.prefix import addUserDataPrefix #logfile = open(addUserDataPrefix(time.strftime("%Y-%m-%d_%H-%M-%S") + "-glocks.log"), "w") debug = False debug_stream = sys.stdout gdklocks =...
Python
from pychess.System import conf, glock from pychess.System.Log import log from pychess.System.ThreadPool import pool from pychess.System.prefix import addDataPrefix from pychess.widgets.ToggleComboBox import ToggleComboBox import Queue import colorsys import gtk.glade import pango import re import webbrowser def crea...
Python
import urllib, os def splitUri (uri): uri = urllib.url2pathname(uri) # escape special chars uri = uri.strip('\r\n\x00') # remove \r\n and NULL return uri.split("://") def protoopen (uri): """ Function for opening many things """ try: return urllib.urlopen(uri) except (IOError, OSEr...
Python
from ctypes import * l=CDLL('librsvg-2-2.dll') g=CDLL('libgobject-2.0-0.dll') g.g_type_init() class Props(): def __init__(self, dimension): self.width, self.height = dimension class rsvgHandle(): class RsvgDimensionData(Structure): _fields_ = [("width", c_int), ("heig...
Python
""" The task of this module is to provide easy saving/loading of configurations It also supports gconf like connection, so you get notices when a property has changed. """ # gconf's notify all seams to be broken #try: # import gconf # import conf_gconf as confmodule #except: import conf_configParser as c...
Python
# -*- coding: UTF-8 -*- import time from pychess.System.ThreadPool import pool def repeat (func, *args, **kwargs): """ Repeats a function in a new thread until it returns False """ def run (): while func(*args, **kwargs): pass pool.start(run) def repeat_sleep (func, sleeptime, recur=F...
Python
from threading import Thread import Queue from gobject import GObject, SIGNAL_RUN_FIRST from ThreadPool import PooledThread import glock # # IDEA: We could implement gdk prioritizing by using a global PriorityQueue # class Publisher (PooledThread): """ Publisher can be used when a thread is often spitting out r...
Python
import socket import re, sre_constants from copy import copy from pychess.System.Log import log class Prediction: def __init__ (self, callback, *regexps): self.callback = callback self.regexps = [] self.hash = hash(callback) for regexp in regexps: self.hash ^= ...
Python
import re from gobject import * import threading from pychess.System.Log import log from pychess.Savers.pgn import msToClockTimeTag from pychess.Utils.const import * from pychess.ic import * from pychess.ic.VerboseTelnet import * from pychess.ic.FICSObjects import * names = "(\w+)" titles = "((?:\((?:GM|IM|FM|WGM|WIM...
Python
from gobject import * import threading import re from math import ceil import time from pychess.System.Log import log titles = "(?:\([A-Z*]+\))*" names = "([A-Za-z]+)"+titles titlesC = re.compile(titles) namesC = re.compile(names) CHANNEL_SHOUT = "shout" CHANNEL_CSHOUT = "cshout" class ChatManager (GObject): ...
Python
import re import datetime from gobject import * from BoardManager import BoardManager, moveListHeader1Str, names, months, dates from pychess.ic import * from pychess.ic.FICSObjects import FICSAdjournedGame, FICSPlayer from pychess.Utils.const import * from pychess.System.Log import log class AdjournManager (GObject):...
Python
from gobject import * sanmove = "([a-hxOoKQRBN0-8+#=-]{2,7})" class ErrorManager (GObject): __gsignals__ = { 'onCommandNotFound' : (SIGNAL_RUN_FIRST, TYPE_NONE, (str,)), 'onAmbiguousMove' : (SIGNAL_RUN_FIRST, TYPE_NONE, (str,)), 'onIllegalMove' : (SIGNAL_RUN_FIRST, TYPE_NONE, (str,))...
Python
import re from gobject import GObject, SIGNAL_RUN_FIRST from pychess.Utils.const import * from pychess.Utils.Offer import Offer from pychess.System.Log import log from pychess.ic import * names = "\w+(?:\([A-Z\*]+\))*" rated = "(rated|unrated)" colors = "(?:\[(white|black)\])?" ratings = "\(([0-9\ \-\+]{4})\)" loade...
Python
from gobject import * class AutoLogOutManager (GObject): __gsignals__ = { 'logOut': (SIGNAL_RUN_FIRST, None, ()) } def __init__ (self, connection): GObject.__init__(self) self.connection = connection self.connection.expect_line (self.onLogOut, "\*\*\*...
Python
from threading import RLock from gobject import * import re from time import time from pychess.ic import * from pychess.Utils.const import * from pychess.Utils.Rating import Rating from pychess.System.Log import log types = "(?:blitz|standard|lightning|wild|bughouse|crazyhouse|suicide|losers|atomic)" rated = "(rated|u...
Python
from pychess.System import conf from threading import Semaphore class ListAndVarManager: def __init__ (self, connection): self.connection = connection # Lists self.publicLists = {} self.personalLists = {} self.personalBackup = {} self.listLock = Semaphore(0)...
Python
import re from gobject import * types = "(Blitz|Lightning|Standard)" days = "(Mon|Tue|Wed|Thu|Fri|Sat|Sun)" months = "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)" AMOUNT_OF_NEWSITEMS = 5 FICS_SENDS = 10 class NewsManager (GObject): __gsignals__ = { 'readingNews' : (SIGNAL_RUN_FIRST, TYPE_NONE...
Python
from gobject import GObject, SIGNAL_RUN_FIRST, TYPE_NONE import re from pychess.Utils.const import * from pychess.ic import * from pychess.ic.FICSObjects import * from pychess.ic.managers.BoardManager import parse_reason from pychess.System.Log import log rated = "(rated|unrated)" colors = "(?:\[(white|black)\]\s?)?" ...
Python
from FICSConnection import FICSConnection, LogOnError from ICLounge import ICLounge from pychess.System import glock, uistuff from pychess.Utils.const import * import gtk import gobject import re import socket import webbrowser dialog = None def run(): global dialog if not dialog: dialog = ICLogon...
Python
import re, socket from gobject import GObject, SIGNAL_RUN_FIRST import pychess from pychess.System.Log import log from pychess.System.ThreadPool import PooledThread from pychess.Utils.const import * from managers.GameListManager import GameListManager from managers.FingerManager import FingerManager from managers.Ne...
Python
#session import socket, errno import telnetlib import re import gobject import random import time import platform import getpass from pychess.System.Log import log ENCODE = [ord(i) for i in "Timestamp (FICS) v1.0 - programmed by Henrik Gram."] ENCODELEN = len(ENCODE) G_RESPONSE = '\x029' FILLER = "1234567890abcdefgh...
Python
from pychess.System.Log import log from pychess.Utils.GameModel import GameModel from pychess.Utils.Offer import Offer from pychess.Utils.const import * from pychess.Players.Human import Human from pychess.ic import GAME_TYPES class ICGameModel (GameModel): def __init__ (self, connection, ficsgame, timemodel): ...
Python
import datetime import gobject from gobject import GObject, SIGNAL_RUN_FIRST from pychess.Utils.IconLoader import load_icon from pychess.Utils.Rating import Rating from pychess.Utils.const import * from pychess.ic import TYPE_BLITZ, TYPE_STANDARD, TYPE_LIGHTNING, TYPE_WILD, \ TYPE_LOSERS, TITLE_TYPE_DISPLAY_TEXTS,...
Python
# -*- coding: utf-8 -*- import Queue from StringIO import StringIO from time import strftime, localtime, time from math import e from operator import attrgetter from itertools import groupby import gtk, gobject, pango, re from gtk.gdk import pixbuf_new_from_file from gobject import GObject, SIGNAL_RUN_FIRST from pyc...
Python
from pychess import Variants from pychess.Utils.const import * # RatingType TYPE_BLITZ, TYPE_STANDARD, TYPE_LIGHTNING, TYPE_WILD, \ TYPE_BUGHOUSE, TYPE_CRAZYHOUSE, TYPE_SUICIDE, TYPE_LOSERS, TYPE_ATOMIC, \ TYPE_UNTIMED, TYPE_EXAMINED, TYPE_OTHER = range(12) class GameType (object): def __init__ (self, fic...
Python
from pychess.Utils.const import * from pychess.Utils.Board import Board KNIGHTODDSSTART = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/R1BQKBNR w KQkq - 0 1" class KnightOddsBoard(Board): variant = KNIGHTODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=KNIGH...
Python
# Upside-down Chess from pychess.Utils.const import * from pychess.Utils.Board import Board UPSIDEDOWNSTART = "RNBQKBNR/PPPPPPPP/8/8/8/8/pppppppp/rnbqkbnr w - - 0 1" class UpsideDownBoard(Board): variant = UPSIDEDOWNCHESS def __init__ (self, setup=False): if setup is True: Board.__init__...
Python
from pychess.Utils.const import * from pychess.Utils.Board import Board QUEENODDSSTART = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNB1KBNR w KQkq - 0 1" class QueenOddsBoard(Board): variant = QUEENODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=QUEENODD...
Python
# Shuffle Chess import random from pychess.Utils.const import * from pychess.Utils.Board import Board class ShuffleBoard(Board): variant = SHUFFLECHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=self.shuffle_start()) else: Board.__i...
Python
# Pawns Passed Chess from pychess.Utils.const import * from pychess.Utils.Board import Board PAWNSPASSEDSTART = "rnbqkbnr/8/8/PPPPPPPP/pppppppp/8/8/RNBQKBNR w - - 0 1" class PawnsPassedBoard(Board): variant = PAWNSPASSEDCHESS def __init__ (self, setup=False): if setup is True: Board.__i...
Python
# AsymmetricRandom Chess import random from pychess.Utils.const import * from pychess.Utils.Board import Board class AsymmetricRandomBoard(Board): variant = ASYMMETRICRANDOMCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=self.asymmetricrandom_start())...
Python
from pychess.Utils.Board import Board class NormalChess: __desc__ = _("Classic chess rules\n" + "http://en.wikipedia.org/wiki/Chess") name = _("Normal") cecp_name = "normal" board = Board need_initial_board = False standard_rules = True
Python
# Random Chess import random from pychess.Utils.const import * from pychess.Utils.Board import Board class RandomBoard(Board): variant = RANDOMCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=self.random_start()) else: Board.__init_...
Python
# Losers Chess from pychess.Utils.const import * from pychess.Utils.lutils.bitboard import bitLength from pychess.Utils.Board import Board class LosersBoard(Board): variant = LOSERSCHESS class LosersChess: __desc__ = _("FICS losers: http://www.freechess.org/Help/HelpFiles/losers_chess.html") name = _("L...
Python
# Chess960 (Fischer Random Chess) import random from copy import copy from pychess.Utils.const import * from pychess.Utils.Cord import Cord from pychess.Utils.Board import Board from pychess.Utils.Piece import Piece from pychess.Utils.lutils.bitboard import * from pychess.Utils.lutils.attack import * from pychess.Uti...
Python
from pychess.Utils.const import * from normal import NormalChess from corner import CornerChess from shuffle import ShuffleChess from fischerandom import FischerRandomChess from randomchess import RandomChess from asymmetricrandom import AsymmetricRandomChess from upsidedown import UpsideDownChess from pawnspushed impo...
Python
# Pawns Pushed Chess from pychess.Utils.const import * from pychess.Utils.Board import Board PAWNSPUSHEDSTART = "rnbqkbnr/8/8/pppppppp/PPPPPPPP/8/8/RNBQKBNR w - - 0 1" class PawnsPushedBoard(Board): variant = PAWNSPUSHEDCHESS def __init__ (self, setup=False): if setup is True: Board.__in...
Python
from pychess.Utils.const import * from pychess.Utils.Board import Board PAWNODDSSTART = "rnbqkbnr/ppppp1pp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" class PawnOddsBoard(Board): variant = PAWNODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=PAWNODDSSTA...
Python
from pychess.Utils.const import * from pychess.Utils.Board import Board ROOKODDSSTART = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w Kkq - 0 1" class RookOddsBoard(Board): variant = ROOKODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=ROOKODDSSTAR...
Python
# Corner Chess import random from pychess.Utils.const import * from pychess.Utils.Board import Board class CornerBoard(Board): variant = CORNERCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=self.shuffle_start()) else: Board.__init...
Python
from Throbber import Throbber from pychess.Players.engineNest import discoverer from pychess.System import conf, uistuff from pychess.System.glock import glock_connect from pychess.System.prefix import addDataPrefix import gtk.glade import os uistuff.cacheGladefile("discovererDialog.glade") class DiscovererDialog...
Python
import gtk, gobject import gamewidget firstRun = True def run(widgets): global firstRun if firstRun: initialize(widgets) firstRun = False widgets["player_info"].show_all() def initialize(widgets): def addColumns (treeview, *columns): model = gtk.ListStore(*((str,)*len(columns)...
Python
import gamewidget from pychess.System import glock from pychess.Utils.const import ACTION_MENU_ITEMS ################################################################################ # Main menubar MenuItem classes to keep track of menu widget states # ########################################################...
Python
""" The task of this module, is to save, load and init new games """ from gettext import ngettext from gobject import GObject, SIGNAL_RUN_FIRST, TYPE_NONE from pychess import Savers from pychess.Players.engineNest import discoverer from pychess.Savers.ChessFile import LoadingError from pychess.Savers import * # This n...
Python
import time import gtk import gobject import pango import re from pychess.Utils.IconLoader import load_icon from pychess.System import uistuff from pychess.System.glock import glock_connect from pychess.widgets.ChatView import ChatView from pychess.widgets.pydock.PyDockTop import PyDockTop from pychess.widgets.pydock...
Python
import gtk from pychess.System import uistuff from pychess.System.prefix import addDataPrefix from pychess.Utils.Piece import Piece,QUEEN,ROOK,BISHOP,KNIGHT from pychess.Utils.const import WHITE,BLACK from PieceWidget import PieceWidget uistuff.cacheGladefile("promotion.glade") class PromotionDialog: def...
Python
# -*- coding: UTF-8 -*- import os.path import time import codecs import gtk, pango, gobject from pychess.System import glock, uistuff from pychess.System.Log import log from pychess.System.Log import LOG_DEBUG, LOG_LOG, LOG_WARNING, LOG_ERROR from pychess.System.prefix import addDataPrefix def rawreplace(error): ...
Python
# -*- coding: UTF-8 -*- import gtk, gtk.gdk from gobject import * import threading from pychess.System.prefix import addDataPrefix from pychess.System.Log import log from pychess.Utils.Cord import Cord from pychess.Utils.Move import Move from pychess.Utils.const import * from pychess.Utils.logic import validate from ...
Python
# -*- coding: UTF-8 -*- import sys from math import floor, ceil, pi from time import time, sleep from threading import Lock, RLock import gtk, gtk.gdk, cairo from gobject import * import pango from pychess.System import glock, conf, gstreamer from pychess.System.glock import glock_connect, glock_connect_after from p...
Python
""" This module handles the tabbed layout in PyChess """ from BoardControl import BoardControl from ChessClock import ChessClock from MenuItemsDict import MenuItemsDict from pychess.System import glock, conf, prefix from pychess.System.Log import log from pychess.System.glock import glock_connect from pychess.System....
Python
import pygtk pygtk.require("2.0") import gtk from gobject import * from pychess.System.Log import log from pychess.Utils.IconLoader import load_icon class ToggleComboBox (gtk.ToggleButton): __gsignals__ = {'changed' : (SIGNAL_RUN_FIRST, TYPE_NONE, (TYPE_INT,))} def __init__ (self): gtk.ToggleButton...
Python
# -*- coding: UTF-8 -*- from math import ceil, pi, cos, sin import cairo, gtk, pango from gtk import gdk from pychess.System import glock from pychess.System.repeat import repeat_sleep from pychess.Utils.const import WHITE, BLACK class ChessClock (gtk.DrawingArea): def __init__(self): gtk.DrawingAre...
Python
import gtk import cairo from pychess.gfx.Pieces import drawPiece class PieceWidget (gtk.DrawingArea): def __init__(self, piece): gtk.DrawingArea.__init__(self) self.connect("expose_event", self.expose) self.piece = piece def setPiece(self, piece): self.piece = piece ...
Python
import cairo import gtk from gtk import gdk from gobject import SIGNAL_RUN_FIRST, TYPE_NONE from pychess.System.prefix import addDataPrefix from pychess.System import glock from BorderBox import BorderBox class ChainVBox (gtk.VBox): """ Inspired by the GIMP chainbutton widget """ __gsignals__ = { 'cli...
Python
import sys, os import gtk from pychess.System.prefix import addDataPrefix from pychess.System import conf, gstreamer, uistuff from pychess.Players.engineNest import discoverer from pychess.Utils.const import * from pychess.Utils.IconLoader import load_icon firstRun = True def run(widgets): global firstRun if ...
Python
from os import path import gtk import cairo from pychess.System.prefix import addDataPrefix, addUserCachePrefix CLEARPATH = addDataPrefix("glade/clear.png") surface = None def giveBackground (widget): widget.connect("expose_event", expose) widget.connect("style-set", newtheme) def expose (widget, event): ...
Python
import gobject import gtk class InfoBarMessageButton (gobject.GObject): def __init__(self, text, response_id, sensitive=True, tooltip=""): gobject.GObject.__init__(self) self.text = text self.response_id = response_id self.sensitive = sensitive self.tooltip = tooltip ...
Python
import gtk class BorderBox (gtk.Alignment): def __init__ (self, widget=None, top=False, right=False, bottom=False, left=False): gtk.Alignment.__init__(self, 0, 0, 1, 1) self.connect("expose-event", self._onExpose) if widget: self.add(...
Python
import gtk, gtk.gdk from gobject import * from math import floor from BoardView import BoardView from pychess.Utils.const import * from pychess.Utils.Cord import Cord ALL = 0 class SetupBoard (gtk.EventBox): __gsignals__ = { 'cord_clicked' : (SIGNAL_RUN_FIRST, TYPE_NONE, (TYPE_PYOBJECT,)), } ...
Python
import gtk.glade, os from pychess.System import conf from pychess.System import uistuff from pychess.System.prefix import addDataPrefix from random import randrange uistuff.cacheGladefile("tipoftheday.glade") class TipOfTheDay: @classmethod def _init (cls): cls.widgets = uistuff.GladeWidgets("tip...
Python
import math ceil = lambda f: int(math.ceil(f)) from gobject import * import gtk import cairo import pango line = 10 curve = 60 dotSmall = 14 dotLarge = 24 lineprc = 1/7. hpadding = 5 vpadding = 3 class SpotGraph (gtk.EventBox): __gsignals__ = { 'spotClicked' : (SIGNAL_RUN_FIRST, TYPE_NONE, (str,)) ...
Python
# -*- coding: UTF-8 -*- import os import gtk, gtk.glade, gobject from pychess.Utils.const import reprResult, BLACK, FEN_EMPTY from pychess.Utils.Board import Board from pychess.System.uistuff import GladeWidgets from pychess.System.protoopen import protoopen, splitUri from pychess.widgets.BoardView import BoardView fr...
Python
import gtk class ImageMenu(gtk.EventBox): def __init__ (self, image, child): gtk.EventBox.__init__(self) self.add(image) self.subwindow = gtk.Window() self.subwindow.set_decorated(False) self.subwindow.set_resizable(False) self.subwindow.set_type_hint(gtk.gd...
Python
import gamewidget firstRun = True def run(widgets, gameDic): global firstRun if firstRun: initialize(widgets, gameDic) firstRun = False widgets["game_info"].show() def initialize(widgets, gameDic): gamemodel = gameDic[gamewidget.cur_gmwidg()] widgets["event_entry"].set_text(gamemod...
Python
import gtk import pango import math import random from gtk.gdk import pixbuf_new_from_file from pychess.Players.Human import Human from pychess.Players.engineNest import discoverer from pychess.System import uistuff, conf from pychess.System.glock import glock_connect_after from pychess.System.prefix import addDataPr...
Python
import sys import time import math import gtk import gobject import cairo if sys.platform == 'win32': from pychess.System.WinRsvg import rsvg else: import rsvg from pychess.System.uistuff import addDataPrefix from pychess.System.repeat import repeat_sleep from pychess.System import glock MAX_FPS = 20 RAD_PS...
Python
import os.path import gettext import locale from cStringIO import StringIO from operator import attrgetter from itertools import groupby import gtk from cairo import ImageSurface try: from gtksourceview import SourceBuffer from gtksourceview import SourceView from gtksourceview import SourceLanguagesManag...
Python
from time import strftime, gmtime, localtime import random import gtk from gtk.gdk import keyval_from_name import pango import gobject from pychess.System import uistuff from BorderBox import BorderBox class ChatView (gtk.VPaned): __gsignals__ = { 'messageAdded' : (gobject.SIGNAL_RUN_FIRST, None, (str,st...
Python
import gtk, cairo from math import ceil as fceil ceil = lambda f: int(fceil(f)) from __init__ import NORTH, EAST, SOUTH, WEST, CENTER from OverlayWindow import OverlayWindow class HighlightArea (OverlayWindow): """ An entirely blue widget """ def __init__ (self, parent): OverlayWindow.__init__(s...
Python
import os import re import sys import gtk import cairo if sys.platform == 'win32': from pychess.System.WinRsvg import rsvg else: import rsvg class OverlayWindow (gtk.Window): """ This class knows about being an overlaywindow and some svg stuff """ cache = {} # Class global self.cache for svgPat...
Python
from math import ceil as float_ceil ceil = lambda f: int(float_ceil(f)) import gtk, cairo import gobject from OverlayWindow import OverlayWindow POSITIONS_COUNT = 5 NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT) DX_DY = ((0,-1), (1,0), (0,1), (-1,0), (0,0)) PADDING_X = 0.2 # Amount of button width PADDING...
Python