repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
partition
stringclasses
1 value
kristianmandrup/cream
lib/cream/controller/user_control.rb
Cream.UserControl.sign_in
def sign_in(resource_or_scope, *args) options = args.extract_options! scope = Devise::Mapping.find_scope!(resource_or_scope) resource = args.last || resource_or_scope expire_session_data_after_sign_in! warden.set_user(resource, options.merge!(:scope => scope)) # set user id ...
ruby
def sign_in(resource_or_scope, *args) options = args.extract_options! scope = Devise::Mapping.find_scope!(resource_or_scope) resource = args.last || resource_or_scope expire_session_data_after_sign_in! warden.set_user(resource, options.merge!(:scope => scope)) # set user id ...
[ "def", "sign_in", "(", "resource_or_scope", ",", "*", "args", ")", "options", "=", "args", ".", "extract_options!", "scope", "=", "Devise", "::", "Mapping", ".", "find_scope!", "(", "resource_or_scope", ")", "resource", "=", "args", ".", "last", "||", "resou...
Sign in an user that already was authenticated. This helper is useful for logging users in after sign up. Examples: sign_in :user, @user # sign_in(scope, resource) sign_in @user # sign_in(resource) sign_in @user, :event => :authentication # sign_in(resource...
[ "Sign", "in", "an", "user", "that", "already", "was", "authenticated", ".", "This", "helper", "is", "useful", "for", "logging", "users", "in", "after", "sign", "up", "." ]
6edbdc8796b4a942e11d1054649b2e058c90c9d8
https://github.com/kristianmandrup/cream/blob/6edbdc8796b4a942e11d1054649b2e058c90c9d8/lib/cream/controller/user_control.rb#L54-L63
train
kristianmandrup/cream
lib/cream/controller/user_control.rb
Cream.UserControl.sign_out
def sign_out(resource_or_scope) scope = Devise::Mapping.find_scope!(resource_or_scope) warden.user(scope) # Without loading user here, before_logout hook is not called warden.raw_session.inspect # Without this inspect here. The session does not clear. warden.logout(scope) # user id ...
ruby
def sign_out(resource_or_scope) scope = Devise::Mapping.find_scope!(resource_or_scope) warden.user(scope) # Without loading user here, before_logout hook is not called warden.raw_session.inspect # Without this inspect here. The session does not clear. warden.logout(scope) # user id ...
[ "def", "sign_out", "(", "resource_or_scope", ")", "scope", "=", "Devise", "::", "Mapping", ".", "find_scope!", "(", "resource_or_scope", ")", "warden", ".", "user", "(", "scope", ")", "warden", ".", "raw_session", ".", "inspect", "warden", ".", "logout", "("...
Sign out a given user or scope. This helper is useful for signing out an user after deleting accounts. Examples: sign_out :user # sign_out(scope) sign_out @user # sign_out(resource)
[ "Sign", "out", "a", "given", "user", "or", "scope", ".", "This", "helper", "is", "useful", "for", "signing", "out", "an", "user", "after", "deleting", "accounts", "." ]
6edbdc8796b4a942e11d1054649b2e058c90c9d8
https://github.com/kristianmandrup/cream/blob/6edbdc8796b4a942e11d1054649b2e058c90c9d8/lib/cream/controller/user_control.rb#L78-L85
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.insert
def insert off0, data _maxlen = @maxlen || @width - @internal_width if data.length > _maxlen data = wrap_text data # $log.debug "after wrap text done :#{data}" data = data.split("\n") data[-1] << "\r" #XXXX data.each do |row| @list.insert off0, row off0 ...
ruby
def insert off0, data _maxlen = @maxlen || @width - @internal_width if data.length > _maxlen data = wrap_text data # $log.debug "after wrap text done :#{data}" data = data.split("\n") data[-1] << "\r" #XXXX data.each do |row| @list.insert off0, row off0 ...
[ "def", "insert", "off0", ",", "data", "_maxlen", "=", "@maxlen", "||", "@width", "-", "@internal_width", "if", "data", ".", "length", ">", "_maxlen", "data", "=", "wrap_text", "data", "data", "=", "data", ".", "split", "(", "\"\\n\"", ")", "data", "[", ...
trying to wrap and insert
[ "trying", "to", "wrap", "and", "insert" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L114-L135
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.<<
def << data # if width if nil, either set it, or add this to a container that sets it before calling this method _maxlen = @maxlen || @width - @internal_width if data.length > _maxlen #$log.debug "wrapped append for #{data}" data = wrap_text data #$log.debug "after wrap text fo...
ruby
def << data # if width if nil, either set it, or add this to a container that sets it before calling this method _maxlen = @maxlen || @width - @internal_width if data.length > _maxlen #$log.debug "wrapped append for #{data}" data = wrap_text data #$log.debug "after wrap text fo...
[ "def", "<<", "data", "_maxlen", "=", "@maxlen", "||", "@width", "-", "@internal_width", "if", "data", ".", "length", ">", "_maxlen", "data", "=", "wrap_text", "data", "data", "=", "data", ".", "split", "(", "\"\\n\"", ")", "data", ".", "each", "{", "|"...
wraps line sent in if longer than _maxlen Typically a line is sent in. We wrap and put a hard return at end.
[ "wraps", "line", "sent", "in", "if", "longer", "than", "_maxlen", "Typically", "a", "line", "is", "sent", "in", ".", "We", "wrap", "and", "put", "a", "hard", "return", "at", "end", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L139-L161
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.undo_delete
def undo_delete # added 2008-11-27 12:43 paste delete buffer into insertion point return if @delete_buffer.nil? $log.warn "undo_delete is broken! perhaps cannot be used . textarea 347 " # FIXME - can be an array case @delete_buffer when Array # we need to unrol...
ruby
def undo_delete # added 2008-11-27 12:43 paste delete buffer into insertion point return if @delete_buffer.nil? $log.warn "undo_delete is broken! perhaps cannot be used . textarea 347 " # FIXME - can be an array case @delete_buffer when Array # we need to unrol...
[ "def", "undo_delete", "return", "if", "@delete_buffer", ".", "nil?", "$log", ".", "warn", "\"undo_delete is broken! perhaps cannot be used . textarea 347 \"", "case", "@delete_buffer", "when", "Array", "str", "=", "@delete_buffer", ".", "first", "else", "str", "=", "@de...
this is broken, delete_buffer could be a line or a string or array of lines
[ "this", "is", "broken", "delete_buffer", "could", "be", "a", "line", "or", "a", "string", "or", "array", "of", "lines" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L376-L391
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.insert_break
def insert_break return -1 unless @editable # insert a blank row and append rest of this line to cursor $log.debug "ENTER PRESSED at #{@curpos}, on row #{@current_index}" @delete_buffer = (delete_eol || "") @list[@current_index] << "\r" $log.debug "DELETE BUFFER #{@delete_buffer}" ...
ruby
def insert_break return -1 unless @editable # insert a blank row and append rest of this line to cursor $log.debug "ENTER PRESSED at #{@curpos}, on row #{@current_index}" @delete_buffer = (delete_eol || "") @list[@current_index] << "\r" $log.debug "DELETE BUFFER #{@delete_buffer}" ...
[ "def", "insert_break", "return", "-", "1", "unless", "@editable", "$log", ".", "debug", "\"ENTER PRESSED at #{@curpos}, on row #{@current_index}\"", "@delete_buffer", "=", "(", "delete_eol", "||", "\"\"", ")", "@list", "[", "@current_index", "]", "<<", "\"\\r\"", "$l...
FIXME - fire event not correct, not undo'ing correctly, check row and also slash r append
[ "FIXME", "-", "fire", "event", "not", "correct", "not", "undo", "ing", "correctly", "check", "row", "and", "also", "slash", "r", "append" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L393-L407
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.set_form_col
def set_form_col col1=@curpos @curpos = col1 @cols_panned ||= 0 cursor_bounds_check ## added win_col on 2009-12-28 20:21 for embedded forms BUFFERED TRYING OUT win_col = 0 # 2010-02-07 23:19 new cursor stuff #col = win_col + @orig_col + @col_offset + @curpos #col = win_c...
ruby
def set_form_col col1=@curpos @curpos = col1 @cols_panned ||= 0 cursor_bounds_check ## added win_col on 2009-12-28 20:21 for embedded forms BUFFERED TRYING OUT win_col = 0 # 2010-02-07 23:19 new cursor stuff #col = win_col + @orig_col + @col_offset + @curpos #col = win_c...
[ "def", "set_form_col", "col1", "=", "@curpos", "@curpos", "=", "col1", "@cols_panned", "||=", "0", "cursor_bounds_check", "win_col", "=", "0", "col", "=", "win_col", "+", "@col", "+", "@col_offset", "+", "@curpos", "+", "@cols_panned", "$log", ".", "debug", ...
set cursor on correct column
[ "set", "cursor", "on", "correct", "column" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L409-L425
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.insert_wrap
def insert_wrap lineno, pos, lastchars _maxlen = @maxlen || @width - @internal_width @list[lineno].insert pos, lastchars len = @list[lineno].length if len > _maxlen push_last_word lineno #- sometime i may push down 10 chars but the last word is less end end
ruby
def insert_wrap lineno, pos, lastchars _maxlen = @maxlen || @width - @internal_width @list[lineno].insert pos, lastchars len = @list[lineno].length if len > _maxlen push_last_word lineno #- sometime i may push down 10 chars but the last word is less end end
[ "def", "insert_wrap", "lineno", ",", "pos", ",", "lastchars", "_maxlen", "=", "@maxlen", "||", "@width", "-", "@internal_width", "@list", "[", "lineno", "]", ".", "insert", "pos", ",", "lastchars", "len", "=", "@list", "[", "lineno", "]", ".", "length", ...
this attempts to recursively insert into a row, seeing that any stuff exceeding is pushed down further. Yes, it should check for a para end and insert. Currently it could add to next para.
[ "this", "attempts", "to", "recursively", "insert", "into", "a", "row", "seeing", "that", "any", "stuff", "exceeding", "is", "pushed", "down", "further", ".", "Yes", "it", "should", "check", "for", "a", "para", "end", "and", "insert", ".", "Currently", "it"...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L686-L693
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.putch
def putch char _maxlen = @maxlen || @width - @internal_width @buffer ||= @list[@current_index] return -1 if !@editable #or @buffer.length >= _maxlen #if @chars_allowed != nil # remove useless functionality #return if char.match(@chars_allowed).nil? #end raise "putch expects ...
ruby
def putch char _maxlen = @maxlen || @width - @internal_width @buffer ||= @list[@current_index] return -1 if !@editable #or @buffer.length >= _maxlen #if @chars_allowed != nil # remove useless functionality #return if char.match(@chars_allowed).nil? #end raise "putch expects ...
[ "def", "putch", "char", "_maxlen", "=", "@maxlen", "||", "@width", "-", "@internal_width", "@buffer", "||=", "@list", "[", "@current_index", "]", "return", "-", "1", "if", "!", "@editable", "raise", "\"putch expects only one char\"", "if", "char", ".", "length",...
add one char. careful, i shoved a string in yesterday.
[ "add", "one", "char", ".", "careful", "i", "shoved", "a", "string", "in", "yesterday", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L696-L731
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.remove_last_word
def remove_last_word lineno @list[lineno].chomp! line=@list[lineno] lastspace = line.rindex(" ") if !lastspace.nil? lastchars = line[lastspace+1..-1] @list[lineno].slice!(lastspace..-1) $log.debug " remove_last: lastspace #{lastspace},#{lastchars},#{@list[lineno]}" ...
ruby
def remove_last_word lineno @list[lineno].chomp! line=@list[lineno] lastspace = line.rindex(" ") if !lastspace.nil? lastchars = line[lastspace+1..-1] @list[lineno].slice!(lastspace..-1) $log.debug " remove_last: lastspace #{lastspace},#{lastchars},#{@list[lineno]}" ...
[ "def", "remove_last_word", "lineno", "@list", "[", "lineno", "]", ".", "chomp!", "line", "=", "@list", "[", "lineno", "]", "lastspace", "=", "line", ".", "rindex", "(", "\" \"", ")", "if", "!", "lastspace", ".", "nil?", "lastchars", "=", "line", "[", "...
removes and returns last word in given line number, or nil if no whitespace
[ "removes", "and", "returns", "last", "word", "in", "given", "line", "number", "or", "nil", "if", "no", "whitespace" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L733-L745
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.move_chars_up
def move_chars_up oldprow = @current_index oldcurpos = @curpos _maxlen = @maxlen || @width - @internal_width space_left = _maxlen - @buffer.length can_move = [space_left, next_line.length].min carry_up = @list[@current_index+1].slice!(0, can_move) @list[@current_index] << car...
ruby
def move_chars_up oldprow = @current_index oldcurpos = @curpos _maxlen = @maxlen || @width - @internal_width space_left = _maxlen - @buffer.length can_move = [space_left, next_line.length].min carry_up = @list[@current_index+1].slice!(0, can_move) @list[@current_index] << car...
[ "def", "move_chars_up", "oldprow", "=", "@current_index", "oldcurpos", "=", "@curpos", "_maxlen", "=", "@maxlen", "||", "@width", "-", "@internal_width", "space_left", "=", "_maxlen", "-", "@buffer", ".", "length", "can_move", "=", "[", "space_left", ",", "next_...
tries to move up as many as possible should not be called if line ends in "\r"
[ "tries", "to", "move", "up", "as", "many", "as", "possible", "should", "not", "be", "called", "if", "line", "ends", "in", "\\", "r" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L775-L785
train
mare-imbrium/canis
lib/canis/core/widgets/extras/rtextarea.rb
Canis.TextArea.get_text
def get_text l = getvalue str = "" old = " " l.each_with_index do |line, i| tmp = line.gsub("\n","") tmp.gsub!("\r", "\n") if old[-1,1] !~ /\s/ and tmp[0,1] !~ /\s/ str << " " end str << tmp old = tmp end str end
ruby
def get_text l = getvalue str = "" old = " " l.each_with_index do |line, i| tmp = line.gsub("\n","") tmp.gsub!("\r", "\n") if old[-1,1] !~ /\s/ and tmp[0,1] !~ /\s/ str << " " end str << tmp old = tmp end str end
[ "def", "get_text", "l", "=", "getvalue", "str", "=", "\"\"", "old", "=", "\" \"", "l", ".", "each_with_index", "do", "|", "line", ",", "i", "|", "tmp", "=", "line", ".", "gsub", "(", "\"\\n\"", ",", "\"\"", ")", "tmp", ".", "gsub!", "(", "\"\\r\"",...
def to_s this was just annoying in debugs
[ "def", "to_s", "this", "was", "just", "annoying", "in", "debugs" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/rtextarea.rb#L812-L826
train
mare-imbrium/canis
lib/canis/core/widgets/deprecated/rtree.rb
Canis.Tree.root
def root node=nil, asks_allow_children=false, &block if @treemodel return @treemodel.root unless node raise ArgumentError, "Root already set" end raise ArgumentError, "root: node cannot be nil" unless node @treemodel = Canis::DefaultTreeModel.new(node, asks_allow_children, &bloc...
ruby
def root node=nil, asks_allow_children=false, &block if @treemodel return @treemodel.root unless node raise ArgumentError, "Root already set" end raise ArgumentError, "root: node cannot be nil" unless node @treemodel = Canis::DefaultTreeModel.new(node, asks_allow_children, &bloc...
[ "def", "root", "node", "=", "nil", ",", "asks_allow_children", "=", "false", ",", "&", "block", "if", "@treemodel", "return", "@treemodel", ".", "root", "unless", "node", "raise", "ArgumentError", ",", "\"Root already set\"", "end", "raise", "ArgumentError", ","...
Sets the given node as root and returns treemodel. Returns root if no argument given. Now we return root if already set Made node nillable so we can return root. @raise ArgumentError if setting a root after its set or passing nil if its not been set.
[ "Sets", "the", "given", "node", "as", "root", "and", "returns", "treemodel", ".", "Returns", "root", "if", "no", "argument", "given", ".", "Now", "we", "return", "root", "if", "already", "set", "Made", "node", "nillable", "so", "we", "can", "return", "ro...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/deprecated/rtree.rb#L159-L167
train
mare-imbrium/canis
lib/canis/core/widgets/deprecated/rtree.rb
Canis.Tree.select_default_values
def select_default_values return if @default_value.nil? # NOTE list not yet created raise "list has not yet been created" unless @list index = node_to_row @default_value raise "could not find node #{@default_value}, #{@list} " unless index return unless index @current_index = ...
ruby
def select_default_values return if @default_value.nil? # NOTE list not yet created raise "list has not yet been created" unless @list index = node_to_row @default_value raise "could not find node #{@default_value}, #{@list} " unless index return unless index @current_index = ...
[ "def", "select_default_values", "return", "if", "@default_value", ".", "nil?", "raise", "\"list has not yet been created\"", "unless", "@list", "index", "=", "node_to_row", "@default_value", "raise", "\"could not find node #{@default_value}, #{@list} \"", "unless", "index", "r...
thanks to shoes, not sure how this will impact since widget has text. show default value as selected and fire handler for it This is called in repaint, so can raise an error if called on creation or before repaint. Just set @default_value, and let us handle the rest. Suggestions are welcome.
[ "thanks", "to", "shoes", "not", "sure", "how", "this", "will", "impact", "since", "widget", "has", "text", ".", "show", "default", "value", "as", "selected", "and", "fire", "handler", "for", "it", "This", "is", "called", "in", "repaint", "so", "can", "ra...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/deprecated/rtree.rb#L244-L254
train
mare-imbrium/canis
lib/canis/core/widgets/deprecated/rtree.rb
Canis.Tree.node_to_row
def node_to_row node crow = nil @list.each_with_index { |e,i| if e == node crow = i break end } crow end
ruby
def node_to_row node crow = nil @list.each_with_index { |e,i| if e == node crow = i break end } crow end
[ "def", "node_to_row", "node", "crow", "=", "nil", "@list", ".", "each_with_index", "{", "|", "e", ",", "i", "|", "if", "e", "==", "node", "crow", "=", "i", "break", "end", "}", "crow", "end" ]
convert a given node to row
[ "convert", "a", "given", "node", "to", "row" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/deprecated/rtree.rb#L563-L572
train
mare-imbrium/canis
lib/canis/core/widgets/deprecated/rtree.rb
Canis.Tree.expand_parents
def expand_parents node _path = node.tree_path _path.each do |e| # if already expanded parent then break we should break #set_expanded_state(e, true) expand_node(e) end end
ruby
def expand_parents node _path = node.tree_path _path.each do |e| # if already expanded parent then break we should break #set_expanded_state(e, true) expand_node(e) end end
[ "def", "expand_parents", "node", "_path", "=", "node", ".", "tree_path", "_path", ".", "each", "do", "|", "e", "|", "expand_node", "(", "e", ")", "end", "end" ]
goes up to root of this node, and expands down to this node this is often required to make a specific node visible such as in a dir listing when current dir is deep in heirarchy.
[ "goes", "up", "to", "root", "of", "this", "node", "and", "expands", "down", "to", "this", "node", "this", "is", "often", "required", "to", "make", "a", "specific", "node", "visible", "such", "as", "in", "a", "dir", "listing", "when", "current", "dir", ...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/deprecated/rtree.rb#L620-L627
train
mare-imbrium/canis
lib/canis/core/widgets/deprecated/rtree.rb
Canis.Tree.expand_children
def expand_children node=:current_index $multiplier = 999 if !$multiplier || $multiplier == 0 node = row_to_node if node == :current_index return if node.children.empty? # or node.is_leaf? #node.children.each do |e| #expand_node e # this will keep expanding parents #expand_child...
ruby
def expand_children node=:current_index $multiplier = 999 if !$multiplier || $multiplier == 0 node = row_to_node if node == :current_index return if node.children.empty? # or node.is_leaf? #node.children.each do |e| #expand_node e # this will keep expanding parents #expand_child...
[ "def", "expand_children", "node", "=", ":current_index", "$multiplier", "=", "999", "if", "!", "$multiplier", "||", "$multiplier", "==", "0", "node", "=", "row_to_node", "if", "node", "==", ":current_index", "return", "if", "node", ".", "children", ".", "empty...
this expands all the children of a node, recursively we can't use multiplier concept here since we are doing a preorder enumeration we need to do a breadth first enumeration to use a multiplier
[ "this", "expands", "all", "the", "children", "of", "a", "node", "recursively", "we", "can", "t", "use", "multiplier", "concept", "here", "since", "we", "are", "doing", "a", "preorder", "enumeration", "we", "need", "to", "do", "a", "breadth", "first", "enum...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/deprecated/rtree.rb#L632-L645
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.DefaultTableRowSorter.sort
def sort return unless @model return if @sort_keys.empty? $log.debug "TABULAR SORT KEYS #{sort_keys} " # first row is the header which should remain in place # We could have kept column headers separate, but then too much of mucking around # with textpad, this way we avoi...
ruby
def sort return unless @model return if @sort_keys.empty? $log.debug "TABULAR SORT KEYS #{sort_keys} " # first row is the header which should remain in place # We could have kept column headers separate, but then too much of mucking around # with textpad, this way we avoi...
[ "def", "sort", "return", "unless", "@model", "return", "if", "@sort_keys", ".", "empty?", "$log", ".", "debug", "\"TABULAR SORT KEYS #{sort_keys} \"", "header", "=", "@model", ".", "delete_at", "0", "begin", "@model", ".", "sort!", "{", "|", "x", ",", "y", "...
sorts the model based on sort keys and reverse flags @sort_keys contains indices to sort on @reverse_flags is an array of booleans, true for reverse, nil or false for ascending
[ "sorts", "the", "model", "based", "on", "sort", "keys", "and", "reverse", "flags" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L117-L168
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.DefaultTableRowSorter.toggle_sort_order
def toggle_sort_order index index += 1 # increase by 1, since 0 won't multiple by -1 # internally, reverse sort is maintained by multiplying number by -1 @sort_keys ||= [] if @sort_keys.first && index == @sort_keys.first.abs @sort_keys[0] *= -1 else @sort_keys...
ruby
def toggle_sort_order index index += 1 # increase by 1, since 0 won't multiple by -1 # internally, reverse sort is maintained by multiplying number by -1 @sort_keys ||= [] if @sort_keys.first && index == @sort_keys.first.abs @sort_keys[0] *= -1 else @sort_keys...
[ "def", "toggle_sort_order", "index", "index", "+=", "1", "@sort_keys", "||=", "[", "]", "if", "@sort_keys", ".", "first", "&&", "index", "==", "@sort_keys", ".", "first", ".", "abs", "@sort_keys", "[", "0", "]", "*=", "-", "1", "else", "@sort_keys", ".",...
toggle the sort order if given column offset is primary sort key Otherwise, insert as primary sort key, ascending.
[ "toggle", "the", "sort", "order", "if", "given", "column", "offset", "is", "primary", "sort", "key", "Otherwise", "insert", "as", "primary", "sort", "key", "ascending", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L171-L186
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.DefaultTableRenderer.convert_value_to_text
def convert_value_to_text r str = [] fmt = nil field = nil # we need to loop through chash and get index from it and get that row from r each_column {|c,i| e = r[c.index] w = c.width l = e.to_s.length # if value is longer than width, then t...
ruby
def convert_value_to_text r str = [] fmt = nil field = nil # we need to loop through chash and get index from it and get that row from r each_column {|c,i| e = r[c.index] w = c.width l = e.to_s.length # if value is longer than width, then t...
[ "def", "convert_value_to_text", "r", "str", "=", "[", "]", "fmt", "=", "nil", "field", "=", "nil", "each_column", "{", "|", "c", ",", "i", "|", "e", "=", "r", "[", "c", ".", "index", "]", "w", "=", "c", ".", "width", "l", "=", "e", ".", "to_s...
Takes the array of row data and formats it using column widths and returns an array which is used for printing return an array so caller can color columns if need be
[ "Takes", "the", "array", "of", "row", "data", "and", "formats", "it", "using", "column", "widths", "and", "returns", "an", "array", "which", "is", "used", "for", "printing" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L244-L274
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.DefaultTableRenderer.render_data
def render_data pad, lineno, text text = text.join # FIXME why repeatedly getting this colorpair cp = @color_pair att = @attrib # added for selection, but will crash if selection is not extended !!! XXX if @source.is_row_selected? lineno att = REVERSE ...
ruby
def render_data pad, lineno, text text = text.join # FIXME why repeatedly getting this colorpair cp = @color_pair att = @attrib # added for selection, but will crash if selection is not extended !!! XXX if @source.is_row_selected? lineno att = REVERSE ...
[ "def", "render_data", "pad", ",", "lineno", ",", "text", "text", "=", "text", ".", "join", "cp", "=", "@color_pair", "att", "=", "@attrib", "if", "@source", ".", "is_row_selected?", "lineno", "att", "=", "REVERSE", "end", "FFI", "::", "NCurses", ".", "wa...
passes padded data for final printing or data row this allows user to do row related coloring without having to tamper with the headers or other internal workings. This will not be called if column specific colorign is in effect. @param text is an array of strings, in the order of actual printing with hidden cols r...
[ "passes", "padded", "data", "for", "final", "printing", "or", "data", "row", "this", "allows", "user", "to", "do", "row", "related", "coloring", "without", "having", "to", "tamper", "with", "the", "headers", "or", "other", "internal", "workings", ".", "This"...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L307-L321
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.DefaultTableRenderer.check_colors
def check_colors each_column {|c,i| if c.color || c.bgcolor || c.attrib @_check_coloring = true return end @_check_coloring = false } end
ruby
def check_colors each_column {|c,i| if c.color || c.bgcolor || c.attrib @_check_coloring = true return end @_check_coloring = false } end
[ "def", "check_colors", "each_column", "{", "|", "c", ",", "i", "|", "if", "c", ".", "color", "||", "c", ".", "bgcolor", "||", "c", ".", "attrib", "@_check_coloring", "=", "true", "return", "end", "@_check_coloring", "=", "false", "}", "end" ]
check if we need to individually color columns or we can do the entire row in one shot
[ "check", "if", "we", "need", "to", "individually", "color", "columns", "or", "we", "can", "do", "the", "entire", "row", "in", "one", "shot" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L343-L351
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.get_column
def get_column index return @chash[index] if @chash[index] # create a new entry since none present c = ColumnInfo.new c.index = index @chash[index] = c return c end
ruby
def get_column index return @chash[index] if @chash[index] # create a new entry since none present c = ColumnInfo.new c.index = index @chash[index] = c return c end
[ "def", "get_column", "index", "return", "@chash", "[", "index", "]", "if", "@chash", "[", "index", "]", "c", "=", "ColumnInfo", ".", "new", "c", ".", "index", "=", "index", "@chash", "[", "index", "]", "=", "c", "return", "c", "end" ]
retrieve the column info structure for the given offset. The offset pertains to the visible offset not actual offset in data model. These two differ when we move a column. @return ColumnInfo object containing width align color bgcolor attrib hidden
[ "retrieve", "the", "column", "info", "structure", "for", "the", "given", "offset", ".", "The", "offset", "pertains", "to", "the", "visible", "offset", "not", "actual", "offset", "in", "data", "model", ".", "These", "two", "differ", "when", "we", "move", "a...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L450-L457
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.content_cols
def content_cols total = 0 #@chash.each_pair { |i, c| #@chash.each_with_index { |c, i| #next if c.hidden each_column {|c,i| w = c.width # if you use prepare_format then use w+2 due to separator symbol total += w + 1 } return total end
ruby
def content_cols total = 0 #@chash.each_pair { |i, c| #@chash.each_with_index { |c, i| #next if c.hidden each_column {|c,i| w = c.width # if you use prepare_format then use w+2 due to separator symbol total += w + 1 } return total end
[ "def", "content_cols", "total", "=", "0", "each_column", "{", "|", "c", ",", "i", "|", "w", "=", "c", ".", "width", "total", "+=", "w", "+", "1", "}", "return", "total", "end" ]
calculate pad width based on widths of columns
[ "calculate", "pad", "width", "based", "on", "widths", "of", "columns" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L465-L476
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.fire_column_event
def fire_column_event eve require 'canis/core/include/ractionevent' aev = TextActionEvent.new self, eve, get_column(@column_pointer.current_index), @column_pointer.current_index, @column_pointer.last_index fire_handler eve, aev end
ruby
def fire_column_event eve require 'canis/core/include/ractionevent' aev = TextActionEvent.new self, eve, get_column(@column_pointer.current_index), @column_pointer.current_index, @column_pointer.last_index fire_handler eve, aev end
[ "def", "fire_column_event", "eve", "require", "'canis/core/include/ractionevent'", "aev", "=", "TextActionEvent", ".", "new", "self", ",", "eve", ",", "get_column", "(", "@column_pointer", ".", "current_index", ")", ",", "@column_pointer", ".", "current_index", ",", ...
a column traversal has happened. FIXME needs to be looked into. is this consistent naming wise and are we using the correct object In old system it was TABLE_TRAVERSAL_EVENT
[ "a", "column", "traversal", "has", "happened", ".", "FIXME", "needs", "to", "be", "looked", "into", ".", "is", "this", "consistent", "naming", "wise", "and", "are", "we", "using", "the", "correct", "object", "In", "old", "system", "it", "was", "TABLE_TRAVE...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L551-L555
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table._init_model
def _init_model array # clear the column data -- this line should be called otherwise previous tables stuff will remain. @chash.clear array.each_with_index { |e,i| # if columns added later we could be overwriting the width c = get_column(i) c.width ||= 10 } # mainta...
ruby
def _init_model array # clear the column data -- this line should be called otherwise previous tables stuff will remain. @chash.clear array.each_with_index { |e,i| # if columns added later we could be overwriting the width c = get_column(i) c.width ||= 10 } # mainta...
[ "def", "_init_model", "array", "@chash", ".", "clear", "array", ".", "each_with_index", "{", "|", "e", ",", "i", "|", "c", "=", "get_column", "(", "i", ")", "c", ".", "width", "||=", "10", "}", "@column_pointer", "=", "Circular", ".", "new", "array", ...
size each column based on widths of this row of data. Only changed width if no width for that column
[ "size", "each", "column", "based", "on", "widths", "of", "this", "row", "of", "data", ".", "Only", "changed", "width", "if", "no", "width", "for", "that", "column" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L649-L659
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.model_row
def model_row index array = @list[index] array.each_with_index { |c,i| # if columns added later we could be overwriting the width ch = get_column(i) ch.width = c.to_s.length + 2 } # maintains index in current pointer and gives next or prev @column_pointer = Circular...
ruby
def model_row index array = @list[index] array.each_with_index { |c,i| # if columns added later we could be overwriting the width ch = get_column(i) ch.width = c.to_s.length + 2 } # maintains index in current pointer and gives next or prev @column_pointer = Circular...
[ "def", "model_row", "index", "array", "=", "@list", "[", "index", "]", "array", ".", "each_with_index", "{", "|", "c", ",", "i", "|", "ch", "=", "get_column", "(", "i", ")", "ch", ".", "width", "=", "c", ".", "to_s", ".", "length", "+", "2", "}",...
size each column based on widths of this row of data.
[ "size", "each", "column", "based", "on", "widths", "of", "this", "row", "of", "data", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L661-L671
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.save_as
def save_as outfile _t = "(all rows)" if @selected_indices.size > 0 _t = "(selected rows)" end unless outfile outfile = get_string "Enter file name to save #{_t} as " return unless outfile end # if there is a selection, then write only selected rows l =...
ruby
def save_as outfile _t = "(all rows)" if @selected_indices.size > 0 _t = "(selected rows)" end unless outfile outfile = get_string "Enter file name to save #{_t} as " return unless outfile end # if there is a selection, then write only selected rows l =...
[ "def", "save_as", "outfile", "_t", "=", "\"(all rows)\"", "if", "@selected_indices", ".", "size", ">", "0", "_t", "=", "\"(selected rows)\"", "end", "unless", "outfile", "outfile", "=", "get_string", "\"Enter file name to save #{_t} as \"", "return", "unless", "outfil...
save the table as a file @param String name of output file. If nil, user is prompted Currently, tabs are used as delimiter, but this could be based on input separator, or prompted.
[ "save", "the", "table", "as", "a", "file" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L768-L793
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.delete_at
def delete_at ix return unless @list raise ArgumentError, "Argument must be within 0 and #{@list.length}" if ix < 0 or ix >= @list.length fire_dimension_changed #@list.delete_at(ix + @_header_adjustment) @list.delete_at(ix) end
ruby
def delete_at ix return unless @list raise ArgumentError, "Argument must be within 0 and #{@list.length}" if ix < 0 or ix >= @list.length fire_dimension_changed #@list.delete_at(ix + @_header_adjustment) @list.delete_at(ix) end
[ "def", "delete_at", "ix", "return", "unless", "@list", "raise", "ArgumentError", ",", "\"Argument must be within 0 and #{@list.length}\"", "if", "ix", "<", "0", "or", "ix", ">=", "@list", ".", "length", "fire_dimension_changed", "@list", ".", "delete_at", "(", "ix",...
delete a data row at index NOTE : This does not adjust for header_adjustment. So zero will refer to the header if there is one. This is to keep consistent with textpad which does not know of header_adjustment and uses the actual index. Usually, programmers will be dealing with +@current_index+
[ "delete", "a", "data", "row", "at", "index" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L816-L822
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.set_value_at
def set_value_at row,col,val actrow = row + @_header_adjustment @list[actrow , col] = val fire_row_changed actrow self end
ruby
def set_value_at row,col,val actrow = row + @_header_adjustment @list[actrow , col] = val fire_row_changed actrow self end
[ "def", "set_value_at", "row", ",", "col", ",", "val", "actrow", "=", "row", "+", "@_header_adjustment", "@list", "[", "actrow", ",", "col", "]", "=", "val", "fire_row_changed", "actrow", "self", "end" ]
set value at the cell at row and col @param int row @param int col @param String value @return self
[ "set", "value", "at", "the", "cell", "at", "row", "and", "col" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L842-L847
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.move_column
def move_column ix, newix acol = @chash.delete_at ix @chash.insert newix, acol _invalidate_width_cache #tmce = TableColumnModelEvent.new(ix, newix, self, :MOVE) #fire_handler :TABLE_COLUMN_MODEL_EVENT, tmce end
ruby
def move_column ix, newix acol = @chash.delete_at ix @chash.insert newix, acol _invalidate_width_cache #tmce = TableColumnModelEvent.new(ix, newix, self, :MOVE) #fire_handler :TABLE_COLUMN_MODEL_EVENT, tmce end
[ "def", "move_column", "ix", ",", "newix", "acol", "=", "@chash", ".", "delete_at", "ix", "@chash", ".", "insert", "newix", ",", "acol", "_invalidate_width_cache", "end" ]
should all this move into table column model or somepn move a column from offset ix to offset newix
[ "should", "all", "this", "move", "into", "table", "column", "model", "or", "somepn", "move", "a", "column", "from", "offset", "ix", "to", "offset", "newix" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L879-L885
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.fire_action_event
def fire_action_event if header_row? if @table_row_sorter x = _convert_curpos_to_column c = @chash[x] # convert to index in data model since sorter only has data_model index = c.index @table_row_sorter.toggle_sort_order index @table_row_sorter.so...
ruby
def fire_action_event if header_row? if @table_row_sorter x = _convert_curpos_to_column c = @chash[x] # convert to index in data model since sorter only has data_model index = c.index @table_row_sorter.toggle_sort_order index @table_row_sorter.so...
[ "def", "fire_action_event", "if", "header_row?", "if", "@table_row_sorter", "x", "=", "_convert_curpos_to_column", "c", "=", "@chash", "[", "x", "]", "index", "=", "c", ".", "index", "@table_row_sorter", ".", "toggle_sort_order", "index", "@table_row_sorter", ".", ...
called when ENTER is pressed. Takes into account if user is on header_row
[ "called", "when", "ENTER", "is", "pressed", ".", "Takes", "into", "account", "if", "user", "is", "on", "header_row" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L961-L974
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.matching_indices
def matching_indices raise "block required for matching_indices" unless block_given? @indices = [] ## content can be string or Chunkline, so we had to write <tt>index</tt> for this. @list.each_with_index do |fields, ix| flag = yield ix, fields if flag @indices << ix ...
ruby
def matching_indices raise "block required for matching_indices" unless block_given? @indices = [] ## content can be string or Chunkline, so we had to write <tt>index</tt> for this. @list.each_with_index do |fields, ix| flag = yield ix, fields if flag @indices << ix ...
[ "def", "matching_indices", "raise", "\"block required for matching_indices\"", "unless", "block_given?", "@indices", "=", "[", "]", "@list", ".", "each_with_index", "do", "|", "fields", ",", "ix", "|", "flag", "=", "yield", "ix", ",", "fields", "if", "flag", "@i...
yields each column to caller method if yield returns true, collects index of row into array and returns the array @returns array of indices which can be empty Value yielded can be fixnum or date etc
[ "yields", "each", "column", "to", "caller", "method", "if", "yield", "returns", "true", "collects", "index", "of", "row", "into", "array", "and", "returns", "the", "array" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L1013-L1031
train
mare-imbrium/canis
lib/canis/core/widgets/table.rb
Canis.Table.render_all
def render_all if @indices && @indices.count > 0 @indices.each_with_index do |ix, jx| render @pad, jx, @list[ix] end else @list.each_with_index { |line, ix| # FFI::NCurses.mvwaddstr(@pad,ix, 0, @list[ix].to_s) render @pad, ix, line } end ...
ruby
def render_all if @indices && @indices.count > 0 @indices.each_with_index do |ix, jx| render @pad, jx, @list[ix] end else @list.each_with_index { |line, ix| # FFI::NCurses.mvwaddstr(@pad,ix, 0, @list[ix].to_s) render @pad, ix, line } end ...
[ "def", "render_all", "if", "@indices", "&&", "@indices", ".", "count", ">", "0", "@indices", ".", "each_with_index", "do", "|", "ix", ",", "jx", "|", "render", "@pad", ",", "jx", ",", "@list", "[", "ix", "]", "end", "else", "@list", ".", "each_with_ind...
calls the renderer for all rows of data giving them pad, lineno, and line data
[ "calls", "the", "renderer", "for", "all", "rows", "of", "data", "giving", "them", "pad", "lineno", "and", "line", "data" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/table.rb#L1061-L1072
train
osiro/enceladus
lib/enceladus/configuration/image.rb
Enceladus::Configuration.Image.reset!
def reset! self.base_url = nil self.secure_base_url = nil self.backdrop_sizes = [] self.logo_sizes = [] self.logo_sizes = [] self.poster_sizes = [] self.profile_sizes = [] self.still_sizes = [] self.include_image_language = "en" self end
ruby
def reset! self.base_url = nil self.secure_base_url = nil self.backdrop_sizes = [] self.logo_sizes = [] self.logo_sizes = [] self.poster_sizes = [] self.profile_sizes = [] self.still_sizes = [] self.include_image_language = "en" self end
[ "def", "reset!", "self", ".", "base_url", "=", "nil", "self", ".", "secure_base_url", "=", "nil", "self", ".", "backdrop_sizes", "=", "[", "]", "self", ".", "logo_sizes", "=", "[", "]", "self", ".", "logo_sizes", "=", "[", "]", "self", ".", "poster_siz...
Reset or nullify all image configurations.
[ "Reset", "or", "nullify", "all", "image", "configurations", "." ]
874a8f0ad55bf3528e3e193b298967f0997d66b3
https://github.com/osiro/enceladus/blob/874a8f0ad55bf3528e3e193b298967f0997d66b3/lib/enceladus/configuration/image.rb#L32-L43
train
osiro/enceladus
lib/enceladus/configuration/image.rb
Enceladus::Configuration.Image.valid?
def valid? !base_url.nil? && !secure_base_url.nil? && backdrop_sizes.any? && logo_sizes.any? && poster_sizes.any? && profile_sizes.any? && still_sizes.any? end
ruby
def valid? !base_url.nil? && !secure_base_url.nil? && backdrop_sizes.any? && logo_sizes.any? && poster_sizes.any? && profile_sizes.any? && still_sizes.any? end
[ "def", "valid?", "!", "base_url", ".", "nil?", "&&", "!", "secure_base_url", ".", "nil?", "&&", "backdrop_sizes", ".", "any?", "&&", "logo_sizes", ".", "any?", "&&", "poster_sizes", ".", "any?", "&&", "profile_sizes", ".", "any?", "&&", "still_sizes", ".", ...
Returns a boolean indicating whether the Image configurations are valid or not.
[ "Returns", "a", "boolean", "indicating", "whether", "the", "Image", "configurations", "are", "valid", "or", "not", "." ]
874a8f0ad55bf3528e3e193b298967f0997d66b3
https://github.com/osiro/enceladus/blob/874a8f0ad55bf3528e3e193b298967f0997d66b3/lib/enceladus/configuration/image.rb#L71-L79
train
RestlessThinker/danger-pronto
lib/danger_pronto/plugin.rb
Danger.DangerPronto.lint
def lint(commit = nil) files = pronto(commit) return if files.empty? markdown offenses_message(files) end
ruby
def lint(commit = nil) files = pronto(commit) return if files.empty? markdown offenses_message(files) end
[ "def", "lint", "(", "commit", "=", "nil", ")", "files", "=", "pronto", "(", "commit", ")", "return", "if", "files", ".", "empty?", "markdown", "offenses_message", "(", "files", ")", "end" ]
Runs files through Pronto. Generates a `markdown` list of warnings.
[ "Runs", "files", "through", "Pronto", ".", "Generates", "a", "markdown", "list", "of", "warnings", "." ]
452f1565ea75f91f358c6ceed1ad06a3b794a7d4
https://github.com/RestlessThinker/danger-pronto/blob/452f1565ea75f91f358c6ceed1ad06a3b794a7d4/lib/danger_pronto/plugin.rb#L17-L22
train
CocoaPods/Cork
lib/cork/board.rb
Cork.Board.path
def path(pathname, relative_to = Pathname.pwd) if pathname path = Pathname(pathname).relative_path_from(relative_to) "`#{path}`" else '' end end
ruby
def path(pathname, relative_to = Pathname.pwd) if pathname path = Pathname(pathname).relative_path_from(relative_to) "`#{path}`" else '' end end
[ "def", "path", "(", "pathname", ",", "relative_to", "=", "Pathname", ".", "pwd", ")", "if", "pathname", "path", "=", "Pathname", "(", "pathname", ")", ".", "relative_path_from", "(", "relative_to", ")", "\"`#{path}`\"", "else", "''", "end", "end" ]
The returned path is quoted. If the argument is nil it returns an empty string. @param [#to_str,Nil] pathname The path to return. @param [Pathname] relative_to
[ "The", "returned", "path", "is", "quoted", ".", "If", "the", "argument", "is", "nil", "it", "returns", "an", "empty", "string", "." ]
4ce915065174ac7985e9b229072d4ac304d00839
https://github.com/CocoaPods/Cork/blob/4ce915065174ac7985e9b229072d4ac304d00839/lib/cork/board.rb#L117-L124
train
CocoaPods/Cork
lib/cork/board.rb
Cork.Board.labeled
def labeled(label, value, justification = 12) if value title = "- #{label}:" if value.is_a?(Enumerable) lines = [wrap_string(title, indentation_level)] lines += value.map do |v| wrap_string("- #{v}", indentation_level + 2) end puts lines.join("\n...
ruby
def labeled(label, value, justification = 12) if value title = "- #{label}:" if value.is_a?(Enumerable) lines = [wrap_string(title, indentation_level)] lines += value.map do |v| wrap_string("- #{v}", indentation_level + 2) end puts lines.join("\n...
[ "def", "labeled", "(", "label", ",", "value", ",", "justification", "=", "12", ")", "if", "value", "title", "=", "\"- #{label}:\"", "if", "value", ".", "is_a?", "(", "Enumerable", ")", "lines", "=", "[", "wrap_string", "(", "title", ",", "indentation_level...
Prints a message with a label. @param [String] label The label to print. @param [#to_s] value The value to print. @param [FixNum] justification The justification of the label.
[ "Prints", "a", "message", "with", "a", "label", "." ]
4ce915065174ac7985e9b229072d4ac304d00839
https://github.com/CocoaPods/Cork/blob/4ce915065174ac7985e9b229072d4ac304d00839/lib/cork/board.rb#L137-L151
train
CocoaPods/Cork
lib/cork/board.rb
Cork.Board.info
def info(message) indentation = verbose? ? @indentation_level : 0 indented = wrap_string(message, indentation) puts(indented) if block_given? @indentation_level += 2 @treat_titles_as_messages = true yield @treat_titles_as_messages = false @indentation_lev...
ruby
def info(message) indentation = verbose? ? @indentation_level : 0 indented = wrap_string(message, indentation) puts(indented) if block_given? @indentation_level += 2 @treat_titles_as_messages = true yield @treat_titles_as_messages = false @indentation_lev...
[ "def", "info", "(", "message", ")", "indentation", "=", "verbose?", "?", "@indentation_level", ":", "0", "indented", "=", "wrap_string", "(", "message", ",", "indentation", ")", "puts", "(", "indented", ")", "if", "block_given?", "@indentation_level", "+=", "2...
Prints an info to the user. The info is always displayed. It respects the current indentation level only in verbose mode. Any title printed in the optional block is treated as a message. @param [String] message The message to print.
[ "Prints", "an", "info", "to", "the", "user", ".", "The", "info", "is", "always", "displayed", ".", "It", "respects", "the", "current", "indentation", "level", "only", "in", "verbose", "mode", "." ]
4ce915065174ac7985e9b229072d4ac304d00839
https://github.com/CocoaPods/Cork/blob/4ce915065174ac7985e9b229072d4ac304d00839/lib/cork/board.rb#L198-L210
train
CocoaPods/Cork
lib/cork/board.rb
Cork.Board.title
def title(title, verbose_prefix = '', relative_indentation = 2) if @treat_titles_as_messages message(title, verbose_prefix) else puts_title(title, verbose_prefix) end if block_given? @indentation_level += relative_indentation @title_level += 1 yield ...
ruby
def title(title, verbose_prefix = '', relative_indentation = 2) if @treat_titles_as_messages message(title, verbose_prefix) else puts_title(title, verbose_prefix) end if block_given? @indentation_level += relative_indentation @title_level += 1 yield ...
[ "def", "title", "(", "title", ",", "verbose_prefix", "=", "''", ",", "relative_indentation", "=", "2", ")", "if", "@treat_titles_as_messages", "message", "(", "title", ",", "verbose_prefix", ")", "else", "puts_title", "(", "title", ",", "verbose_prefix", ")", ...
A title opposed to a section is always visible @param [String] title The title to print @param [String] verbose_prefix See #message @param [FixNum] relative_indentation The indentation level relative to the current, when the message is printed.
[ "A", "title", "opposed", "to", "a", "section", "is", "always", "visible" ]
4ce915065174ac7985e9b229072d4ac304d00839
https://github.com/CocoaPods/Cork/blob/4ce915065174ac7985e9b229072d4ac304d00839/lib/cork/board.rb#L224-L238
train
CocoaPods/Cork
lib/cork/board.rb
Cork.Board.message
def message(message, verbose_prefix = '', relative_indentation = 2) message = verbose_prefix + message if verbose? puts_indented message if verbose? @indentation_level += relative_indentation yield if block_given? @indentation_level -= relative_indentation end
ruby
def message(message, verbose_prefix = '', relative_indentation = 2) message = verbose_prefix + message if verbose? puts_indented message if verbose? @indentation_level += relative_indentation yield if block_given? @indentation_level -= relative_indentation end
[ "def", "message", "(", "message", ",", "verbose_prefix", "=", "''", ",", "relative_indentation", "=", "2", ")", "message", "=", "verbose_prefix", "+", "message", "if", "verbose?", "puts_indented", "message", "if", "verbose?", "@indentation_level", "+=", "relative_...
Prints a verbose message taking an optional verbose prefix and a relative indentation valid for the UI action in the passed block. @todo Clean interface.
[ "Prints", "a", "verbose", "message", "taking", "an", "optional", "verbose", "prefix", "and", "a", "relative", "indentation", "valid", "for", "the", "UI", "action", "in", "the", "passed", "block", "." ]
4ce915065174ac7985e9b229072d4ac304d00839
https://github.com/CocoaPods/Cork/blob/4ce915065174ac7985e9b229072d4ac304d00839/lib/cork/board.rb#L290-L297
train
mare-imbrium/canis
lib/canis/core/widgets/rcontainer.rb
Canis.Container.correct_component
def correct_component c raise "Form is still not set in Container" unless @form attach_form(c) unless c.form @last_row ||= @row + 1 inset = 2 # 2011-10-20 current default behaviour is to stack if @positioning == :stack c.row = @last_row c.col = @col + inset #...
ruby
def correct_component c raise "Form is still not set in Container" unless @form attach_form(c) unless c.form @last_row ||= @row + 1 inset = 2 # 2011-10-20 current default behaviour is to stack if @positioning == :stack c.row = @last_row c.col = @col + inset #...
[ "def", "correct_component", "c", "raise", "\"Form is still not set in Container\"", "unless", "@form", "attach_form", "(", "c", ")", "unless", "c", ".", "form", "@last_row", "||=", "@row", "+", "1", "inset", "=", "2", "if", "@positioning", "==", ":stack", "c", ...
what of by_name correct coordinates of comp esp if App has stacked them after this container It is best to use the simple stack feature. The rest could change at any time and is quite arbitrary. Some folks may set absolute locations if container is directly on a form, others may set relative locations if it is i...
[ "what", "of", "by_name", "correct", "coordinates", "of", "comp", "esp", "if", "App", "has", "stacked", "them", "after", "this", "container", "It", "is", "best", "to", "use", "the", "simple", "stack", "feature", ".", "The", "rest", "could", "change", "at", ...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rcontainer.rb#L125-L162
train
awilliams/RTanque
lib/rtanque/runner.rb
RTanque.Runner.start
def start(gui = true) if gui require 'rtanque/gui' window = RTanque::Gui::Window.new(self.match) trap(:INT) { window.close } window.show else trap(:INT) { self.match.stop } self.match.start end end
ruby
def start(gui = true) if gui require 'rtanque/gui' window = RTanque::Gui::Window.new(self.match) trap(:INT) { window.close } window.show else trap(:INT) { self.match.stop } self.match.start end end
[ "def", "start", "(", "gui", "=", "true", ")", "if", "gui", "require", "'rtanque/gui'", "window", "=", "RTanque", "::", "Gui", "::", "Window", ".", "new", "(", "self", ".", "match", ")", "trap", "(", ":INT", ")", "{", "window", ".", "close", "}", "w...
Starts the match @param [Boolean] gui if false, runs headless match
[ "Starts", "the", "match" ]
a184cfbbbc259a88b40c900f3f90d8dcbcfe348e
https://github.com/awilliams/RTanque/blob/a184cfbbbc259a88b40c900f3f90d8dcbcfe348e/lib/rtanque/runner.rb#L30-L40
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App.loop
def loop &block @form.repaint @window.wrefresh Ncurses::Panel.update_panels @break_key = ?\C-q.getbyte(0) # added this extra loop since from some places we exit using throw :close # amd that was in a much higher place, and was getting us right out, with # no chance of user canc...
ruby
def loop &block @form.repaint @window.wrefresh Ncurses::Panel.update_panels @break_key = ?\C-q.getbyte(0) # added this extra loop since from some places we exit using throw :close # amd that was in a much higher place, and was getting us right out, with # no chance of user canc...
[ "def", "loop", "&", "block", "@form", ".", "repaint", "@window", ".", "wrefresh", "Ncurses", "::", "Panel", ".", "update_panels", "@break_key", "=", "?\\C-q", ".", "getbyte", "(", "0", ")", "while", "true", "catch", ":close", "do", "while", "(", "(", "ch...
This method is called by run, and thus in most cases this is what is used. +run+ calls this without a block not sure, but user shuld be able to trap keystrokes if he wants but do i still call handle_key if he does, or give him total control. But loop is already called by framework
[ "This", "method", "is", "called", "by", "run", "and", "thus", "in", "most", "cases", "this", "is", "what", "is", "used", ".", "+", "run", "+", "calls", "this", "without", "a", "block", "not", "sure", "but", "user", "shuld", "be", "able", "to", "trap"...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L129-L181
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App.safe_loop
def safe_loop &block begin loop &block rescue => ex $log.debug( "APP.rb rescue reached ") $log.debug( ex) if ex $log.debug(ex.backtrace.join("\n")) if ex ensure close # putting it here allows it to be printed on screen, otherwise it was not showing at al...
ruby
def safe_loop &block begin loop &block rescue => ex $log.debug( "APP.rb rescue reached ") $log.debug( ex) if ex $log.debug(ex.backtrace.join("\n")) if ex ensure close # putting it here allows it to be printed on screen, otherwise it was not showing at al...
[ "def", "safe_loop", "&", "block", "begin", "loop", "&", "block", "rescue", "=>", "ex", "$log", ".", "debug", "(", "\"APP.rb rescue reached \"", ")", "$log", ".", "debug", "(", "ex", ")", "if", "ex", "$log", ".", "debug", "(", "ex", ".", "backtrace", "....
if calling loop separately better to call this, since it will shut off ncurses and print error on screen. UNUSED
[ "if", "calling", "loop", "separately", "better", "to", "call", "this", "since", "it", "will", "shut", "off", "ncurses", "and", "print", "error", "on", "screen", ".", "UNUSED" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L185-L202
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App.field_help_text
def field_help_text f = @form.get_current_field if f.respond_to?('help_text') h = f.help_text h = "No help text defined for this field.\nTry F1, or press '?' for key-bindings." unless h textdialog "#{h}", :title => "Widget Help Text" else alert "Could not get field #{f}...
ruby
def field_help_text f = @form.get_current_field if f.respond_to?('help_text') h = f.help_text h = "No help text defined for this field.\nTry F1, or press '?' for key-bindings." unless h textdialog "#{h}", :title => "Widget Help Text" else alert "Could not get field #{f}...
[ "def", "field_help_text", "f", "=", "@form", ".", "get_current_field", "if", "f", ".", "respond_to?", "(", "'help_text'", ")", "h", "=", "f", ".", "help_text", "h", "=", "\"No help text defined for this field.\\nTry F1, or press '?' for key-bindings.\"", "unless", "h", ...
displays help_text associated with field. 2011-10-15
[ "displays", "help_text", "associated", "with", "field", ".", "2011", "-", "10", "-", "15" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L301-L310
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App.longest_in_list
def longest_in_list list #:nodoc: longest = list.inject(0) do |memo,word| memo >= word.length ? memo : word.length end longest end
ruby
def longest_in_list list #:nodoc: longest = list.inject(0) do |memo,word| memo >= word.length ? memo : word.length end longest end
[ "def", "longest_in_list", "list", "longest", "=", "list", ".", "inject", "(", "0", ")", "do", "|", "memo", ",", "word", "|", "memo", ">=", "word", ".", "length", "?", "memo", ":", "word", ".", "length", "end", "longest", "end" ]
returns length of longest
[ "returns", "length", "of", "longest" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L423-L428
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App._resolve_command
def _resolve_command opts, cmd return cmd if opts.include? cmd matches = opts.grep Regexp.new("^#{cmd}") end
ruby
def _resolve_command opts, cmd return cmd if opts.include? cmd matches = opts.grep Regexp.new("^#{cmd}") end
[ "def", "_resolve_command", "opts", ",", "cmd", "return", "cmd", "if", "opts", ".", "include?", "cmd", "matches", "=", "opts", ".", "grep", "Regexp", ".", "new", "(", "\"^#{cmd}\"", ")", "end" ]
if partial command entered then returns matches
[ "if", "partial", "command", "entered", "then", "returns", "matches" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L440-L443
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App.run
def run &block begin # check if user has passed window coord in config, else root window @window = Canis::Window.root_window awin = @window catch(:close) do @form = Form.new @window #@form.bind_key(KEY_F1, 'help'){ display_app_help } # NOT REQUIRED NOW 2012-01-...
ruby
def run &block begin # check if user has passed window coord in config, else root window @window = Canis::Window.root_window awin = @window catch(:close) do @form = Form.new @window #@form.bind_key(KEY_F1, 'help'){ display_app_help } # NOT REQUIRED NOW 2012-01-...
[ "def", "run", "&", "block", "begin", "@window", "=", "Canis", "::", "Window", ".", "root_window", "awin", "=", "@window", "catch", "(", ":close", ")", "do", "@form", "=", "Form", ".", "new", "@window", "@form", ".", "bind_key", "(", "[", "?q", ",", "...
This is the method that is called by all apps usually that define an App block
[ "This", "is", "the", "method", "that", "is", "called", "by", "all", "apps", "usually", "that", "define", "an", "App", "block" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L446-L488
train
mare-imbrium/canis
lib/canis/core/util/app.rb
Canis.App._process_args
def _process_args args, config, block_event, events #:nodoc: raise "FIXME seems uncalled _process_args, remove it this does not come up within a month 2014-08-19 " args.each do |arg| case arg when Array # please don't use this, keep it simple and use hash NOTE # we can ...
ruby
def _process_args args, config, block_event, events #:nodoc: raise "FIXME seems uncalled _process_args, remove it this does not come up within a month 2014-08-19 " args.each do |arg| case arg when Array # please don't use this, keep it simple and use hash NOTE # we can ...
[ "def", "_process_args", "args", ",", "config", ",", "block_event", ",", "events", "raise", "\"FIXME seems uncalled _process_args, remove it this does not come up within a month 2014-08-19 \"", "args", ".", "each", "do", "|", "arg", "|", "case", "arg", "when", "Array", "ro...
process args, all widgets should call this
[ "process", "args", "all", "widgets", "should", "call", "this" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/app.rb#L553-L578
train
mare-imbrium/canis
lib/canis/core/widgets/listfooter.rb
Canis.ListFooter.print
def print comp config = @config row = comp.row + comp.height - 1 col = comp.col + 2 len = comp.width - col g = comp.form.window # we check just in case user nullifies it deliberately, since he may have changed config values @color_pair ||= get_color($datacolor, config[:color],...
ruby
def print comp config = @config row = comp.row + comp.height - 1 col = comp.col + 2 len = comp.width - col g = comp.form.window # we check just in case user nullifies it deliberately, since he may have changed config values @color_pair ||= get_color($datacolor, config[:color],...
[ "def", "print", "comp", "config", "=", "@config", "row", "=", "comp", ".", "row", "+", "comp", ".", "height", "-", "1", "col", "=", "comp", ".", "col", "+", "2", "len", "=", "comp", ".", "width", "-", "col", "g", "=", "comp", ".", "form", ".", ...
supply a default print function. The user program need not call this. It may be overridden The idea of passing a component at this stage is that one footer can be created for several tables or text components, each will pass +self+ when calling print. @param comp : the calling textpad component (usually passed as +s...
[ "supply", "a", "default", "print", "function", ".", "The", "user", "program", "need", "not", "call", "this", ".", "It", "may", "be", "overridden", "The", "idea", "of", "passing", "a", "component", "at", "this", "stage", "is", "that", "one", "footer", "ca...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/listfooter.rb#L49-L82
train
mare-imbrium/canis
lib/canis/core/system/window.rb
Canis.Window.set_layout
def set_layout(layout) case layout when Array $log.error "NIL in window constructor" if layout.include? nil raise ArgumentError, "Nil in window constructor" if layout.include? nil # NOTE this is just setting, and not replacing zero with max values @height, @width, @top, @lef...
ruby
def set_layout(layout) case layout when Array $log.error "NIL in window constructor" if layout.include? nil raise ArgumentError, "Nil in window constructor" if layout.include? nil # NOTE this is just setting, and not replacing zero with max values @height, @width, @top, @lef...
[ "def", "set_layout", "(", "layout", ")", "case", "layout", "when", "Array", "$log", ".", "error", "\"NIL in window constructor\"", "if", "layout", ".", "include?", "nil", "raise", "ArgumentError", ",", "\"Nil in window constructor\"", "if", "layout", ".", "include?"...
Creating variables case of array, we still create the hash @param array or hash containing h w t and l
[ "Creating", "variables", "case", "of", "array", "we", "still", "create", "the", "hash" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/system/window.rb#L229-L246
train
mare-imbrium/canis
lib/canis/core/system/window.rb
Canis.Window.destroy
def destroy # typically the ensure block should have this #$log.debug "win destroy start" $global_windows.delete self Ncurses::Panel.del_panel(@panel.pointer) if @panel delwin() if @window Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 ...
ruby
def destroy # typically the ensure block should have this #$log.debug "win destroy start" $global_windows.delete self Ncurses::Panel.del_panel(@panel.pointer) if @panel delwin() if @window Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 ...
[ "def", "destroy", "$global_windows", ".", "delete", "self", "Ncurses", "::", "Panel", ".", "del_panel", "(", "@panel", ".", "pointer", ")", "if", "@panel", "delwin", "(", ")", "if", "@window", "Ncurses", "::", "Panel", ".", "update_panels", "@pads", ".", "...
destroy window, panel and any pads that were requested
[ "destroy", "window", "panel", "and", "any", "pads", "that", "were", "requested" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/system/window.rb#L429-L450
train
mare-imbrium/canis
lib/canis/core/system/window.rb
Canis.Window.get_pad
def get_pad content_rows, content_cols pad = FFI::NCurses.newpad(content_rows, content_cols) @pads ||= [] @pads << pad ## added 2013-03-05 - 19:21 without next line how was pad being returned return pad end
ruby
def get_pad content_rows, content_cols pad = FFI::NCurses.newpad(content_rows, content_cols) @pads ||= [] @pads << pad ## added 2013-03-05 - 19:21 without next line how was pad being returned return pad end
[ "def", "get_pad", "content_rows", ",", "content_cols", "pad", "=", "FFI", "::", "NCurses", ".", "newpad", "(", "content_rows", ",", "content_cols", ")", "@pads", "||=", "[", "]", "@pads", "<<", "pad", "return", "pad", "end" ]
Widgets can get window to create a pad for them. This way when the window is destroyed, it will delete all the pads. A widget wold not be able to do this. The destroy method of the widget will be called.
[ "Widgets", "can", "get", "window", "to", "create", "a", "pad", "for", "them", ".", "This", "way", "when", "the", "window", "is", "destroyed", "it", "will", "delete", "all", "the", "pads", ".", "A", "widget", "wold", "not", "be", "able", "to", "do", "...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/system/window.rb#L456-L462
train
mare-imbrium/canis
lib/canis/core/system/window.rb
Canis.Window.print_border_mb
def print_border_mb row, col, height, width, color, attr # the next is for xterm-256 att = get_attrib attr len = width len = Ncurses.COLS-0 if len == 0 # print a bar across the screen #attron(Ncurses.COLOR_PAIR(color) | att) # this works for newmessagebox but not for old one....
ruby
def print_border_mb row, col, height, width, color, attr # the next is for xterm-256 att = get_attrib attr len = width len = Ncurses.COLS-0 if len == 0 # print a bar across the screen #attron(Ncurses.COLOR_PAIR(color) | att) # this works for newmessagebox but not for old one....
[ "def", "print_border_mb", "row", ",", "col", ",", "height", ",", "width", ",", "color", ",", "attr", "att", "=", "get_attrib", "attr", "len", "=", "width", "len", "=", "Ncurses", ".", "COLS", "-", "0", "if", "len", "==", "0", "space_char", "=", "\" \...
prints the border for message boxes NOTE : FOR MESSAGEBOXES ONLY !!!! Then why not move to messagebox FIXME
[ "prints", "the", "border", "for", "message", "boxes" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/system/window.rb#L583-L610
train
mare-imbrium/canis
lib/canis/core/system/window.rb
Canis.Window.print_border
def print_border row, col, height, width, color, att=Ncurses::A_NORMAL raise "height needs to be supplied." if height.nil? raise "width needs to be supplied." if width.nil? att ||= Ncurses::A_NORMAL #$log.debug " inside window print_border r #{row} c #{col} h #{height} w #{width} " # 200...
ruby
def print_border row, col, height, width, color, att=Ncurses::A_NORMAL raise "height needs to be supplied." if height.nil? raise "width needs to be supplied." if width.nil? att ||= Ncurses::A_NORMAL #$log.debug " inside window print_border r #{row} c #{col} h #{height} w #{width} " # 200...
[ "def", "print_border", "row", ",", "col", ",", "height", ",", "width", ",", "color", ",", "att", "=", "Ncurses", "::", "A_NORMAL", "raise", "\"height needs to be supplied.\"", "if", "height", ".", "nil?", "raise", "\"width needs to be supplied.\"", "if", "width", ...
prints a border around a widget, CLEARING the area. If calling with a pad, you would typically use 0,0, h-1, w-1. FIXME can this be moved to module Bordertitle ?
[ "prints", "a", "border", "around", "a", "widget", "CLEARING", "the", "area", ".", "If", "calling", "with", "a", "pad", "you", "would", "typically", "use", "0", "0", "h", "-", "1", "w", "-", "1", ".", "FIXME", "can", "this", "be", "moved", "to", "mo...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/system/window.rb#L616-L632
train
mare-imbrium/canis
lib/canis/core/system/window.rb
Canis.Window.print_border_only
def print_border_only row, col, height, width, color, att=Ncurses::A_NORMAL if att.nil? att = Ncurses::A_NORMAL else att = get_attrib att end wattron(Ncurses.COLOR_PAIR(color) | att) mvwaddch row, col, Ncurses::ACS_ULCORNER mvwhline( row, col+1, Ncurses::ACS_HLINE, ...
ruby
def print_border_only row, col, height, width, color, att=Ncurses::A_NORMAL if att.nil? att = Ncurses::A_NORMAL else att = get_attrib att end wattron(Ncurses.COLOR_PAIR(color) | att) mvwaddch row, col, Ncurses::ACS_ULCORNER mvwhline( row, col+1, Ncurses::ACS_HLINE, ...
[ "def", "print_border_only", "row", ",", "col", ",", "height", ",", "width", ",", "color", ",", "att", "=", "Ncurses", "::", "A_NORMAL", "if", "att", ".", "nil?", "att", "=", "Ncurses", "::", "A_NORMAL", "else", "att", "=", "get_attrib", "att", "end", "...
print just the border, no cleanup + Earlier, we would clean up. Now in some cases, i'd like + to print border over what's been done. XXX this reduces 1 from width but not height !!! FIXME FIXME can this be moved to module Bordertitle ?
[ "print", "just", "the", "border", "no", "cleanup", "+", "Earlier", "we", "would", "clean", "up", ".", "Now", "in", "some", "cases", "i", "d", "like", "+", "to", "print", "border", "over", "what", "s", "been", "done", ".", "XXX", "this", "reduces", "1...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/system/window.rb#L640-L657
train
mare-imbrium/canis
lib/canis/core/widgets/rtabbedpane.rb
Canis.TabbedPane.goto_last_item
def goto_last_item bc = @buttons.count f = nil @components[bc..-1].each { |c| if c.focusable f = c end } if f leave_current_component @current_component = f set_form_row end end
ruby
def goto_last_item bc = @buttons.count f = nil @components[bc..-1].each { |c| if c.focusable f = c end } if f leave_current_component @current_component = f set_form_row end end
[ "def", "goto_last_item", "bc", "=", "@buttons", ".", "count", "f", "=", "nil", "@components", "[", "bc", "..", "-", "1", "]", ".", "each", "{", "|", "c", "|", "if", "c", ".", "focusable", "f", "=", "c", "end", "}", "if", "f", "leave_current_compone...
takes focus to last item
[ "takes", "focus", "to", "last", "item" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rtabbedpane.rb#L219-L232
train
mare-imbrium/canis
lib/canis/core/widgets/rtabbedpane.rb
Canis.TabbedPane.goto_next_component
def goto_next_component if @current_component != nil leave_current_component if on_last_component? @_entered = false return :UNHANDLED end @current_index = @components.index(@current_component) index = @current_index + 1 index.upto(@components.l...
ruby
def goto_next_component if @current_component != nil leave_current_component if on_last_component? @_entered = false return :UNHANDLED end @current_index = @components.index(@current_component) index = @current_index + 1 index.upto(@components.l...
[ "def", "goto_next_component", "if", "@current_component", "!=", "nil", "leave_current_component", "if", "on_last_component?", "@_entered", "=", "false", "return", ":UNHANDLED", "end", "@current_index", "=", "@components", ".", "index", "(", "@current_component", ")", "i...
take focus to the next component or item Called from DOWN, RIGHT or Tab
[ "take", "focus", "to", "the", "next", "component", "or", "item", "Called", "from", "DOWN", "RIGHT", "or", "Tab" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rtabbedpane.rb#L235-L255
train
mare-imbrium/canis
lib/canis/core/widgets/rtabbedpane.rb
Canis.TabbedPane.goto_prev_component
def goto_prev_component if @current_component != nil leave_current_component if on_first_component? @_entered = false return :UNHANDLED end @current_index = @components.index(@current_component) index = @current_index -= 1 index.downto(0) do |i|...
ruby
def goto_prev_component if @current_component != nil leave_current_component if on_first_component? @_entered = false return :UNHANDLED end @current_index = @components.index(@current_component) index = @current_index -= 1 index.downto(0) do |i|...
[ "def", "goto_prev_component", "if", "@current_component", "!=", "nil", "leave_current_component", "if", "on_first_component?", "@_entered", "=", "false", "return", ":UNHANDLED", "end", "@current_index", "=", "@components", ".", "index", "(", "@current_component", ")", "...
take focus to prev component or item Called from LEFT, UP or Back Tab
[ "take", "focus", "to", "prev", "component", "or", "item", "Called", "from", "LEFT", "UP", "or", "Back", "Tab" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rtabbedpane.rb#L258-L277
train
mare-imbrium/canis
lib/canis/core/widgets/rtabbedpane.rb
Canis.TabbedPane.make_buttons
def make_buttons names @action_buttons = [] $log.debug "XXX: came to NTP make buttons FORM= #{@form.name} names #{names} " total = names.inject(0) {|total, item| total + item.length + 4} bcol = center_column total # this craps out when height is zero brow = @row + @height-2 b...
ruby
def make_buttons names @action_buttons = [] $log.debug "XXX: came to NTP make buttons FORM= #{@form.name} names #{names} " total = names.inject(0) {|total, item| total + item.length + 4} bcol = center_column total # this craps out when height is zero brow = @row + @height-2 b...
[ "def", "make_buttons", "names", "@action_buttons", "=", "[", "]", "$log", ".", "debug", "\"XXX: came to NTP make buttons FORM= #{@form.name} names #{names} \"", "total", "=", "names", ".", "inject", "(", "0", ")", "{", "|", "total", ",", "item", "|", "total", "+"...
actually creates the action buttons
[ "actually", "creates", "the", "action", "buttons" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rtabbedpane.rb#L492-L531
train
mare-imbrium/canis
lib/canis/core/widgets/rcombo.rb
Canis.ComboBox.handle_key
def handle_key(ch) @current_index ||= 0 # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit if !@editable if ch == KEY_LEFT or ch == KEY_RIGHT return :UNHANDLED end end case @arrow_key_policy when :ignore if ch == KEY_D...
ruby
def handle_key(ch) @current_index ||= 0 # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit if !@editable if ch == KEY_LEFT or ch == KEY_RIGHT return :UNHANDLED end end case @arrow_key_policy when :ignore if ch == KEY_D...
[ "def", "handle_key", "(", "ch", ")", "@current_index", "||=", "0", "if", "!", "@editable", "if", "ch", "==", "KEY_LEFT", "or", "ch", "==", "KEY_RIGHT", "return", ":UNHANDLED", "end", "end", "case", "@arrow_key_policy", "when", ":ignore", "if", "ch", "==", ...
combo edit box key handling removed UP and DOWN and bound it, so it can be unbound
[ "combo", "edit", "box", "key", "handling", "removed", "UP", "and", "DOWN", "and", "bound", "it", "so", "it", "can", "be", "unbound" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rcombo.rb#L80-L109
train
mare-imbrium/canis
lib/canis/core/widgets/rcombo.rb
Canis.ComboBox.putc
def putc c if c >= 0 and c <= 127 ret = putch c.chr if ret == 0 addcol 1 if @editable set_modified end end return -1 # always ??? XXX end
ruby
def putc c if c >= 0 and c <= 127 ret = putch c.chr if ret == 0 addcol 1 if @editable set_modified end end return -1 # always ??? XXX end
[ "def", "putc", "c", "if", "c", ">=", "0", "and", "c", "<=", "127", "ret", "=", "putch", "c", ".", "chr", "if", "ret", "==", "0", "addcol", "1", "if", "@editable", "set_modified", "end", "end", "return", "-", "1", "end" ]
Field putc advances cursor when it gives a char so we override this
[ "Field", "putc", "advances", "cursor", "when", "it", "gives", "a", "char", "so", "we", "override", "this" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rcombo.rb#L140-L149
train
mare-imbrium/canis
lib/canis/core/widgets/rcombo.rb
Canis.ComboBox.putch
def putch char @current_index ||= 0 if @editable raise "how is it editable here in combo" super return 0 else match = next_match(char) text match unless match.nil? fire_handler :ENTER_ROW, self end @modified = true fire_handler :CHANGE...
ruby
def putch char @current_index ||= 0 if @editable raise "how is it editable here in combo" super return 0 else match = next_match(char) text match unless match.nil? fire_handler :ENTER_ROW, self end @modified = true fire_handler :CHANGE...
[ "def", "putch", "char", "@current_index", "||=", "0", "if", "@editable", "raise", "\"how is it editable here in combo\"", "super", "return", "0", "else", "match", "=", "next_match", "(", "char", ")", "text", "match", "unless", "match", ".", "nil?", "fire_handler",...
field does not give char to non-editable fields so we override
[ "field", "does", "not", "give", "char", "to", "non", "-", "editable", "fields", "so", "we", "override" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rcombo.rb#L152-L166
train
mare-imbrium/canis
lib/canis/core/widgets/rcombo.rb
Canis.ComboBox.next_match
def next_match char start = @current_index start.upto(@list.length-1) do |ix| if @list[ix][0,1].casecmp(char) == 0 return @list[ix] unless @list[ix] == @buffer end @current_index += 1 end ## could not find, start from zero @current_index = 0 start = ...
ruby
def next_match char start = @current_index start.upto(@list.length-1) do |ix| if @list[ix][0,1].casecmp(char) == 0 return @list[ix] unless @list[ix] == @buffer end @current_index += 1 end ## could not find, start from zero @current_index = 0 start = ...
[ "def", "next_match", "char", "start", "=", "@current_index", "start", ".", "upto", "(", "@list", ".", "length", "-", "1", ")", "do", "|", "ix", "|", "if", "@list", "[", "ix", "]", "[", "0", ",", "1", "]", ".", "casecmp", "(", "char", ")", "==", ...
the sets the next match in the edit field
[ "the", "sets", "the", "next", "match", "in", "the", "edit", "field" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rcombo.rb#L169-L188
train
mare-imbrium/canis
examples/common/devel.rb
Canis.Devel.choose_file_and_view
def choose_file_and_view glob=nil, startdir="." glob ||= "**/*.rb" str = choose_file glob, :title => "Select a file", :directory => startdir, :help_text => "Enter pattern, use UP DOWN to traverse, Backspace to delete, ENTER to select. Esc-Esc to quit" if str and str != "" code_browse str...
ruby
def choose_file_and_view glob=nil, startdir="." glob ||= "**/*.rb" str = choose_file glob, :title => "Select a file", :directory => startdir, :help_text => "Enter pattern, use UP DOWN to traverse, Backspace to delete, ENTER to select. Esc-Esc to quit" if str and str != "" code_browse str...
[ "def", "choose_file_and_view", "glob", "=", "nil", ",", "startdir", "=", "\".\"", "glob", "||=", "\"**/*.rb\"", "str", "=", "choose_file", "glob", ",", ":title", "=>", "\"Select a file\"", ",", ":directory", "=>", "startdir", ",", ":help_text", "=>", "\"Enter pa...
this should be available to view also.
[ "this", "should", "be", "available", "to", "view", "also", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/examples/common/devel.rb#L72-L80
train
mare-imbrium/canis
examples/common/devel.rb
Canis.Devel.view_properties_as_tree
def view_properties_as_tree field=@form.get_current_field alert "Nil field" unless field return unless field text = [] tree = {} #iv = field.instance_variables.map do |v| v.to_s; end field.instance_variables.each do |v| val = field.instance_variable_get(v) klass = val.class if ...
ruby
def view_properties_as_tree field=@form.get_current_field alert "Nil field" unless field return unless field text = [] tree = {} #iv = field.instance_variables.map do |v| v.to_s; end field.instance_variables.each do |v| val = field.instance_variable_get(v) klass = val.class if ...
[ "def", "view_properties_as_tree", "field", "=", "@form", ".", "get_current_field", "alert", "\"Nil field\"", "unless", "field", "return", "unless", "field", "text", "=", "[", "]", "tree", "=", "{", "}", "field", ".", "instance_variables", ".", "each", "do", "|...
place instance_vars of current or given object into a hash and view in a treedialog.
[ "place", "instance_vars", "of", "current", "or", "given", "object", "into", "a", "hash", "and", "view", "in", "a", "treedialog", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/examples/common/devel.rb#L124-L163
train
mare-imbrium/canis
lib/canis/core/widgets/rmenu.rb
Canis.MenuSeparator.repaint
def repaint acolor = get_color($reversecolor, @color, @bgcolor) #@parent.window.printstring( @row, 0, "|%s|" % ("-"*@width), acolor) @parent.window.mvwhline( @row, 1, Ncurses::ACS_HLINE, @width) # these 2 are probably overwritten by the borders @parent.window.mvaddch( @row, 0, Ncurses::ACS...
ruby
def repaint acolor = get_color($reversecolor, @color, @bgcolor) #@parent.window.printstring( @row, 0, "|%s|" % ("-"*@width), acolor) @parent.window.mvwhline( @row, 1, Ncurses::ACS_HLINE, @width) # these 2 are probably overwritten by the borders @parent.window.mvaddch( @row, 0, Ncurses::ACS...
[ "def", "repaint", "acolor", "=", "get_color", "(", "$reversecolor", ",", "@color", ",", "@bgcolor", ")", "@parent", ".", "window", ".", "mvwhline", "(", "@row", ",", "1", ",", "Ncurses", "::", "ACS_HLINE", ",", "@width", ")", "@parent", ".", "window", "....
2011-09-25 V1.3.1
[ "2011", "-", "09", "-", "25", "V1", ".", "3", ".", "1" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rmenu.rb#L47-L54
train
mare-imbrium/canis
lib/canis/core/widgets/rmenu.rb
Canis.Menu.select_item
def select_item ix0 return if @items.nil? or @items.empty? #$log.debug "insdie select item : #{ix0} active: #{@active_index}" if !@active_index.nil? @items[@active_index].on_leave end previtem = @active_index @active_index = ix0 if @items[ix0].enabled @item...
ruby
def select_item ix0 return if @items.nil? or @items.empty? #$log.debug "insdie select item : #{ix0} active: #{@active_index}" if !@active_index.nil? @items[@active_index].on_leave end previtem = @active_index @active_index = ix0 if @items[ix0].enabled @item...
[ "def", "select_item", "ix0", "return", "if", "@items", ".", "nil?", "or", "@items", ".", "empty?", "if", "!", "@active_index", ".", "nil?", "@items", "[", "@active_index", "]", ".", "on_leave", "end", "previtem", "=", "@active_index", "@active_index", "=", "...
recursive if given one not enabled goes to next enabled
[ "recursive", "if", "given", "one", "not", "enabled", "goes", "to", "next", "enabled" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rmenu.rb#L336-L355
train
mare-imbrium/canis
lib/canis/core/widgets/rmenu.rb
Canis.Menu.array_width
def array_width a longest = a.max {|a,b| a.to_s.length <=> b.to_s.length } #$log.debug "array width #{longest}" longest.to_s.length end
ruby
def array_width a longest = a.max {|a,b| a.to_s.length <=> b.to_s.length } #$log.debug "array width #{longest}" longest.to_s.length end
[ "def", "array_width", "a", "longest", "=", "a", ".", "max", "{", "|", "a", ",", "b", "|", "a", ".", "to_s", ".", "length", "<=>", "b", ".", "to_s", ".", "length", "}", "longest", ".", "to_s", ".", "length", "end" ]
private returns length of longest item in array
[ "private", "returns", "length", "of", "longest", "item", "in", "array" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rmenu.rb#L542-L546
train
mare-imbrium/canis
lib/canis/core/widgets/rmenu.rb
Canis.Menu.handle_key
def handle_key ch if !@current_menu.empty? cmenu = @current_menu.last else cmenu = self end if !@@menus.empty? cmenu = @@menus.last else cmenu = self end case ch when KEY_DOWN cmenu.select_next_item #return cmenu.fire # XXX ...
ruby
def handle_key ch if !@current_menu.empty? cmenu = @current_menu.last else cmenu = self end if !@@menus.empty? cmenu = @@menus.last else cmenu = self end case ch when KEY_DOWN cmenu.select_next_item #return cmenu.fire # XXX ...
[ "def", "handle_key", "ch", "if", "!", "@current_menu", ".", "empty?", "cmenu", "=", "@current_menu", ".", "last", "else", "cmenu", "=", "self", "end", "if", "!", "@@menus", ".", "empty?", "cmenu", "=", "@@menus", ".", "last", "else", "cmenu", "=", "self"...
menu LEFT, RIGHT, DOWN, UP, ENTER item could be menuitem or another menu
[ "menu", "LEFT", "RIGHT", "DOWN", "UP", "ENTER", "item", "could", "be", "menuitem", "or", "another", "menu" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rmenu.rb#L565-L638
train
mare-imbrium/canis
lib/canis/core/widgets/rmenu.rb
Canis.MenuBar.set_menu
def set_menu index #$log.debug "set meu: #{@active_index} #{index}" # first leave the existing window menu = @items[@active_index] menu.on_leave # hide its window, if open # now move to given menu @active_index = index menu = @items[@active_index] menu.on_enter #display ...
ruby
def set_menu index #$log.debug "set meu: #{@active_index} #{index}" # first leave the existing window menu = @items[@active_index] menu.on_leave # hide its window, if open # now move to given menu @active_index = index menu = @items[@active_index] menu.on_enter #display ...
[ "def", "set_menu", "index", "menu", "=", "@items", "[", "@active_index", "]", "menu", ".", "on_leave", "@active_index", "=", "index", "menu", "=", "@items", "[", "@active_index", "]", "menu", ".", "on_enter", "@window", ".", "wmove", "menu", ".", "row", ",...
set the given menu index as the current or active menu after closing the active menu. @param Integer index of menu to activate, starting 0
[ "set", "the", "given", "menu", "index", "as", "the", "current", "or", "active", "menu", "after", "closing", "the", "active", "menu", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rmenu.rb#L738-L751
train
mare-imbrium/canis
lib/canis/core/widgets/rmenu.rb
Canis.MenuBar.handle_keys
def handle_keys @selected = false @repaint_required = true # added 2011-12-12 otherwise keeps repainting and you see a flicker @toggle_key ||= 27 # default switch off with ESC, if nothing else defined set_menu 0 begin catch(:menubarclose) do while((ch = @window.getchar()) != @t...
ruby
def handle_keys @selected = false @repaint_required = true # added 2011-12-12 otherwise keeps repainting and you see a flicker @toggle_key ||= 27 # default switch off with ESC, if nothing else defined set_menu 0 begin catch(:menubarclose) do while((ch = @window.getchar()) != @t...
[ "def", "handle_keys", "@selected", "=", "false", "@repaint_required", "=", "true", "@toggle_key", "||=", "27", "set_menu", "0", "begin", "catch", "(", ":menubarclose", ")", "do", "while", "(", "(", "ch", "=", "@window", ".", "getchar", "(", ")", ")", "!=",...
menubar LEFT, RIGHT, DOWN
[ "menubar", "LEFT", "RIGHT", "DOWN" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/rmenu.rb#L764-L821
train
mare-imbrium/canis
lib/canis/core/widgets/keylabelprinter.rb
Canis.KeyLabelPrinter.update_application_key_label
def update_application_key_label(display_code, new_display_code, text) @repaint_required = true labels = key_labels() raise "labels are nil !!!" unless labels labels.each_index do |ix| lab = labels[ix] next if lab.nil? if lab[0] == display_code labels[ix] = [new...
ruby
def update_application_key_label(display_code, new_display_code, text) @repaint_required = true labels = key_labels() raise "labels are nil !!!" unless labels labels.each_index do |ix| lab = labels[ix] next if lab.nil? if lab[0] == display_code labels[ix] = [new...
[ "def", "update_application_key_label", "(", "display_code", ",", "new_display_code", ",", "text", ")", "@repaint_required", "=", "true", "labels", "=", "key_labels", "(", ")", "raise", "\"labels are nil !!!\"", "unless", "labels", "labels", ".", "each_index", "do", ...
updates existing label with a new one. @return true if updated, else false @example update "C-x", "C-x", "Disable"
[ "updates", "existing", "label", "with", "a", "new", "one", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/keylabelprinter.rb#L167-L181
train
mare-imbrium/canis
lib/canis/core/widgets/extras/stackflow.rb
RubyCurses.StackFlow.handle_key
def handle_key ch $log.debug " STACKFLOW handle_key #{ch} " return if @components.empty? _multiplier = ($multiplier == 0 ? 1 : $multiplier ) # should this go here 2011-10-19 unless @_entered $log.warn "XXX WARN: calling ON_ENTER since in this situation it was not called" ...
ruby
def handle_key ch $log.debug " STACKFLOW handle_key #{ch} " return if @components.empty? _multiplier = ($multiplier == 0 ? 1 : $multiplier ) # should this go here 2011-10-19 unless @_entered $log.warn "XXX WARN: calling ON_ENTER since in this situation it was not called" ...
[ "def", "handle_key", "ch", "$log", ".", "debug", "\" STACKFLOW handle_key #{ch} \"", "return", "if", "@components", ".", "empty?", "_multiplier", "=", "(", "$multiplier", "==", "0", "?", "1", ":", "$multiplier", ")", "unless", "@_entered", "$log", ".", "warn", ...
called by parent or form, otherwise its private
[ "called", "by", "parent", "or", "form", "otherwise", "its", "private" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/stackflow.rb#L227-L291
train
mare-imbrium/canis
lib/canis/core/widgets/extras/stackflow.rb
RubyCurses.StackFlow.leave_current_component
def leave_current_component begin @current_component.on_leave rescue FieldValidationException => fve alert fve.to_s end # NOTE this is required, since repaint will just not happen otherwise # Some components are erroneously repainting all, after setting this to true so it i...
ruby
def leave_current_component begin @current_component.on_leave rescue FieldValidationException => fve alert fve.to_s end # NOTE this is required, since repaint will just not happen otherwise # Some components are erroneously repainting all, after setting this to true so it i...
[ "def", "leave_current_component", "begin", "@current_component", ".", "on_leave", "rescue", "FieldValidationException", "=>", "fve", "alert", "fve", ".", "to_s", "end", "@current_component", ".", "repaint_required", "true", "$log", ".", "debug", "\" after on_leave STACKFL...
leave the component we are on. This should be followed by all containers, so that the on_leave action of earlier comp can be displayed, such as dimming components selections
[ "leave", "the", "component", "we", "are", "on", ".", "This", "should", "be", "followed", "by", "all", "containers", "so", "that", "the", "on_leave", "action", "of", "earlier", "comp", "can", "be", "displayed", "such", "as", "dimming", "components", "selectio...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/extras/stackflow.rb#L379-L391
train
mare-imbrium/canis
lib/canis/core/include/deprecated/listselectable.rb
Canis.NewListSelectable.add_to_selection
def add_to_selection crow=@current_index-@_header_adjustment @last_clicked ||= crow min = [@last_clicked, crow].min max = [@last_clicked, crow].max case @selection_mode when :multiple @widget_scrolled = true # FIXME we need a better name if @selected_indices.include? crow ...
ruby
def add_to_selection crow=@current_index-@_header_adjustment @last_clicked ||= crow min = [@last_clicked, crow].min max = [@last_clicked, crow].max case @selection_mode when :multiple @widget_scrolled = true # FIXME we need a better name if @selected_indices.include? crow ...
[ "def", "add_to_selection", "crow", "=", "@current_index", "-", "@_header_adjustment", "@last_clicked", "||=", "crow", "min", "=", "[", "@last_clicked", ",", "crow", "]", ".", "min", "max", "=", "[", "@last_clicked", ",", "crow", "]", ".", "max", "case", "@se...
Only for multiple mode. add an item to selection, if selection mode is multiple if item already selected, it is deselected, else selected typically bound to Ctrl-Space @example bind_key(0) { add_to_selection }
[ "Only", "for", "multiple", "mode", ".", "add", "an", "item", "to", "selection", "if", "selection", "mode", "is", "multiple", "if", "item", "already", "selected", "it", "is", "deselected", "else", "selected", "typically", "bound", "to", "Ctrl", "-", "Space" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/deprecated/listselectable.rb#L57-L79
train
mare-imbrium/canis
lib/canis/core/include/deprecated/listselectable.rb
Canis.NewListSelectable.list_bindings
def list_bindings # what about users wanting 32 and ENTER to also go to next row automatically # should make that optional, TODO bind_key($row_selector || 32, 'toggle selection') { toggle_row_selection } # 2013-03-24 - 14:46 added condition so single select does not get these if @selection...
ruby
def list_bindings # what about users wanting 32 and ENTER to also go to next row automatically # should make that optional, TODO bind_key($row_selector || 32, 'toggle selection') { toggle_row_selection } # 2013-03-24 - 14:46 added condition so single select does not get these if @selection...
[ "def", "list_bindings", "bind_key", "(", "$row_selector", "||", "32", ",", "'toggle selection'", ")", "{", "toggle_row_selection", "}", "if", "@selection_mode", "==", ":multiple", "bind_key", "(", "0", ",", "'range select'", ")", "{", "add_to_selection", "}", "bin...
mod Applications may call this or just copy and modify bindings related to selection
[ "mod", "Applications", "may", "call", "this", "or", "just", "copy", "and", "modify" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/deprecated/listselectable.rb#L210-L225
train
mare-imbrium/canis
lib/canis/core/widgets/tree/treemodel.rb
Canis.DefaultTreeModel.add
def add nodechild, allows_children=true, &block # calling TreeNode.add $log.debug " XXX def add of DTM #{nodechild} to root " node = @root.add nodechild, allows_children, &block if @handler # only if someone is listening, won't fire when being prepared tme = TreeModelEvent.new(row, row,:...
ruby
def add nodechild, allows_children=true, &block # calling TreeNode.add $log.debug " XXX def add of DTM #{nodechild} to root " node = @root.add nodechild, allows_children, &block if @handler # only if someone is listening, won't fire when being prepared tme = TreeModelEvent.new(row, row,:...
[ "def", "add", "nodechild", ",", "allows_children", "=", "true", ",", "&", "block", "$log", ".", "debug", "\" XXX def add of DTM #{nodechild} to root \"", "node", "=", "@root", ".", "add", "nodechild", ",", "allows_children", ",", "&", "block", "if", "@handler", ...
add a node to root passing a block optionally @param [String, TreeNode, Array, Hash] node/s to add @param [Boolean] allow children to be added @see TreeNode.add @return [TreeNode] node just added to root (NOT self)
[ "add", "a", "node", "to", "root", "passing", "a", "block", "optionally" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/tree/treemodel.rb#L50-L60
train
mare-imbrium/canis
lib/canis/core/widgets/tree/treemodel.rb
Canis.DefaultTreeModel.undo
def undo where raise "not yet used" return unless @delete_buffer case @delete_buffer[0] when Array @delete_buffer.each do |r| insert where, r end else insert where, @delete_buffer end end
ruby
def undo where raise "not yet used" return unless @delete_buffer case @delete_buffer[0] when Array @delete_buffer.each do |r| insert where, r end else insert where, @delete_buffer end end
[ "def", "undo", "where", "raise", "\"not yet used\"", "return", "unless", "@delete_buffer", "case", "@delete_buffer", "[", "0", "]", "when", "Array", "@delete_buffer", ".", "each", "do", "|", "r", "|", "insert", "where", ",", "r", "end", "else", "insert", "wh...
a quick method to undo deletes onto given row. More like paste
[ "a", "quick", "method", "to", "undo", "deletes", "onto", "given", "row", ".", "More", "like", "paste" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/tree/treemodel.rb#L136-L147
train
mare-imbrium/canis
lib/canis/core/widgets/tree/treemodel.rb
Canis.DefaultTreeModel.data=
def data=(data) raise "not yet used" raise "Data nil or invalid" if data.nil? or data.size == 0 delete_all @data = data tme = TreeModelEvent.new(0, @data.length-1,:ALL_COLUMNS, self, :INSERT) fire_handler :TREE_MODEL_EVENT, tme end
ruby
def data=(data) raise "not yet used" raise "Data nil or invalid" if data.nil? or data.size == 0 delete_all @data = data tme = TreeModelEvent.new(0, @data.length-1,:ALL_COLUMNS, self, :INSERT) fire_handler :TREE_MODEL_EVENT, tme end
[ "def", "data", "=", "(", "data", ")", "raise", "\"not yet used\"", "raise", "\"Data nil or invalid\"", "if", "data", ".", "nil?", "or", "data", ".", "size", "==", "0", "delete_all", "@data", "=", "data", "tme", "=", "TreeModelEvent", ".", "new", "(", "0", ...
for those quick cases when you wish to replace all the data and not have an event per row being generated
[ "for", "those", "quick", "cases", "when", "you", "wish", "to", "replace", "all", "the", "data", "and", "not", "have", "an", "event", "per", "row", "being", "generated" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/tree/treemodel.rb#L161-L168
train
mare-imbrium/canis
lib/canis/core/widgets/tree/treemodel.rb
Canis.TreeNode.add
def add node, allows_children=true, &block raise IllegalStateException, "Cannot add a child to this node" unless @allows_children $log.debug " XXX def add of TreeNode #{node} parent #{self} " case node when Array node.each do |e| add e, allows_children, &block end ...
ruby
def add node, allows_children=true, &block raise IllegalStateException, "Cannot add a child to this node" unless @allows_children $log.debug " XXX def add of TreeNode #{node} parent #{self} " case node when Array node.each do |e| add e, allows_children, &block end ...
[ "def", "add", "node", ",", "allows_children", "=", "true", ",", "&", "block", "raise", "IllegalStateException", ",", "\"Cannot add a child to this node\"", "unless", "@allows_children", "$log", ".", "debug", "\" XXX def add of TreeNode #{node} parent #{self} \"", "case", "...
add a node to this node, optionally passing a block for further adding add a node as child to existing node If node is not a TreeNode it will be converted to one. @param [TreeNode, Array, Hash] node/s to add @param [boolean] should children be allowed @return [TreeNode] node last added (*NOT* self)
[ "add", "a", "node", "to", "this", "node", "optionally", "passing", "a", "block", "for", "further", "adding", "add", "a", "node", "as", "child", "to", "existing", "node", "If", "node", "is", "not", "a", "TreeNode", "it", "will", "be", "converted", "to", ...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/tree/treemodel.rb#L280-L297
train
mare-imbrium/canis
lib/canis/core/widgets/tree/treemodel.rb
Canis.TreeNode.user_object_path
def user_object_path arr = [] arr << self.user_object.to_s traverse_up do |e| arr << e.user_object.to_s end arr.reverse! end
ruby
def user_object_path arr = [] arr << self.user_object.to_s traverse_up do |e| arr << e.user_object.to_s end arr.reverse! end
[ "def", "user_object_path", "arr", "=", "[", "]", "arr", "<<", "self", ".", "user_object", ".", "to_s", "traverse_up", "do", "|", "e", "|", "arr", "<<", "e", ".", "user_object", ".", "to_s", "end", "arr", ".", "reverse!", "end" ]
returns an array of user_objects for the current node starting from root, ending in the current one. The last node represents this node. @return [Array] Strings[]
[ "returns", "an", "array", "of", "user_objects", "for", "the", "current", "node", "starting", "from", "root", "ending", "in", "the", "current", "one", ".", "The", "last", "node", "represents", "this", "node", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/tree/treemodel.rb#L351-L358
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.say
def say statement, config={} @window ||= _create_footer_window #@window.show #unless @window.visible? $log.debug "XXX: inside say win #{@window} !" case statement when Question if config.has_key? :color_pair $log.debug "INSIDE QUESTION 2 " if $log.debug? else ...
ruby
def say statement, config={} @window ||= _create_footer_window #@window.show #unless @window.visible? $log.debug "XXX: inside say win #{@window} !" case statement when Question if config.has_key? :color_pair $log.debug "INSIDE QUESTION 2 " if $log.debug? else ...
[ "def", "say", "statement", ",", "config", "=", "{", "}", "@window", "||=", "_create_footer_window", "$log", ".", "debug", "\"XXX: inside say win #{@window} !\"", "case", "statement", "when", "Question", "if", "config", ".", "has_key?", ":color_pair", "$log", ".", ...
The basic output method for HighLine objects. The _statement_ parameter is processed as an ERb template, supporting embedded Ruby code. The template is evaluated with a binding inside the HighLine instance. NOTE: modified from original highline, does not care about space at end of question. Also, ansi color cons...
[ "The", "basic", "output", "method", "for", "HighLine", "objects", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1103-L1127
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.say_with_pause
def say_with_pause statement, config={} @window ||= _create_footer_window #@window.show #unless @window.visible? # 2011-10-14 23:52:52 say statement, config @window.wrefresh Ncurses::Panel.update_panels ch=@window.getchar() hide_bottomline ## return char so we can use for...
ruby
def say_with_pause statement, config={} @window ||= _create_footer_window #@window.show #unless @window.visible? # 2011-10-14 23:52:52 say statement, config @window.wrefresh Ncurses::Panel.update_panels ch=@window.getchar() hide_bottomline ## return char so we can use for...
[ "def", "say_with_pause", "statement", ",", "config", "=", "{", "}", "@window", "||=", "_create_footer_window", "say", "statement", ",", "config", "@window", ".", "wrefresh", "Ncurses", "::", "Panel", ".", "update_panels", "ch", "=", "@window", ".", "getchar", ...
display some text at bottom and wait for a key before hiding window
[ "display", "some", "text", "at", "bottom", "and", "wait", "for", "a", "key", "before", "hiding", "window" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1131-L1141
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.say_with_wait
def say_with_wait statement, config={} @window ||= _create_footer_window #@window.show #unless @window.visible? # 2011-10-14 23:52:59 say statement, config @window.wrefresh Ncurses::Panel.update_panels sleep 0.5 hide_bottomline end
ruby
def say_with_wait statement, config={} @window ||= _create_footer_window #@window.show #unless @window.visible? # 2011-10-14 23:52:59 say statement, config @window.wrefresh Ncurses::Panel.update_panels sleep 0.5 hide_bottomline end
[ "def", "say_with_wait", "statement", ",", "config", "=", "{", "}", "@window", "||=", "_create_footer_window", "say", "statement", ",", "config", "@window", ".", "wrefresh", "Ncurses", "::", "Panel", ".", "update_panels", "sleep", "0.5", "hide_bottomline", "end" ]
since say does not leave the screen, it is not exactly recommended as it will hide what's below. It's better to call pause, or this, which will quickly go off. If the message is not important enough to ask for a pause, the will flicker on screen, but not for too long.
[ "since", "say", "does", "not", "leave", "the", "screen", "it", "is", "not", "exactly", "recommended", "as", "it", "will", "hide", "what", "s", "below", ".", "It", "s", "better", "to", "call", "pause", "or", "this", "which", "will", "quickly", "go", "of...
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1146-L1154
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.explain_error
def explain_error( error ) say_with_pause(@question.responses[error]) unless error.nil? if @question.responses[:ask_on_error] == :question say(@question) elsif @question.responses[:ask_on_error] say(@question.responses[:ask_on_error]) end end
ruby
def explain_error( error ) say_with_pause(@question.responses[error]) unless error.nil? if @question.responses[:ask_on_error] == :question say(@question) elsif @question.responses[:ask_on_error] say(@question.responses[:ask_on_error]) end end
[ "def", "explain_error", "(", "error", ")", "say_with_pause", "(", "@question", ".", "responses", "[", "error", "]", ")", "unless", "error", ".", "nil?", "if", "@question", ".", "responses", "[", ":ask_on_error", "]", "==", ":question", "say", "(", "@question...
A helper method for sending the output stream and error and repeat of the question. FIXME: since we write on one line in say, this often gets overidden by next say or ask
[ "A", "helper", "method", "for", "sending", "the", "output", "stream", "and", "error", "and", "repeat", "of", "the", "question", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1160-L1167
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.print_str
def print_str(text, config={}) win = config.fetch(:window, @window) # assuming its in App x = config.fetch :x, 0 # @message_row # Ncurses.LINES-1, 0 since one line window 2011-10-8 y = config.fetch :y, 0 $log.debug "XXX: print_str #{win} with text : #{text} at #{x} #{y} " color = config[...
ruby
def print_str(text, config={}) win = config.fetch(:window, @window) # assuming its in App x = config.fetch :x, 0 # @message_row # Ncurses.LINES-1, 0 since one line window 2011-10-8 y = config.fetch :y, 0 $log.debug "XXX: print_str #{win} with text : #{text} at #{x} #{y} " color = config[...
[ "def", "print_str", "(", "text", ",", "config", "=", "{", "}", ")", "win", "=", "config", ".", "fetch", "(", ":window", ",", "@window", ")", "x", "=", "config", ".", "fetch", ":x", ",", "0", "y", "=", "config", ".", "fetch", ":y", ",", "0", "$l...
Internal method for printing a string
[ "Internal", "method", "for", "printing", "a", "string" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1172-L1185
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.display_text_interactive
def display_text_interactive text, config={} require 'canis/core/util/rcommandwindow' ht = config[:height] || 15 layout = { :height => ht, :width => Ncurses.COLS-1, :top => Ncurses.LINES-ht+1, :left => 0 } rc = CommandWindow.new nil, :layout => layout, :box => true, :title => config[:title] ...
ruby
def display_text_interactive text, config={} require 'canis/core/util/rcommandwindow' ht = config[:height] || 15 layout = { :height => ht, :width => Ncurses.COLS-1, :top => Ncurses.LINES-ht+1, :left => 0 } rc = CommandWindow.new nil, :layout => layout, :box => true, :title => config[:title] ...
[ "def", "display_text_interactive", "text", ",", "config", "=", "{", "}", "require", "'canis/core/util/rcommandwindow'", "ht", "=", "config", "[", ":height", "]", "||", "15", "layout", "=", "{", ":height", "=>", "ht", ",", ":width", "=>", "Ncurses", ".", "COL...
XXX FIXME this uses only rcommand so what is it doing here.
[ "XXX", "FIXME", "this", "uses", "only", "rcommand", "so", "what", "is", "it", "doing", "here", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1592-L1604
train
mare-imbrium/canis
lib/canis/core/util/extras/bottomline.rb
Canis.Bottomline.list
def list( items, mode = :rows, option = nil ) items = items.to_ary.map do |item| ERB.new(item, nil, "%").result(binding) end case mode when :inline option = " or " if option.nil? case items.size when 0 "" when 1 items.first when 2 "...
ruby
def list( items, mode = :rows, option = nil ) items = items.to_ary.map do |item| ERB.new(item, nil, "%").result(binding) end case mode when :inline option = " or " if option.nil? case items.size when 0 "" when 1 items.first when 2 "...
[ "def", "list", "(", "items", ",", "mode", "=", ":rows", ",", "option", "=", "nil", ")", "items", "=", "items", ".", "to_ary", ".", "map", "do", "|", "item", "|", "ERB", ".", "new", "(", "item", ",", "nil", ",", "\"%\"", ")", ".", "result", "(",...
Each member of the _items_ Array is passed through ERb and thus can contain their own expansions. Color escape expansions do not contribute to the final field width.
[ "Each", "member", "of", "the", "_items_", "Array", "is", "passed", "through", "ERb", "and", "thus", "can", "contain", "their", "own", "expansions", ".", "Color", "escape", "expansions", "do", "not", "contribute", "to", "the", "final", "field", "width", "." ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/extras/bottomline.rb#L1675-L1733
train
avvo/delsolr
lib/delsolr/document.rb
DelSolr.Document.construct_field_tag
def construct_field_tag(name, value, options={}) options[:name] = name.to_s use_cdata = options.delete(:cdata) return "<field#{options.to_xml_attribute_string}>#{use_cdata ? cdata(value) : value}</field>\n" end
ruby
def construct_field_tag(name, value, options={}) options[:name] = name.to_s use_cdata = options.delete(:cdata) return "<field#{options.to_xml_attribute_string}>#{use_cdata ? cdata(value) : value}</field>\n" end
[ "def", "construct_field_tag", "(", "name", ",", "value", ",", "options", "=", "{", "}", ")", "options", "[", ":name", "]", "=", "name", ".", "to_s", "use_cdata", "=", "options", ".", "delete", "(", ":cdata", ")", "return", "\"<field#{options.to_xml_attribute...
creates xml field for given inputs
[ "creates", "xml", "field", "for", "given", "inputs" ]
30debacab9e7bf3c6f1907563286c29fb61441b2
https://github.com/avvo/delsolr/blob/30debacab9e7bf3c6f1907563286c29fb61441b2/lib/delsolr/document.rb#L63-L68
train
mare-imbrium/canis
lib/canis/core/include/listselectionmodel.rb
Canis.DefaultListSelectionModel.goto_next_selection
def goto_next_selection return if selected_rows().length == 0 row = selected_rows().sort.find { |i| i > @obj.current_index } row ||= @obj.current_index #@obj.current_index = row @obj.goto_line row end
ruby
def goto_next_selection return if selected_rows().length == 0 row = selected_rows().sort.find { |i| i > @obj.current_index } row ||= @obj.current_index #@obj.current_index = row @obj.goto_line row end
[ "def", "goto_next_selection", "return", "if", "selected_rows", "(", ")", ".", "length", "==", "0", "row", "=", "selected_rows", "(", ")", ".", "sort", ".", "find", "{", "|", "i", "|", "i", ">", "@obj", ".", "current_index", "}", "row", "||=", "@obj", ...
after selecting, traverse selections forward
[ "after", "selecting", "traverse", "selections", "forward" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/listselectionmodel.rb#L202-L208
train
mare-imbrium/canis
lib/canis/core/include/listselectionmodel.rb
Canis.DefaultListSelectionModel.goto_prev_selection
def goto_prev_selection return if selected_rows().length == 0 row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @obj.current_index } row ||= @obj.current_index #@obj.current_index = row @obj.goto_line row end
ruby
def goto_prev_selection return if selected_rows().length == 0 row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @obj.current_index } row ||= @obj.current_index #@obj.current_index = row @obj.goto_line row end
[ "def", "goto_prev_selection", "return", "if", "selected_rows", "(", ")", ".", "length", "==", "0", "row", "=", "selected_rows", "(", ")", ".", "sort", "{", "|", "a", ",", "b", "|", "b", "<=>", "a", "}", ".", "find", "{", "|", "i", "|", "i", "<", ...
after selecting, traverse selections backward
[ "after", "selecting", "traverse", "selections", "backward" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/listselectionmodel.rb#L211-L217
train
mare-imbrium/canis
lib/canis/core/include/listselectionmodel.rb
Canis.DefaultListSelectionModel.remove_row_selection_interval
def remove_row_selection_interval ix0, ix1 @anchor_selection_index = ix0 @lead_selection_index = ix1 arr = @selected_indices.dup # to un highlight @selected_indices.delete_if {|x| x >= ix0 and x <= ix1 } arr.each {|i| @obj.fire_row_changed(i) } lse = ListSelectionEvent.new(ix0, ix1, ...
ruby
def remove_row_selection_interval ix0, ix1 @anchor_selection_index = ix0 @lead_selection_index = ix1 arr = @selected_indices.dup # to un highlight @selected_indices.delete_if {|x| x >= ix0 and x <= ix1 } arr.each {|i| @obj.fire_row_changed(i) } lse = ListSelectionEvent.new(ix0, ix1, ...
[ "def", "remove_row_selection_interval", "ix0", ",", "ix1", "@anchor_selection_index", "=", "ix0", "@lead_selection_index", "=", "ix1", "arr", "=", "@selected_indices", ".", "dup", "@selected_indices", ".", "delete_if", "{", "|", "x", "|", "x", ">=", "ix0", "and", ...
remove selected indices between given indices inclusive
[ "remove", "selected", "indices", "between", "given", "indices", "inclusive" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/listselectionmodel.rb#L234-L242
train
mare-imbrium/canis
lib/canis/core/include/listselectionmodel.rb
Canis.DefaultListSelectionModel.ask_select
def ask_select prompt="Enter selection pattern: " ret = get_string prompt return if ret.nil? || ret == "" indices = get_matching_indices ret #$log.debug "listselectionmodel: ask_select got matches#{@indices} " return if indices.nil? || indices.empty? indices.each { |e| # wil...
ruby
def ask_select prompt="Enter selection pattern: " ret = get_string prompt return if ret.nil? || ret == "" indices = get_matching_indices ret #$log.debug "listselectionmodel: ask_select got matches#{@indices} " return if indices.nil? || indices.empty? indices.each { |e| # wil...
[ "def", "ask_select", "prompt", "=", "\"Enter selection pattern: \"", "ret", "=", "get_string", "prompt", "return", "if", "ret", ".", "nil?", "||", "ret", "==", "\"\"", "indices", "=", "get_matching_indices", "ret", "return", "if", "indices", ".", "nil?", "||", ...
Asks user to enter a string or pattern for selecting rows Selects rows based on pattern, leaving other selections as-is
[ "Asks", "user", "to", "enter", "a", "string", "or", "pattern", "for", "selecting", "rows", "Selects", "rows", "based", "on", "pattern", "leaving", "other", "selections", "as", "-", "is" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/listselectionmodel.rb#L300-L310
train
mare-imbrium/canis
lib/canis/core/include/listselectionmodel.rb
Canis.DefaultListSelectionModel.ask_unselect
def ask_unselect prompt="Enter selection pattern: " ret = get_string prompt return if ret.nil? || ret == "" indices = get_matching_indices ret return if indices.nil? || indices.empty? indices.each { |e| # will not work if single select !! FIXME remove_row_selection_interva...
ruby
def ask_unselect prompt="Enter selection pattern: " ret = get_string prompt return if ret.nil? || ret == "" indices = get_matching_indices ret return if indices.nil? || indices.empty? indices.each { |e| # will not work if single select !! FIXME remove_row_selection_interva...
[ "def", "ask_unselect", "prompt", "=", "\"Enter selection pattern: \"", "ret", "=", "get_string", "prompt", "return", "if", "ret", ".", "nil?", "||", "ret", "==", "\"\"", "indices", "=", "get_matching_indices", "ret", "return", "if", "indices", ".", "nil?", "||",...
Asks user to enter a string or pattern for UNselecting rows UNSelects rows based on pattern, leaving other selections as-is
[ "Asks", "user", "to", "enter", "a", "string", "or", "pattern", "for", "UNselecting", "rows", "UNSelects", "rows", "based", "on", "pattern", "leaving", "other", "selections", "as", "-", "is" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/listselectionmodel.rb#L326-L335
train
mare-imbrium/canis
lib/canis/core/include/listselectionmodel.rb
Canis.DefaultListSelectionModel.list_bindings
def list_bindings # freeing space for paging, now trying out 'v' as selector. 2014-04-14 - 18:57 @obj.bind_key($row_selector || 'v'.ord, 'toggle selection') { toggle_row_selection } # the mode may be set to single after the constructor, so this would have taken effect. if @obj.selection_...
ruby
def list_bindings # freeing space for paging, now trying out 'v' as selector. 2014-04-14 - 18:57 @obj.bind_key($row_selector || 'v'.ord, 'toggle selection') { toggle_row_selection } # the mode may be set to single after the constructor, so this would have taken effect. if @obj.selection_...
[ "def", "list_bindings", "@obj", ".", "bind_key", "(", "$row_selector", "||", "'v'", ".", "ord", ",", "'toggle selection'", ")", "{", "toggle_row_selection", "}", "if", "@obj", ".", "selection_mode", "==", ":multiple", "@obj", ".", "bind_key", "(", "$range_select...
bindings related to selection
[ "bindings", "related", "to", "selection" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/include/listselectionmodel.rb#L340-L358
train
mare-imbrium/canis
lib/canis/core/util/basestack.rb
RubyCurses.ModStack.item_for
def item_for widget each do |e| if e.is_a? Item if e.widget == widget return e end end end return nil end
ruby
def item_for widget each do |e| if e.is_a? Item if e.widget == widget return e end end end return nil end
[ "def", "item_for", "widget", "each", "do", "|", "e", "|", "if", "e", ".", "is_a?", "Item", "if", "e", ".", "widget", "==", "widget", "return", "e", "end", "end", "end", "return", "nil", "end" ]
given an widget, return the item, so we can change weight or some other config
[ "given", "an", "widget", "return", "the", "item", "so", "we", "can", "change", "weight", "or", "some", "other", "config" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/util/basestack.rb#L393-L402
train
mare-imbrium/canis
lib/canis/core/widgets/applicationheader.rb
Canis.ApplicationHeader.print_center
def print_center(htext, r = 0, c = 0) win = @window len = win.getmaxx len = Ncurses.COLS-0 if len == 0 || len > Ncurses.COLS # win.printstring r, ((len-htext.length)/2).floor, htext, @color_pair, @attr end
ruby
def print_center(htext, r = 0, c = 0) win = @window len = win.getmaxx len = Ncurses.COLS-0 if len == 0 || len > Ncurses.COLS # win.printstring r, ((len-htext.length)/2).floor, htext, @color_pair, @attr end
[ "def", "print_center", "(", "htext", ",", "r", "=", "0", ",", "c", "=", "0", ")", "win", "=", "@window", "len", "=", "win", ".", "getmaxx", "len", "=", "Ncurses", ".", "COLS", "-", "0", "if", "len", "==", "0", "||", "len", ">", "Ncurses", ".", ...
internal method, called by repaint to print text_center in the center
[ "internal", "method", "called", "by", "repaint", "to", "print", "text_center", "in", "the", "center" ]
8bce60ff9dad321e299a6124620deb4771740b0b
https://github.com/mare-imbrium/canis/blob/8bce60ff9dad321e299a6124620deb4771740b0b/lib/canis/core/widgets/applicationheader.rb#L106-L112
train