Call Reorder and Regroup straight from profile

master
Michael Dvorkin 11 years ago
parent af77896323
commit 61f8d2dc70
  1. 4
      column_editor.go
  2. 4
      mop/mop.go
  3. 2
      screen.go
  4. 18
      yahoo_quotes.go

@ -72,7 +72,9 @@ func (self *ColumnEditor) select_right_column() *ColumnEditor {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
func (self *ColumnEditor) execute() *ColumnEditor { func (self *ColumnEditor) execute() *ColumnEditor {
self.screen.Draw(self.quotes.Reorder()) if self.profile.Reorder() == nil {
self.screen.Draw(self.quotes)
}
return self return self
} }

@ -58,7 +58,9 @@ loop:
} else if event.Ch == 'o' || event.Ch == 'O' { } else if event.Ch == 'o' || event.Ch == 'O' {
column_editor = new(mop.ColumnEditor).Initialize(screen, quotes) column_editor = new(mop.ColumnEditor).Initialize(screen, quotes)
} else if event.Ch == 'g' || event.Ch == 'G' { } else if event.Ch == 'g' || event.Ch == 'G' {
screen.Draw(quotes.Regroup()) if profile.Regroup() == nil {
screen.Draw(quotes)
}
} else if event.Ch == '?' || event.Ch == 'h' || event.Ch == 'H' { } else if event.Ch == '?' || event.Ch == 'h' || event.Ch == 'H' {
showing_help = true showing_help = true
screen.Clear().Draw(help) screen.Clear().Draw(help)

@ -57,9 +57,7 @@ func (self *Screen) Draw(objects ...interface{}) *Screen {
self.draw(object.Fetch().Format()) self.draw(object.Fetch().Format())
case *Quotes: case *Quotes:
object := ptr.(*Quotes) object := ptr.(*Quotes)
if object.Ready() {
self.draw(object.Fetch().Format()) self.draw(object.Fetch().Format())
}
default: default:
self.draw(ptr.(string)) self.draw(ptr.(string))
} }

@ -123,24 +123,6 @@ func (self *Quotes) RemoveTickers(tickers []string) (removed int, err error) {
return return
} }
//-----------------------------------------------------------------------------
func (self *Quotes) Reorder() *Quotes {
if self.profile.Reorder() == nil {
self.stocks = nil // Force fetch.
}
return self
}
//-----------------------------------------------------------------------------
func (self *Quotes) Regroup() *Quotes {
if self.profile.Regroup() == nil {
self.stocks = nil // Force fetch.
}
return self
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
func (self *Quotes) parse(body []byte) *Quotes { func (self *Quotes) parse(body []byte) *Quotes {
lines := bytes.Split(body, []byte{'\n'}) lines := bytes.Split(body, []byte{'\n'})

Loading…
Cancel
Save