Пример #1
0
def check_environment():
    run_test = os.environ.get("SUGAR_RUN_TEST", None)
    if run_test is not None:
        log_path = os.environ.get("SUGAR_TEST_LOG", None)
        if log_path is None:
            log_path = os.path.join(get_logs_dir(), "test.log")
            log_file = open(log_path, "w")
        else:
            log_file = open(log_path, "a")

        test_process = subprocess.Popen(run_test,
                                        stdout=log_file,
                                        stderr=subprocess.STDOUT,
                                        shell=True)

        GLib.child_watch_add(test_process.pid, _test_child_watch_cb, log_file)
Пример #2
0
This class create a gtk.Notebook() widget supporting 
a close button in every tab when the 'can-close-tabs' gproperty
is enabled (True)

STABLE.
"""

from gi.repository import Gtk
from gi.repository import GObject

# Initialize logging.
import logging
from sugar3 import logger
#Get the standard logging directory. 
std_log_dir = logger.get_logs_dir()
_logger = logging.getLogger('PyDebug')

_logger.setLevel(logging.DEBUG)


class Notebook(Gtk.Notebook):

    __gtype_name__ = 'SugarNotebook'

    __gproperties__ = {
        'can-close-tabs': (bool, None, None, False,
                           GObject.PARAM_READWRITE |
                           GObject.PARAM_CONSTRUCT_ONLY)
    }
    __gsignals__ = {