Ejemplo n.º 1
0
    def selection_changed(self,
                          selected,
                          gtkwave=MayInject('gearbox/gtkwave/inst')):

        if not gtkwave:
            return

        selected_wave_pipes = {}
        for s in selected:
            gtkwave_intf = gtkwave.item_gtkwave_intf(s.model)
            if gtkwave_intf:
                if gtkwave_intf not in selected_wave_pipes:
                    selected_wave_pipes[gtkwave_intf] = []
            else:
                continue

            wave_intf = gtkwave_intf.items_on_wave.get(s.model, None)
            if wave_intf:
                selected_wave_pipes[gtkwave_intf].append(wave_intf)

        for intf, wave_list in selected_wave_pipes.items():
            intf.gtkwave_intf.command([
                'gtkwave::/Edit/UnHighlight_All',
                f'gtkwave::highlightSignalsFromList {{{" ".join(wave_list)}}}'
            ])
Ejemplo n.º 2
0
def reloader(outdir=MayInject('sim/artifacts_dir'),
             plugin=Inject('sim/gearbox')):
    if plugin.reload:
        try:
            runpy.run_path(get_save_file_path())
        except Exception as e:
            print(f'Loading save file failed: {e}')
Ejemplo n.º 3
0
def get_save_file_path(outdir=MayInject('results-dir'),
                       script_fn=Inject('gearbox/model_script_name')):

    if script_fn is None:
        script_fn = '.gearbox.py'
    else:
        stem = os.path.splitext(os.path.basename(script_fn))[0]
        script_fn = f'.{stem}_save.py'

    return os.path.abspath(os.path.join(outdir, script_fn))
Ejemplo n.º 4
0
 def tab_bar_visibility(var,
                        visible,
                        layout=MayInject('gearbox/layout')):
     if layout:
         for w in layout.windows:
             w.tab_bar.setVisible(visible)
Ejemplo n.º 5
0
def popup_cancel(w=MayInject('gearbox/popup_desc')):
    if w is not None:
        w.cancel()
Ejemplo n.º 6
0
def popup_desc(text, buff, w=MayInject('gearbox/popup_desc')):
    if w is None:
        w = PopupDesc()
        reg['gearbox/popup_desc'] = w

    w.popup(text, buff)
Ejemplo n.º 7
0
 def menu_visibility(var, visible, main=MayInject('gearbox/main/inst')):
     if main:
         main.menuBar().setVisible(visible)
Ejemplo n.º 8
0
def popup_desc(text, buff, w=MayInject('gearbox/popup_desc')):
    if w is None:
        w = PopupDesc()
        bind('gearbox/popup_desc', w)

    w.popup(text, buff)
Ejemplo n.º 9
0
 def menu_visibility(var,
                     visible,
                     gtkwave=MayInject('gearbox/gtkwave/inst')):
     if gtkwave:
         for inst in gtkwave.instances:
             inst.command('gtkwave::toggleStripGUI')