当前位置: 首页>>代码示例>>Golang>>正文


Golang backend.GetEditor函数代码示例

本文整理汇总了Golang中lime/backend.GetEditor函数的典型用法代码示例。如果您正苦于以下问题:Golang GetEditor函数的具体用法?Golang GetEditor怎么用?Golang GetEditor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetEditor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Py_run_command

func (o *View) Py_run_command(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
		arg2 backend.Args
	)
	v, err := tu.GetItem(0)
	if err != nil {
		return nil, err
	}
	if v2, ok := v.(*py.Unicode); !ok {
		return nil, fmt.Errorf("Expected type *py.Unicode for backend.View.RunCommand() arg1, not %s", v.Type())
	} else {
		arg1 = v2.String()
	}
	arg2 = make(backend.Args)
	if v, err := tu.GetItem(1); err == nil {
		v2, ok := v.(*py.Dict)
		if !ok {
			return nil, fmt.Errorf("Expected type *py.Dict for backend.View.RunCommand() arg2, not %s", v.Type())
		}
		if v, err := fromPython(v2); err != nil {
			return nil, err
		} else {
			arg2 = v.(backend.Args)
		}
	}
	backend.GetEditor().CommandHandler().RunTextCommand(o.data, arg1, arg2)
	return toPython(nil)
}
开发者ID:kiawin,项目名称:lime,代码行数:29,代码来源:view_manual.go

示例2: sublime_RunCommand

func sublime_RunCommand(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
		arg2 backend.Args
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.Editor.RunCommand() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	arg2 = make(backend.Args)
	if v, err := tu.GetItem(1); err == nil {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(backend.Args); !ok {
				return nil, fmt.Errorf("Expected type backend.Args for backend.Editor.RunCommand() arg2, not %s", v.Type())
			} else {
				arg2 = v2
			}
		}
	}
	backend.GetEditor().RunCommand(arg1, arg2)
	return toPython(nil)
}
开发者ID:nadavvin,项目名称:lime,代码行数:33,代码来源:sublime_api_generated.go

示例3: sublime_OkCancelDialog

func sublime_OkCancelDialog(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
		arg2 string
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.DummyFrontend.OkCancelDialog() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	if v, err := tu.GetItem(1); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.DummyFrontend.OkCancelDialog() arg2, not %s", v.Type())
			} else {
				arg2 = v2
			}
		}
	}
	backend.GetEditor().Frontend().OkCancelDialog(arg1, arg2)
	return toPython(nil)
}
开发者ID:nadavvin,项目名称:lime,代码行数:34,代码来源:frontend_generated.go

示例4: setupEditor

func (t *tbfe) setupEditor() *backend.Editor {
	ed := backend.GetEditor()
	ed.SetFrontend(t)
	ed.LogInput(false)
	ed.LogCommands(false)

	return ed
}
开发者ID:vivekgalatage,项目名称:lime,代码行数:8,代码来源:main.go

示例5: register

func register(cmds []cmd) {
	e := backend.GetEditor()
	for i := range cmds {
		if err := e.CommandHandler().Register(cmds[i].name, cmds[i].cmd); err != nil {
			log4go.Error("Failed to register command %s: %s", cmds[i].name, err)
		}
	}
}
开发者ID:kiawin,项目名称:lime,代码行数:8,代码来源:register.go

示例6: sublime_PackagesPath

func sublime_PackagesPath() (py.Object, error) {
	ret0 := backend.GetEditor().PackagesPath()
	var err error
	var pyret0 py.Object

	pyret0, err = toPython(ret0)
	if err != nil {
		return nil, err
	}
	return pyret0, err
}
开发者ID:nadavvin,项目名称:lime,代码行数:11,代码来源:sublime_api_generated.go

示例7: sublime_NewWindow

func sublime_NewWindow() (py.Object, error) {
	ret0 := backend.GetEditor().NewWindow()
	var err error
	var pyret0 py.Object

	pyret0, err = toPython(ret0)
	if err != nil {
		return nil, err
	}
	return pyret0, err
}
开发者ID:nadavvin,项目名称:lime,代码行数:11,代码来源:sublime_api_generated.go

示例8: new_window

func new_window(w *backend.Window) {
	log4go.Debug("new_window entered")
	defer log4go.Debug("new_window exited")
	qw := qt5.NewWidget()
	qw.Show()
	qw.SetSizev(600, 400)
	tw := qt5.NewTabWidget()
	lbox := qt5.NewVBoxLayout()
	lbox.AddWidget(tw)
	c := newQLimeView(backend.GetEditor().Console())
	sa := qt5.NewScrollArea()
	sa.SetWidget(c)
	lbox.AddWidget(sa)
	qw.SetLayout(lbox)
	wnds[w] = QLimeWindow{tw, w}
}
开发者ID:richardfontana,项目名称:lime,代码行数:16,代码来源:main.go

示例9: Py_visible_region

func (o *View) Py_visible_region() (py.Object, error) {
	ret0 := backend.GetEditor().Frontend().VisibleRegion(o.data)
	var err error
	var pyret0 py.Object

	pyret0, err = _regionClass.Alloc(1)
	if err != nil {
	} else if v2, ok := pyret0.(*Region); !ok {
		return nil, fmt.Errorf("Unable to convert return value to the right type?!: %s", pyret0.Type())
	} else {
		v2.data = ret0
	}
	if err != nil {
		return nil, err
	}
	return pyret0, err
}
开发者ID:richardfontana,项目名称:lime,代码行数:17,代码来源:view_manual.go

示例10: sublime_LogInput

func sublime_LogInput(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 bool
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(bool); !ok {
				return nil, fmt.Errorf("Expected type bool for backend.Editor.LogInput() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	backend.GetEditor().LogInput(arg1)
	return toPython(nil)
}
开发者ID:nadavvin,项目名称:lime,代码行数:20,代码来源:sublime_api_generated.go

示例11: sublime_SetClipboard

func sublime_SetClipboard(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.Editor.SetClipboard() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	backend.GetEditor().SetClipboard(arg1)
	return toPython(nil)
}
开发者ID:nadavvin,项目名称:lime,代码行数:20,代码来源:sublime_api_generated.go

示例12: TestUpdateVisibleRegion

func TestUpdateVisibleRegion(t *testing.T) {
	var (
		fe tbfe
		e  = backend.GetEditor()
		w  = e.NewWindow()
		v  = w.NewFile()
	)

	fe.layout = make(map[*backend.View]layout)
	fe.layout[v] = layout{0, 0, 100, 100 - console_height - 1, Region{}, 0}
	fe.setupCallbacks(v)

	edit := v.BeginEdit()
	v.Insert(edit, 0, "foo")
	v.EndEdit(edit)

	if end := fe.layout[v].visible.End(); end != 3 {
		t.Fatalf("Expected 3, got %d", end)
	}
}
开发者ID:roger-k2,项目名称:lime,代码行数:20,代码来源:main_test.go

示例13: Py_show

func (view *View) Py_show(tu *py.Tuple, kw *py.Dict) (py.Object, error) {
	var (
		arg1 text.Region
	)
	v, err := tu.GetItem(0)
	if err != nil {
		return nil, err
	}
	if v2, ok := v.(*Region); !ok {
		if v2, ok := v.(*py.Long); !ok {
			return nil, fmt.Errorf("Expected type *Region or *Int for primitives.Buffer.Substr() arg1, not %s", v.Type())
		} else {
			arg1.A = int(v2.Int64())
			arg1.B = arg1.A + 1
		}
	} else {
		arg1 = v2.data
	}
	backend.GetEditor().Frontend().Show(view.data, arg1)
	return toPython(nil)
}
开发者ID:kiawin,项目名称:lime,代码行数:21,代码来源:view_manual.go

示例14: sublime_Unregister

func sublime_Unregister(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.commandHandler.Unregister() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	if err := backend.GetEditor().CommandHandler().Unregister(arg1); err != nil {
		return nil, err
	} else {
		return toPython(nil)
	}
}
开发者ID:nadavvin,项目名称:lime,代码行数:23,代码来源:commands_generated.go

示例15: key

func (t *tbfe) key(w http.ResponseWriter, req *http.Request) {
	log4go.Debug("key: %s", req)
	kc := req.FormValue("keyCode")
	var kp backend.KeyPress
	v, _ := strconv.ParseInt(kc, 10, 32)

	if req.FormValue("altKey") == "true" {
		kp.Alt = true
	}
	if req.FormValue("ctrlKey") == "true" {
		kp.Ctrl = true
	}
	if req.FormValue("metaKey") == "true" {
		kp.Super = true
	}
	if req.FormValue("shiftKey") == "true" {
		kp.Shift = true
	}
	if !kp.Shift {
		v = int64(unicode.ToLower(rune(v)))
	}
	kp.Key = backend.Key(v)
	backend.GetEditor().HandleInput(kp)
}
开发者ID:nadavvin,项目名称:lime,代码行数:24,代码来源:main.go


注:本文中的lime/backend.GetEditor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。