Beispiel #1
0
def creat_submenu(menu_dev_c):
    """Creat sub menu and item for dev C modul
    return submenus dico, items dico"""

    submenus = {}
    items = {}

    # Sub Menu
    # Goto
    submenus['goto'] = menu_dev_c.add(label=sp.msg('Goto'),
                                      submenu=True,
                                      action=None,
                                      name='goto',
                                      specific=True,
                                      group='devc')
    # items in Goto sub menu
    # next function
    items['next_function'] = submenus['goto'].add(
        label=sp.msg('Next function'),
        action=goto.next_function,
        accelerator=get_shortkey('next_function'),
        name="next_function",
        specific=True,
        group='devc')
    # Previous function
    items['previous_function'] = submenus['goto'].add(
        label=sp.msg('Previous function'),
        action=goto.previous_function,
        accelerator=get_shortkey('previous_function'),
        name="previous_function",
        specific=True,
        group='devc')
    # Liste des fonctions
    items['list_function'] = submenus['goto'].add(
        label=sp.msg('LIst of functions'),
        action=goto.select_function,
        accelerator=get_shortkey('list_function'),
        name="list_function",
        specific=True,
        group='devc')
    # next struct
    items['next_struct'] = submenus['goto'].add(
        label=sp.msg('Next struct'),
        action=goto.next_struct,
        accelerator=get_shortkey('next_struct'),
        name="next_struct",
        specific=True,
        group='devc')
    # Previous struct
    items['previous_struct'] = submenus['goto'].add(
        label=sp.msg('Previous struct'),
        action=goto.previous_struct,
        accelerator=get_shortkey('previous_struct'),
        name="previous_struct",
        specific=True,
        group='devc')
    return submenus, items
Beispiel #2
0
	def compile (self, page):
		oldDir = os.getcwd()
		os.chdir(self.dir)
		proc = Process('c.bat')
		proc.wait()
		result = proc.read()
		os.chdir(oldDir)
		if not result:
			win.messageBeep(64)
			return
		win.messageBeep(16)
		say(result)
		p = win.new('text')
		p.readOnly=True
		p.name = msg('Compilation result')
		p.text = result
Beispiel #3
0
	itemReindent.enabled = hasattr(p, 'reindent') and callable(p.reindent)
	itemCompile.enabled = hasattr(p, 'project') and hasattr(p.project, 'compile') and callable(p.project.compile)
	itemRun.enabled = hasattr(p, 'project') and hasattr(p.project, 'run') and callable(p.project.run)

def pageOpened (page):
	page.addEvent('activated', pageActivated)
	page.addEvent('beforeSave', pageBeforeSave)
	pageDetectType(page)

def reindent ():
	win.curPage.reindent(win.curPage)

def compile ():
	win.curPage.project.compile(win.curPage)

def execute ():
	win.curPage.project.run(win.curPage)

menuFormat = win.menus.format
menuProject = win.menus.add(label=msg('&Project'), submenu=1, index=-2)
itemReindent = menuFormat.add(action=reindent, label=msg('Re&indent'), name='reindent', index=-2, accelerator='Ctrl+I')
itemCompile = menuProject.add(action=compile, label=msg('&Compile'), name='compile', accelerator='F9')
itemRun = menuProject.add(action=execute, label=msg('&Run'), name='run', accelerator='Ctrl+F9')

def f(self): print(self)
win.curPage.reindent = f

win.addEvent('pageOpened', pageOpened)
for page in win.pages: pageOpened(page)
pageActivated(win.curPage)
Beispiel #4
0
def pageBeforeSave(page, file):
    if file != page.lastFile: pageDetectType(page)


def pageActivated(page):
    pass


def pageOpened(page):
    page.addEvent('activated', pageActivated)
    page.addEvent('beforeSave', pageBeforeSave)
    pageDetectType(page)


menuFormat = win.menus.format
menuProject = win.menus.add(label=msg('&Project'),
                            submenu=True,
                            index=-2,
                            name='project')

quickJumpCommands = {
    ':': qjGoToLineColumn,
    '+': qjIncLineNum,
    '-': qjDecLineNum,
    '/': qjFindReg,
    ' ': qjFindLit,
}

for file in glob(pluginpath + '/ProjectTypes/*.py') + glob(pluginpath +
                                                           '/FileTypes/*.py'):
    if file.endswith('__init__.py'): continue