Ejemplo n.º 1
0
    global debug
    debug = flag


debug = False


def make_init_profiling_tuple():
    return [0, 0.0]


_profiling_callback = collections.defaultdict(make_init_profiling_tuple)
_profiling_calls = collections.defaultdict(make_init_profiling_tuple)

features.add_feature('debug.freeciv.print_callbacks', type=bool, default=False)
features.set_applier('debug.freeciv', set_debug, type=bool, default=False)


class _obj:
    pass


func = _obj()
callback = _obj()
const = _obj()

hard_exit = True

callback_num = 0

Ejemplo n.º 2
0
from freeciv import ui
from freeciv import help
from freeciv import osutil
from freeciv import features
from freeciv import sync

import functools
import microjson as json

features.add_feature('gold.enable', type=bool, default=False)
features.add_feature('gold.initiated', type=bool, default=False)

def set_gold_status(status):
    pass

features.set_applier('gold.status', default='none', func=set_gold_status)
features.add_feature('gold.session_warning', type=bool, default=False)

def menu():
    layout = ui.LinearLayoutWidget(marginleft=10)
    buttons = ui.HorizontalLayoutWidget(spacing=10)
    text_label = help.LongTextWidget('Loading...', ui.screen_width, ui.smallfont)

    layout.add(buttons)
    layout.add(text_label)
    layout.add(buttons)

    ui.async(check_products)

    def text_fetched(text):
        data = json.loads(text)
Ejemplo n.º 3
0
import time

def set_debug(flag):
    global debug
    debug = flag

debug = False

def make_init_profiling_tuple():
    return [0, 0.0]

_profiling_callback = collections.defaultdict(make_init_profiling_tuple)
_profiling_calls = collections.defaultdict(make_init_profiling_tuple)

features.add_feature('debug.freeciv.print_callbacks', type=bool, default=False)
features.set_applier('debug.freeciv', set_debug, type=bool, default=False)

class _obj: pass

func = _obj()
callback = _obj()
const = _obj()

hard_exit = True

callback_num = 0

def _callback(funname, *args):
    if debug:
        start_time = time.time()
        if features.get('debug.freeciv.print_callbacks'):