Giter Club home page Giter Club logo

glimmer-dsl-tk's People

Contributors

amaleh avatar andyobtiva avatar phaengris avatar user73665 avatar vin1antme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

glimmer-dsl-tk's Issues

Compilation on Windows fails : missing development tools

On Windows 64 bits
Installation fails.
Missing development tools.
mkmf.log says:
"gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/x64-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -L. -pipe -s -fstack-protector-strong -m64 -lx64-msvcrt-ruby300 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char *argv)
6: {
7: return !!argv[argc];
8: }
/
end */

Does anyone recommend the way packaging files that used glimmer-dsl-tk to executables?

I try to use ocra to packaging the files on win10 OS.It worked on the files that used glimmer-dsl-libui, but can't on the that used glimmer-dsl-tk.

/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- glimmer-dsl-tk (LoadError)

I did the packaging-work on two pc, they all reported the same error.

So, I come here to ask for the succed way to packaging the files that used glimmer-dsl-tk.

A proposal of some bug fixes / new features

Hello Andy!

a) Having the intention to create some desktop apps
b) being a Ruby developer, decided to use Ruby for that (because why not)

I found Glimmer and gladly started to use it for my projects. In the end I've ended up creating a small Glimmer based MVVM framework which I intend to develop further in the process of creating more apps which I have in mind.

My question is - would you be interested if I PR some of my patches into Glimmer? In particular I hope you might be interested in these ones https://github.com/Phaengris/Glimte/tree/main/lib/glimmer

  • complete implementation of TreeView (currently Glimmer Tk has only a list implementation)
  • some useful utils like center_within_root, modal, raise_event, some extensions for the on handler, visible / hidden, enabled / disabled properties, also fixes of some Glimmer bugs
  • couple useful aliases for Shine

Please let me know if some of these features could be useful for Glimmer. I'd gladly create corresponding PRs. If you want only some of them, or want them modified, I'm open to discuss and provide any feedback ;)

hello_contextual_menu.rb

I just tested gimmer-dsl-tk/samples/hello/hello_contextual_menu.rb

I have a few small suggestions to make; not sure if these are very useful
but small suggestions are good - less work. :D

(1) When clicking on a flag, for a country, perhaps there can be output
shown e. g. "german" or "mexican" or something, just to show how to
also display the current selection?

(2) Is it possible to start the main widget in the center or top left? I
had it start at the bottom left. But I guess this depends on the user, so
not sure ... maybe "center" would be better.

(3) Can the font be a bit smaller? Not much just a bit. Normally I
like large fonts but it seemed almost a huge font :D
(Actually I noticed the last entry changes the font size ... so perhaps
(3) is a redundant suggestion since the user can change it anyway)

(4) In country, would it be possible to left-pad the text a bit? Right
now the string is very close to the image; let me show an example
at imgur what I mean:

https://i.imgur.com/h4l3aLO.png

Don't mind the black background and other coloured font-text, that
is just KDE konsole. What I refer to is e. g. the flag of Finland
and then Finland - could there be a bit more padding between the
image and the text/label?

Anyway, these are not hugely example, I am just randomly stalking
for activity really ... :D

Treeview 'heading_configure' method not working.

When trying to setup column headings text of treeview control using the code below, 'heading_configure' method call fails with error
"ERROR: `headingconfigure': wrong number of arguments (given 0, expected 2..3) (ArgumentError)":

require "glimmer-dsl-tk"

include Glimmer

root {
    treeview {
        columns %w(country capital currency)
        show :headings 
        heading_configure "country", :text => 'Country'
        heading_configure "capital", :text => 'Capital'
        heading_configure "currency", :text => 'Currency'
    }
}.open

Glimmer-dsl-tk version 0.0.10 was used.

Probably a minor error in the file: samples/hello/hello_entry.rb

Heya Andy,

I think I found a tiny error.

I get:

"Error: NoMethodError: undefined method 'foreground ...'"

Here is the copy/pasted message from that error widget:

NoMethodError: undefined method `foreground=' for #<Glimmer::Tk::LabelProxy:0x00007f97c8704038 @parent_proxy=#    <Glimmer::Tk::RootProxy:0x00007f97c96ec888 @tk=#<Tk::Root:0x00007f97c972f318 @path=".">, @... >
---< backtrace of Ruby side >-----
/root/.gem/gems/glimmer-dsl-tk-0.0.60/lib/glimmer/tk/widget_proxy.rb:573:in `rescue in method_missing'
/root/.gem/gems/glimmer-dsl-tk-0.0.60/lib/glimmer/tk/widget_proxy.rb:560:in `method_missing'
aha.rb:59:in `block (3 levels) in launch'
/root/.gem/gems/tk-0.4.0/lib/tk/validation.rb:328:in `block in _initialize_for_cb_class'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1430:in `eval_cmd'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1430:in `cb_eval'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1385:in `call'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1582:in `block in callback'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1581:in `catch'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1581:in `callback'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1798:in `mainloop'
/root/.gem/gems/tk-0.4.0/lib/tk.rb:1798:in `mainloop'
/root/.gem/gems/glimmer-dsl-tk-0.0.60/lib/glimmer/tk/root_proxy.rb:69:in `start_event_loop'
/root/.gem/gems/glimmer-dsl-tk-0.0.60/lib/glimmer/tk/root_proxy.rb:43:in `open'
aha.rb:86:in `launch'
aha.rb:94:in `<main>'
---< backtrace of Tk side >-------
    invoked from within
"rb_out c00009 555-555-5555e e key .w00005 1 12 555-555-5555 key "
	(in -invalidcommand validation command executed by .w00005)
    invoked from within
"$w insert insert $s"
    (procedure "ttk::entry::Insert" line 4)
    invoked from within
"ttk::entry::Insert .w00005 e "
    (command bound to event)

I get this error when I enter anything in the entry for phone number
e. g. when I add non numbers at the least. But it shows up only
once, then I can continue to type without causing this error widget
to show up.

It's a tiny thing but I just mention it in case you want to fix it.

I''ll also copy/paste the .rb code in case you can not find the file I
mean:

require 'glimmer-dsl-tk'

class HelloEntry
  include Glimmer

  attr_accessor :default, :password, :telephone, :read_only

  def initialize
    self.default = 'default'
    self.password = 'password'
    self.telephone = '555-555-5555'
    self.read_only = 'Telephone area code is 555'
  end

  def launch
    root {
      title 'Hello, Entry!'
      minsize 230, 0
     
      label {
        grid sticky: 'ew'
        text 'default entry'
      }
      entry { |the_entry|
        grid sticky: 'ew'
        text <=> [self, :default]
      }
  
      label {
        grid sticky: 'ew'
        text 'password entry'
      }
      entry {
        grid sticky: 'ew'
        show '*'
        text <=> [self, :password]
      }

      @validated_entry_label = label {
        grid sticky: 'ew'
        text 'entry with event handlers'
      }
      entry { |the_entry|
        grid sticky: 'ew'
        text <=> [self, :telephone]

        # validate 'key' # default when on('validate') or on('invalid') is specified
        ## Validation happens on key change by default when validation listeners are specified
        ## (other accepted values: 'none', 'focus', 'focusin', 'focusout', 'key', or 'all')
    
        ## this event kicks in just after the user typed and before modifying the text variable
        on('validate') do |new_text_variable|
          telephone?(new_text_variable.value)
        end

        ## this event kicks in just after the text variable is validated and before it is modified
        on('invalid') do |validate_args|
          @validated_entry_label.text = "#{validate_args.value} is not a valid phone!"
          @validated_entry_label.foreground = 'red'
        end

        ## this event kicks in just after the text variable is validated and modified
        on('change') do |new_text_variable|
          self.read_only = "Telephone area code is #{new_text_variable.value.gsub(/[^0-9]/, '')[0...3]}"
          @validated_entry_label.text = 'entry with event handlers'
          @validated_entry_label.foreground = nil
        end
    
        ## this is similar to on('change') (which is Glimmer-specific), but more low level at the Tk level
        ## it is the equivalent of calling: the_entry.tk.textvariable.trace('write') { puts "..." }
        ## More at: https://tkdocs.com/tutorial/widgets.html#entry and https://tcl.tk/man/tcl8.6/TclCmd/trace.htm#M14
        on_textvariable('write') do
          puts "\"#{the_entry.text}\" has been written to entry!"
        end
      }

      label {
        grid sticky: 'ew'
        text 'read-only entry'
      }
      entry {
        grid sticky: 'ew'
        text <=> [self, :read_only]
        readonly true
      }
    }.open
  end

  def telephone?(text)
    !!text.match(/^\d{0,3}[-.\/]?\d{0,3}[-.\/]?\d{0,4}$/)
  end
end

HelloEntry.new.launch

Iconphoto method inside root's block is undefined.

Hello,

Using iconphoto method inside root's block returns undefined method error (Error => rescue in method_missing': undefined method iconphoto' for main:Object (NoMethodError)).

Here is example returning error:

require "glimmer-dsl-tk"
include Glimmer
root {
  title 'Title'
  iconphoto TkPhotoImage.new('file' => 'form.png') # Result => Error `rescue in method_missing': undefined method `iconphoto' for main:Object (NoMethodError)
}.open

While with explicit receiver works without error:

root {
  title 'Title'
  root.iconphoto TkPhotoImage.new('file' => 'form.png')
}.open

And with regular Tk syntax works fine:

require 'tk'
root = TkRoot.new {
  title "Feet to Meters"
  iconphoto TkPhotoImage.new('file' => 'form.png')
}
Tk.mainloop()

Expected behavior is like in the first example - iconphoto is option of root and should be defined inside root.

girb bash executable throws ruby error

$ girb
/Users/nakilon/.rbenv/versions/2.3.8/bin/girb:22:in `load': /Users/nakilon/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/glimmer-dsl-tk-0.0.6/bin/girb:5: syntax error, unexpected tGVAR, expecting keyword_do or '{' or '(' (SyntaxError)
/Users/nakilon/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/glimmer-dsl-tk-0.0.6/bin/girb:7: syntax error, unexpected '~', expecting keyword_do or '{' or '('
if !(test -f ~/.girb_runner_exit); then
              ^
unmatched close parenthesis: /.girb_runner_exit); then
  rm -rf ~/
/Users/nakilon/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/glimmer-dsl-tk-0.0.6/bin/girb:10: syntax error, unexpected end-of-input, expecting ')'
	from /Users/nakilon/.rbenv/versions/2.3.8/bin/girb:22:in `<main>'

macOS 11.4

Does not support scrollbar?

text {
    grid column_weight: 0
    value paths
    wrap 'word'
}

When i use text widget, no options can be set to support y-scroll.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.