Пример #1
0
func NewUserInterface(cc chan<- interface{}, tc <-chan []*Tweet, lc chan<- TweetRequest, uac chan interface{}, cfg *goconf.ConfigFile) *UserInterface {
	stfl.Init()
	ui := &UserInterface{
		form: stfl.Create(`vbox[root]
  @style_normal[style_background]:
  hbox
    .expand:0
    label text[userlist]:"" .expand:h style_normal[style_userlist]:bg=blue,fg=yellow,attr=bold richtext:1 style_s_normal[style_userlist_active]:bg=white,fg=blue,attr=bold
  vbox
    .expand:vh
    list[tweets]
      ** just a place holder to be filled by constructTweetList()
  vbox
    .expand:0
    .display:1
    hbox
      @style_normal[style_infotext]:bg=blue,fg=yellow,attr=bold
      label text[infoline]:">> " .expand:h
      label text[program]:"" .expand:0
    label text[shorthelp]:"q:Quit ENTER:New Tweet ^R:Retweet r:Reply R:Public Reply ^F:Favorite D:Delete" .expand:h style_normal[style_shorthelp]:bg=blue,fg=white,attr=bold
  hbox[lastline]
    .expand:0
    label text[msg]:"" .expand:h
`),
		actionchan:            uac,
		tweetchan:             tc,
		cmdchan:               cc,
		in_reply_to_status_id: 0,
		lookupchan:            lc,
		cfg:                   cfg,
		highlight_rx:          []*regexp.Regexp{},
		users:                 []string{},
		cur_user:              0,
		confirm_quit:          false,
	}
	ui.constructTweetList()
	ui.setColors()
	ui.form.Set("program", " "+PROGRAM_NAME+" "+PROGRAM_VERSION)

	if ui.cfg != nil {
		if confirm_quit, err := ui.cfg.GetBool("default", "confirm_quit"); err == nil {
			ui.confirm_quit = confirm_quit
		}
	}

	return ui
}
Пример #2
0
func init() {
	stfl.Init()
}