Esempio n. 1
0
    def __init__(self, parent):
        from configHandler import MrPythonConf
        CloseableNotebook.__init__(self, parent)  #), height=500)
        self.parent = parent
        self.sizetab = 0
        self.recent_files_menu = None

        self.recent_files_path = os.path.join(MrPythonConf.GetUserCfgDir(),
                                              'recent-files.lst')
Esempio n. 2
0
    def __init__(self, parent, open=False, filename=None):

        Text.__init__(self,parent)
        self.scroll = scroll=Scrollbar(self)
        scroll['command'] = self.yview
        scroll.pack(side=RIGHT, fill=Y)
        self['yscrollcommand'] = scroll.set
        self.list=parent

        self.recent_files_path = os.path.join(MrPythonConf.GetUserCfgDir(), 'recent-files.lst')

        self.apply_bindings()

        try:
            sys.ps1
        except AttributeError:
            sys.ps1 = ''
            

        # usetabs true  -> literal tab characters are used by indent and
        #                  dedent cmds, possibly mixed with spaces if
        #                  indentwidth is not a multiple of tabwidth,
        #                  which will cause Tabnanny to nag!
        #         false -> tab characters are converted to spaces by indent
        #                  and dedent cmds, and ditto TAB keystrokes
        # Although use-spaces=0 can be configured manually in config-main.def,
        # configuration of tabs v. spaces is not supported in the configuration
        # dialog.  MRPYTHON promotes the preferred Python indentation: use spaces!
        usespaces = MrPythonConf.GetOption('main', 'Indent',
                                       'use-spaces', type='bool')
        self.usetabs = not usespaces
        
        # tabwidth is the display width of a literal tab character.
        # CAUTION:  telling Tk to use anything other than its default
        # tab setting causes it to use an entirely different tabbing algorithm,
        # treating tab stops as fixed distances from the left margin.
        # Nobody expects this, so for now tabwidth should never be changed.
        self.tabwidth = 8    # must remain 8 until Tk is fixed.

        # indentwidth is the number of screen characters per indent level.
        # The recommended Python indentation is four spaces.
        self.indentwidth = self.tabwidth
        self.set_notabs_indentwidth()
        
        # If context_use_ps1 is true, parsing searches back for a ps1 line;
        # else searches for a popular (if, def, ...) Python stmt.
        self.context_use_ps1 = False



        # When searching backwards for a reliable place to begin parsing,
        # first start num_context_lines[0] lines back, then
        # num_context_lines[1] lines back if that didn't work, and so on.
        # The last value should be huge (larger than the # of lines in a
        # conceivable file).
        # Making the initial values larger slows things down more often.
        self.num_context_lines = 50, 500, 5000000
        self.per = per = self.Percolator(self)
        self.undo = undo = self.UndoDelegator()
        per.insertfilter(undo)

        self.undo_block_start = undo.undo_block_start
        self.undo_block_stop = undo.undo_block_stop
        undo.set_saved_change_hook(self.saved_change_hook)

        self.io = io = self.IOBinding(self)
        io.set_filename_change_hook(self.filename_change_hook)
        
        self.color = None # initialized below in self.ResetColorizer

        self.good_load = False
        if open:
            if filename:
                if os.path.exists(filename) and not os.path.isdir(filename):
                    if io.loadfile(filename):
                        self.good_load = True
                        is_py_src = self.ispythonsource(filename)
                else:
                    io.set_filename(filename)
            else:
                self.good_load = self.io.open(editFile=filename)
        else:
            self.good_load=True

        self.ResetColorizer()
        self.saved_change_hook()
        self.askyesno = tkMessageBox.askyesno
        self.askinteger = tkSimpleDialog.askinteger

        # specific font
        self.font = nametofont(self.cget('font')).copy()
        self.configure(font=self.font)
Esempio n. 3
0
"""
Contains and modify MrPython behaviour, filepaths for input/output, LRS properties,
xAPI verbs and activities, error categories and mapping function_names->exercise
"""
from tincan import Verb, Activity, LanguageMap, ActivityDefinition
from configHandler import MrPythonConf
import os

# MrPython behaviour and filepaths

send_to_LRS = True  # Send the created statements to the LRS
debug_log_print = True  # Keep a record of all statements produced in debug_filepath / Print messages related to tracing
backup_filepath =  os.path.join(MrPythonConf.GetUserCfgDir(), 'tracing_backup_stack.txt')
debug_filepath = os.path.join(MrPythonConf.GetUserCfgDir(), 'tracing_debug.txt')
session_filepath = os.path.join(MrPythonConf.GetUserCfgDir(), 'tracing_session.txt')

# LRS properties

lrs_endpoint = "https://lrsmocah.lip6.fr/data/xAPI"
lrs_version = "1.0.1" # 1.0.1 | 1.0.0 | 0.95 | 0.9
lrs_username = "******"
lrs_password = "******"
proxy_name = ""
proxy_port = 0

# xAPI verbs and activites

verbs = {
    "opened": Verb(
        id="http://activitystrea.ms/schema/1.0/open", display=LanguageMap({'en-US': 'opened'})),
    "closed": Verb(
Esempio n. 4
0
xAPI verbs and activities, error categories and mapping function_names->exercise
"""
from tincan import (
    Verb,
    Activity,
    LanguageMap,
    ActivityDefinition,
)
from configHandler import MrPythonConf
import os

# MrPython behaviour and filepaths

send_to_LRS = True  # Send the created statements to the LRS
debug_log_print = True  # Keep a record of all statements produced in debug_filepath / Print messages related to tracing
backup_filepath = os.path.join(MrPythonConf.GetUserCfgDir(),
                               'tracing_backup_stack.txt')
debug_filepath = os.path.join(MrPythonConf.GetUserCfgDir(),
                              'tracing_debug.txt')
session_filepath = os.path.join(MrPythonConf.GetUserCfgDir(),
                                'tracing_session.txt')

# LRS properties

lrs_endpoint = "https://lrsmocah.lip6.fr/data/xAPI"
lrs_version = "1.0.1"  # 1.0.1 | 1.0.0 | 0.95 | 0.9
lrs_username = "******"
lrs_password = "******"

# xAPI verbs and activites