atome 0.5.5.9.1 → 0.5.6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Rakefile +9 -2
 - data/documentation/deep learning/basic_infos.txt +9 -17
 - data/exe/atome +2 -1
 - data/lib/atome/atome.rb +5 -6
 - data/lib/atome/extensions/atome.rb +52 -0
 - data/lib/atome/genesis/generators/atome.rb +3 -0
 - data/lib/atome/genesis/generators/communication.rb +7 -2
 - data/lib/atome/genesis/generators/geometry.rb +0 -3
 - data/lib/atome/genesis/generators/spatial.rb +19 -40
 - data/lib/atome/genesis/generators/utility.rb +16 -12
 - data/lib/atome/genesis/genesis.rb +2 -1
 - data/lib/atome/genesis/sparkle.rb +5 -2
 - data/lib/atome/helpers/essentials.rb +9 -9
 - data/lib/atome/helpers/utilities.rb +26 -0
 - data/lib/atome/kernel/ruby +0 -0
 - data/lib/atome/presets/atome.rb +4 -1
 - data/lib/atome/version.rb +2 -1
 - data/lib/renderers/html/geometry.rb +30 -18
 - data/lib/renderers/html/html.rb +11 -1
 - data/lib/renderers/html/identity.rb +2 -1
 - data/lib/renderers/html/spatial.rb +6 -7
 - data/server/atome_server.rb +148 -0
 - data/server/atome_server_wasm.rb +112 -0
 - data/server/capture.rb +10 -0
 - data/server/config.ru +13 -0
 - data/src/css/style.css +162 -0
 - data/src-tauri/.gitignore +4 -0
 - data/src-tauri/Cargo.toml +27 -0
 - data/src-tauri/build.rs +3 -0
 - data/src-tauri/icons/128x128.png +0 -0
 - data/src-tauri/icons/128x128@2x.png +0 -0
 - data/src-tauri/icons/32x32.png +0 -0
 - data/src-tauri/icons/Square107x107Logo.png +0 -0
 - data/src-tauri/icons/Square142x142Logo.png +0 -0
 - data/src-tauri/icons/Square150x150Logo.png +0 -0
 - data/src-tauri/icons/Square284x284Logo.png +0 -0
 - data/src-tauri/icons/Square30x30Logo.png +0 -0
 - data/src-tauri/icons/Square310x310Logo.png +0 -0
 - data/src-tauri/icons/Square44x44Logo.png +0 -0
 - data/src-tauri/icons/Square71x71Logo.png +0 -0
 - data/src-tauri/icons/Square89x89Logo.png +0 -0
 - data/src-tauri/icons/StoreLogo.png +0 -0
 - data/src-tauri/icons/icon.icns +0 -0
 - data/src-tauri/icons/icon.ico +0 -0
 - data/src-tauri/icons/icon.png +0 -0
 - data/src-tauri/src/main.rs +71 -0
 - data/src-tauri/tauri.conf.json +70 -0
 - data/src-wasm/wasm/wasi-vfs-osx_arm +0 -0
 - data/src-wasm/wasm/wasi-vfs-osx_x86 +0 -0
 - data/src-wasm/wasm/wasi-vfs-unix +0 -0
 - data/src-wasm/wasm/wasi-vfs.exe +0 -0
 - data/vendor/assets/application/examples/center.rb +2 -3
 - data/vendor/assets/application/examples/compute.rb +1 -1
 - data/vendor/assets/application/examples/css.rb +6 -0
 - data/vendor/assets/application/examples/int8.rb +4 -1
 - data/vendor/assets/application/examples/selected.rb +6 -0
 - data/vendor/assets/application/examples/sub_atome_manipulation.rb +19 -0
 - data/vendor/assets/application/examples/test.rb +19 -12
 - data/vendor/assets/application/examples/unit.rb +1 -1
 - data/vendor/assets/application/index.rb +1 -1
 - data/vendor/assets/server/atome_server.rb +178 -33
 - data/vendor/assets/src/index_server.html +2 -0
 - data/vendor/assets/src/index_server_wasm.html +1 -0
 - data/vendor/assets/src/js/atome/atome_helpers/communication.js +2 -4
 - metadata +37 -12
 - data/vendor/assets/application/required_example.rb +0 -1
 - data/vendor/assets/application/test.rb +0 -29
 - data/vendor/assets/application/works/photos.rb +0 -672
 - data/vendor/assets/application/works/photos2.rb +0 -218
 - data/vendor/assets/application/works/photos3.rb +0 -343
 - data/vendor/assets/application/works/photos4.rb +0 -34
 - data/vendor/assets/application/works/photos6.rb +0 -6
 - data/vendor/assets/application/works/vie.rb +0 -196
 - /data/{vendor/assets/application/works/trigga.rb → Guardfile} +0 -0
 - /data/vendor/assets/application/examples/{presets.rb → preset.rb} +0 -0
 
| 
         @@ -0,0 +1,148 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # atome server
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'em/pure_ruby' if RUBY_PLATFORM == 'x64-mingw32'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require '../src/utilities/aui'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'digest/sha2'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'faye/websocket'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'geocoder'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'mail'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'net/ping'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'roda'
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'rufus-scheduler'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require 'securerandom'
         
     | 
| 
      
 16 
     | 
    
         
            +
            require 'sequel'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            class EDen
         
     | 
| 
      
 19 
     | 
    
         
            +
              def self.terminal(cmd,option,ws,value, user, pass)
         
     | 
| 
      
 20 
     | 
    
         
            +
                `#{cmd}`
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def self.file(source, operation,ws,value,user, pass)
         
     | 
| 
      
 24 
     | 
    
         
            +
                file_content= File.send(operation, source, value).to_s
         
     | 
| 
      
 25 
     | 
    
         
            +
                file_content = file_content.gsub("'", "\"")
         
     | 
| 
      
 26 
     | 
    
         
            +
                "=> operation: #{operation}, source:  #{source} , content : #{file_content},"
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
              # return_message = EDen.safe_send(action_requested, message,option, current_user, user_pass)
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              def self.safe_send(method_name, *args)
         
     | 
| 
      
 31 
     | 
    
         
            +
                method_sym = method_name.to_sym
         
     | 
| 
      
 32 
     | 
    
         
            +
                eden_methods = EDen.singleton_methods(false) - Object.singleton_methods
         
     | 
| 
      
 33 
     | 
    
         
            +
                if eden_methods.include?(method_sym)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  send(method_sym, *args)
         
     | 
| 
      
 35 
     | 
    
         
            +
                else
         
     | 
| 
      
 36 
     | 
    
         
            +
                  "forbidden action:  #{method_name}"
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            Faye::WebSocket.load_adapter('puma')
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            class String
         
     | 
| 
      
 44 
     | 
    
         
            +
              def is_json?
         
     | 
| 
      
 45 
     | 
    
         
            +
                begin
         
     | 
| 
      
 46 
     | 
    
         
            +
                  !JSON.parse(self).nil?
         
     | 
| 
      
 47 
     | 
    
         
            +
                rescue
         
     | 
| 
      
 48 
     | 
    
         
            +
                  false
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            class Database
         
     | 
| 
      
 54 
     | 
    
         
            +
              def self.connect_database
         
     | 
| 
      
 55 
     | 
    
         
            +
                if File.exist?("eden.sqlite3")
         
     | 
| 
      
 56 
     | 
    
         
            +
                  eden = Sequel.connect("sqlite://eden.sqlite3")
         
     | 
| 
      
 57 
     | 
    
         
            +
                else
         
     | 
| 
      
 58 
     | 
    
         
            +
                  eden = Sequel.connect("sqlite://eden.sqlite3")
         
     | 
| 
      
 59 
     | 
    
         
            +
                  eden.create_table :atome do
         
     | 
| 
      
 60 
     | 
    
         
            +
                    primary_key :atome_id
         
     | 
| 
      
 61 
     | 
    
         
            +
                    String :aui
         
     | 
| 
      
 62 
     | 
    
         
            +
                    String :id
         
     | 
| 
      
 63 
     | 
    
         
            +
                    String :type
         
     | 
| 
      
 64 
     | 
    
         
            +
                    String :name
         
     | 
| 
      
 65 
     | 
    
         
            +
                    String :content
         
     | 
| 
      
 66 
     | 
    
         
            +
                    String :position
         
     | 
| 
      
 67 
     | 
    
         
            +
                    String :dimension
         
     | 
| 
      
 68 
     | 
    
         
            +
                    String :color
         
     | 
| 
      
 69 
     | 
    
         
            +
                    String :right
         
     | 
| 
      
 70 
     | 
    
         
            +
                    String :effect
         
     | 
| 
      
 71 
     | 
    
         
            +
                    String :shadow
         
     | 
| 
      
 72 
     | 
    
         
            +
                    String :border
         
     | 
| 
      
 73 
     | 
    
         
            +
                    String :fill
         
     | 
| 
      
 74 
     | 
    
         
            +
                    Float :x
         
     | 
| 
      
 75 
     | 
    
         
            +
                    Float :xx
         
     | 
| 
      
 76 
     | 
    
         
            +
                    Float :y
         
     | 
| 
      
 77 
     | 
    
         
            +
                    Float :yy
         
     | 
| 
      
 78 
     | 
    
         
            +
                    Float :z
         
     | 
| 
      
 79 
     | 
    
         
            +
                    Float :zz
         
     | 
| 
      
 80 
     | 
    
         
            +
                    Float :width
         
     | 
| 
      
 81 
     | 
    
         
            +
                    Float :height
         
     | 
| 
      
 82 
     | 
    
         
            +
                    Float :depth
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
                eden
         
     | 
| 
      
 87 
     | 
    
         
            +
              end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            class App < Roda
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
              # comment below when test will be done
         
     | 
| 
      
 94 
     | 
    
         
            +
              File.delete("./eden.sqlite3") if File.exist?("./eden.sqlite3")
         
     | 
| 
      
 95 
     | 
    
         
            +
              eden = Database.connect_database
         
     | 
| 
      
 96 
     | 
    
         
            +
              items = eden[:atome]
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
              # populate the table
         
     | 
| 
      
 99 
     | 
    
         
            +
              items.insert(name: 'abc', width: rand * 100)
         
     | 
| 
      
 100 
     | 
    
         
            +
              items.insert(name: 'def', width: rand * 100)
         
     | 
| 
      
 101 
     | 
    
         
            +
              items.insert(name: 'ghi', width: rand * 100)
         
     | 
| 
      
 102 
     | 
    
         
            +
              puts "Item count: #{items.count}"
         
     | 
| 
      
 103 
     | 
    
         
            +
              puts "The average price is: #{items.avg(:width)}"
         
     | 
| 
      
 104 
     | 
    
         
            +
              index_content = File.read("../src/index_server.html")
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
              opts[:root] = '../src'
         
     | 
| 
      
 107 
     | 
    
         
            +
              plugin :static, %w[/css /js /medias], root: '../src'
         
     | 
| 
      
 108 
     | 
    
         
            +
              route do |r|
         
     | 
| 
      
 109 
     | 
    
         
            +
                r.root do
         
     | 
| 
      
 110 
     | 
    
         
            +
                  if Faye::WebSocket.websocket?(r.env)
         
     | 
| 
      
 111 
     | 
    
         
            +
                    ws = Faye::WebSocket.new(r.env)
         
     | 
| 
      
 112 
     | 
    
         
            +
                    ws.on :open do |event|
         
     | 
| 
      
 113 
     | 
    
         
            +
                      ws.send('server ready'.to_json)
         
     | 
| 
      
 114 
     | 
    
         
            +
                      ws.send('asking for synchro data'.to_json)
         
     | 
| 
      
 115 
     | 
    
         
            +
                    end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                    ws.on(:message) do |event|
         
     | 
| 
      
 118 
     | 
    
         
            +
                      json_string = event.data.gsub(/(\w+):/) { "\"#{$1}\":" }.gsub('=>', ':')
         
     | 
| 
      
 119 
     | 
    
         
            +
                      full_data = JSON.parse(json_string)
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                      message = full_data['message']
         
     | 
| 
      
 122 
     | 
    
         
            +
                      action_requested = full_data['action']
         
     | 
| 
      
 123 
     | 
    
         
            +
                      value= full_data['value']
         
     | 
| 
      
 124 
     | 
    
         
            +
                      option= full_data['option']
         
     | 
| 
      
 125 
     | 
    
         
            +
                      current_user = full_data['user']
         
     | 
| 
      
 126 
     | 
    
         
            +
                      user_pass = full_data['pass']['global']
         
     | 
| 
      
 127 
     | 
    
         
            +
                      # if action_requested == :request
         
     | 
| 
      
 128 
     | 
    
         
            +
                      #   request (message)
         
     | 
| 
      
 129 
     | 
    
         
            +
                      # end
         
     | 
| 
      
 130 
     | 
    
         
            +
                        return_message = EDen.safe_send(action_requested, message,option,ws,value, current_user, user_pass)
         
     | 
| 
      
 131 
     | 
    
         
            +
                      # else
         
     | 
| 
      
 132 
     | 
    
         
            +
                      #   return_message = "no action msg: #{full_data}"
         
     | 
| 
      
 133 
     | 
    
         
            +
                      # end
         
     | 
| 
      
 134 
     | 
    
         
            +
                      ws.send(return_message.to_json)
         
     | 
| 
      
 135 
     | 
    
         
            +
                    end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                    ws.on(:close) do |event|
         
     | 
| 
      
 138 
     | 
    
         
            +
                      puts "server closed with status #{event.code}"
         
     | 
| 
      
 139 
     | 
    
         
            +
                    end
         
     | 
| 
      
 140 
     | 
    
         
            +
                    ws.rack_response
         
     | 
| 
      
 141 
     | 
    
         
            +
                  end
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                  index_content
         
     | 
| 
      
 144 
     | 
    
         
            +
                end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
              end
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,112 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # atome server
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'em/pure_ruby' if RUBY_PLATFORM == 'x64-mingw32'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require '../src/utilities/aui'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'digest/sha2'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'faye/websocket'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'geocoder'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'mail'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'net/ping'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'roda'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'rufus-scheduler'
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'securerandom'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require 'sequel'
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Faye::WebSocket.load_adapter('puma') # Utilisez l'adaptateur 'thin' pour Faye
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            class String
         
     | 
| 
      
 20 
     | 
    
         
            +
              def is_json?
         
     | 
| 
      
 21 
     | 
    
         
            +
                begin
         
     | 
| 
      
 22 
     | 
    
         
            +
                  !JSON.parse(self).nil?
         
     | 
| 
      
 23 
     | 
    
         
            +
                rescue
         
     | 
| 
      
 24 
     | 
    
         
            +
                  false
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            class Database
         
     | 
| 
      
 30 
     | 
    
         
            +
              def self.connect_database
         
     | 
| 
      
 31 
     | 
    
         
            +
                if File.exist?("eden.sqlite3")
         
     | 
| 
      
 32 
     | 
    
         
            +
                  eden = Sequel.connect("sqlite://eden.sqlite3")
         
     | 
| 
      
 33 
     | 
    
         
            +
                else
         
     | 
| 
      
 34 
     | 
    
         
            +
                  eden = Sequel.connect("sqlite://eden.sqlite3")
         
     | 
| 
      
 35 
     | 
    
         
            +
                  eden.create_table :atome do
         
     | 
| 
      
 36 
     | 
    
         
            +
                    primary_key :atome_id
         
     | 
| 
      
 37 
     | 
    
         
            +
                    String :aui
         
     | 
| 
      
 38 
     | 
    
         
            +
                    String :id
         
     | 
| 
      
 39 
     | 
    
         
            +
                    String :type
         
     | 
| 
      
 40 
     | 
    
         
            +
                    String :name
         
     | 
| 
      
 41 
     | 
    
         
            +
                    String :content
         
     | 
| 
      
 42 
     | 
    
         
            +
                    String :position
         
     | 
| 
      
 43 
     | 
    
         
            +
                    String :dimension
         
     | 
| 
      
 44 
     | 
    
         
            +
                    String :color
         
     | 
| 
      
 45 
     | 
    
         
            +
                    String :right
         
     | 
| 
      
 46 
     | 
    
         
            +
                    String :effect
         
     | 
| 
      
 47 
     | 
    
         
            +
                    String :shadow
         
     | 
| 
      
 48 
     | 
    
         
            +
                    String :border
         
     | 
| 
      
 49 
     | 
    
         
            +
                    String :fill
         
     | 
| 
      
 50 
     | 
    
         
            +
                    Float :x
         
     | 
| 
      
 51 
     | 
    
         
            +
                    Float :xx
         
     | 
| 
      
 52 
     | 
    
         
            +
                    Float :y
         
     | 
| 
      
 53 
     | 
    
         
            +
                    Float :yy
         
     | 
| 
      
 54 
     | 
    
         
            +
                    Float :z
         
     | 
| 
      
 55 
     | 
    
         
            +
                    Float :zz
         
     | 
| 
      
 56 
     | 
    
         
            +
                    Float :width
         
     | 
| 
      
 57 
     | 
    
         
            +
                    Float :height
         
     | 
| 
      
 58 
     | 
    
         
            +
                    Float :depth
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
                eden
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            class App < Roda
         
     | 
| 
      
 68 
     | 
    
         
            +
              # comment below when test will be done
         
     | 
| 
      
 69 
     | 
    
         
            +
              File.delete("./eden.sqlite3") if File.exist?("./eden.sqlite3")
         
     | 
| 
      
 70 
     | 
    
         
            +
              eden = Database.connect_database
         
     | 
| 
      
 71 
     | 
    
         
            +
              items = eden[:atome]
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              # populate the table
         
     | 
| 
      
 74 
     | 
    
         
            +
              items.insert(name: 'abc', width: rand * 100)
         
     | 
| 
      
 75 
     | 
    
         
            +
              items.insert(name: 'def', width: rand * 100)
         
     | 
| 
      
 76 
     | 
    
         
            +
              items.insert(name: 'ghi', width: rand * 100)
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
              puts "Item count: #{items.count}"
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
              puts "The average price is: #{items.avg(:width)}"
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
              index_content = File.read("../src/index_server.html")
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              opts[:root] = '../src'
         
     | 
| 
      
 85 
     | 
    
         
            +
              plugin :static, %w[/css /js /medias], root: '../src'
         
     | 
| 
      
 86 
     | 
    
         
            +
              route do |r|
         
     | 
| 
      
 87 
     | 
    
         
            +
                r.root do
         
     | 
| 
      
 88 
     | 
    
         
            +
                  if Faye::WebSocket.websocket?(r.env)
         
     | 
| 
      
 89 
     | 
    
         
            +
                    ws = Faye::WebSocket.new(r.env)
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                    ws.on :open do |event|
         
     | 
| 
      
 92 
     | 
    
         
            +
                      ws.send('server ready'.to_json)
         
     | 
| 
      
 93 
     | 
    
         
            +
                      ws.send('asking for synchro data'.to_json)
         
     | 
| 
      
 94 
     | 
    
         
            +
                    end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                    ws.on(:message) do |event|
         
     | 
| 
      
 97 
     | 
    
         
            +
                      #TODO : encode event on both client and server
         
     | 
| 
      
 98 
     | 
    
         
            +
                    ws.send(event.data.reverse.to_json) # Envoie le message inversé au client
         
     | 
| 
      
 99 
     | 
    
         
            +
                    end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                    ws.on(:close) do |event|
         
     | 
| 
      
 102 
     | 
    
         
            +
                      puts "server closed with status #{event.code}"
         
     | 
| 
      
 103 
     | 
    
         
            +
                    end
         
     | 
| 
      
 104 
     | 
    
         
            +
                    ws.rack_response
         
     | 
| 
      
 105 
     | 
    
         
            +
                  end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                  index_content
         
     | 
| 
      
 108 
     | 
    
         
            +
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            end
         
     | 
    
        data/server/capture.rb
    ADDED
    
    | 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            path = ARGV[0]
         
     | 
| 
      
 2 
     | 
    
         
            +
            name = ARGV[1]
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            File.open("#{path}#{name}.txt", 'w') do |f|
         
     | 
| 
      
 5 
     | 
    
         
            +
              f.write("Le chemin ; #{path}!\n")
         
     | 
| 
      
 6 
     | 
    
         
            +
              f.write("Le nom du fichier #{name}\n")
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # `gphoto2 --capture-image-and-download --filename "../src/medias/images/photos/verif.jpg"`
         
     | 
| 
      
 10 
     | 
    
         
            +
            `gphoto2 --capture-image-and-download --filename "#{path}#{name}.jpg"`
         
     | 
    
        data/server/config.ru
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'roda'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'rack/unreloader'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # Unreloader = Rack::Unreloader.new(subclasses: %w[Roda]) { App }
         
     | 
| 
      
 7 
     | 
    
         
            +
            # Unreloader.require './atome_server.rb'
         
     | 
| 
      
 8 
     | 
    
         
            +
            # run Unreloader
         
     | 
| 
      
 9 
     | 
    
         
            +
            # uncomment to allow code reloading
         
     | 
| 
      
 10 
     | 
    
         
            +
            # uncomment below for prod or comment to allow code reloading
         
     | 
| 
      
 11 
     | 
    
         
            +
            require './atome_server.rb'
         
     | 
| 
      
 12 
     | 
    
         
            +
            run App.app.freeze
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
    
        data/src/css/style.css
    ADDED
    
    | 
         @@ -0,0 +1,162 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            * {
         
     | 
| 
      
 2 
     | 
    
         
            +
                -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
         
     | 
| 
      
 3 
     | 
    
         
            +
            }
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            html, body {
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                font-family: system-ui, -apple-system, -apple-system-font, 'Segoe UI', 'Roboto', sans-serif;
         
     | 
| 
      
 8 
     | 
    
         
            +
                font-size: 12px;
         
     | 
| 
      
 9 
     | 
    
         
            +
                margin: 0;
         
     | 
| 
      
 10 
     | 
    
         
            +
                padding: 0;
         
     | 
| 
      
 11 
     | 
    
         
            +
                background: rgba(39, 39, 39, 1);
         
     | 
| 
      
 12 
     | 
    
         
            +
                overflow: hidden;
         
     | 
| 
      
 13 
     | 
    
         
            +
                -webkit-overflow-scrolling: touch;
         
     | 
| 
      
 14 
     | 
    
         
            +
                width: 100%;
         
     | 
| 
      
 15 
     | 
    
         
            +
                height: 100%;
         
     | 
| 
      
 16 
     | 
    
         
            +
                z-index: 0;
         
     | 
| 
      
 17 
     | 
    
         
            +
                color: lightgray;
         
     | 
| 
      
 18 
     | 
    
         
            +
            }
         
     | 
| 
      
 19 
     | 
    
         
            +
            pre {
         
     | 
| 
      
 20 
     | 
    
         
            +
                min-width: 100px;
         
     | 
| 
      
 21 
     | 
    
         
            +
                margin: 0;
         
     | 
| 
      
 22 
     | 
    
         
            +
                padding: 0;
         
     | 
| 
      
 23 
     | 
    
         
            +
            }
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            .matrix{
         
     | 
| 
      
 27 
     | 
    
         
            +
                background-color: blue;
         
     | 
| 
      
 28 
     | 
    
         
            +
                border-radius: 9px;
         
     | 
| 
      
 29 
     | 
    
         
            +
                display: grid;
         
     | 
| 
      
 30 
     | 
    
         
            +
                grid-template-columns: repeat(4, 1fr);
         
     | 
| 
      
 31 
     | 
    
         
            +
                flex-direction: column;
         
     | 
| 
      
 32 
     | 
    
         
            +
                gap: 12px;
         
     | 
| 
      
 33 
     | 
    
         
            +
                padding: 3px;
         
     | 
| 
      
 34 
     | 
    
         
            +
            }
         
     | 
| 
      
 35 
     | 
    
         
            +
            /*.matrix_element{*/
         
     | 
| 
      
 36 
     | 
    
         
            +
            /*    background-color: rebeccapurple;*/
         
     | 
| 
      
 37 
     | 
    
         
            +
            /*    width: 100%;*/
         
     | 
| 
      
 38 
     | 
    
         
            +
            /*    height: 29px;*/
         
     | 
| 
      
 39 
     | 
    
         
            +
            /*    border-radius: 59px;*/
         
     | 
| 
      
 40 
     | 
    
         
            +
            /*    display: flex;*/
         
     | 
| 
      
 41 
     | 
    
         
            +
            /*    justify-content: center;*/
         
     | 
| 
      
 42 
     | 
    
         
            +
            /*    align-items: center;*/
         
     | 
| 
      
 43 
     | 
    
         
            +
            /*    flex-direction: column;*/
         
     | 
| 
      
 44 
     | 
    
         
            +
            /*    margin-bottom: 20px;*/
         
     | 
| 
      
 45 
     | 
    
         
            +
            /*    padding: 0px*/
         
     | 
| 
      
 46 
     | 
    
         
            +
            /*}*/
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            #view {
         
     | 
| 
      
 49 
     | 
    
         
            +
                left: 0px;
         
     | 
| 
      
 50 
     | 
    
         
            +
                font-size: 25px;
         
     | 
| 
      
 51 
     | 
    
         
            +
                right: 0px;
         
     | 
| 
      
 52 
     | 
    
         
            +
                top: 0px;
         
     | 
| 
      
 53 
     | 
    
         
            +
                bottom: 0px;
         
     | 
| 
      
 54 
     | 
    
         
            +
                width: auto;
         
     | 
| 
      
 55 
     | 
    
         
            +
                /*display: block;*/
         
     | 
| 
      
 56 
     | 
    
         
            +
                height: auto;
         
     | 
| 
      
 57 
     | 
    
         
            +
                overflow: hidden;
         
     | 
| 
      
 58 
     | 
    
         
            +
                position: absolute;
         
     | 
| 
      
 59 
     | 
    
         
            +
                -webkit-overflow-scrolling: touch;
         
     | 
| 
      
 60 
     | 
    
         
            +
            }
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            .ui-selected {
         
     | 
| 
      
 64 
     | 
    
         
            +
                border: #00bb00 solid 3px;
         
     | 
| 
      
 65 
     | 
    
         
            +
            }
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            .ui-selecting {
         
     | 
| 
      
 68 
     | 
    
         
            +
                border: orange solid 3px;
         
     | 
| 
      
 69 
     | 
    
         
            +
            }
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            .selected {
         
     | 
| 
      
 72 
     | 
    
         
            +
                outline: 2px dashed white;
         
     | 
| 
      
 73 
     | 
    
         
            +
                background-color: #00bb00;
         
     | 
| 
      
 74 
     | 
    
         
            +
            }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            .atome {
         
     | 
| 
      
 77 
     | 
    
         
            +
                will-change: transform;
         
     | 
| 
      
 78 
     | 
    
         
            +
                cursor: default;
         
     | 
| 
      
 79 
     | 
    
         
            +
                pointer-events: auto;
         
     | 
| 
      
 80 
     | 
    
         
            +
                caret-color: white;
         
     | 
| 
      
 81 
     | 
    
         
            +
                outline: none;
         
     | 
| 
      
 82 
     | 
    
         
            +
                -webkit-user-select: none;
         
     | 
| 
      
 83 
     | 
    
         
            +
                -moz-user-select: none;
         
     | 
| 
      
 84 
     | 
    
         
            +
                user-select: none;
         
     | 
| 
      
 85 
     | 
    
         
            +
                position: absolute;
         
     | 
| 
      
 86 
     | 
    
         
            +
                display: inline-block;
         
     | 
| 
      
 87 
     | 
    
         
            +
                background-size: 100%;
         
     | 
| 
      
 88 
     | 
    
         
            +
                background-repeat: no-repeat;
         
     | 
| 
      
 89 
     | 
    
         
            +
                -webkit-overflow-scrolling: touch;
         
     | 
| 
      
 90 
     | 
    
         
            +
                -webkit-user-drag: none;
         
     | 
| 
      
 91 
     | 
    
         
            +
                caret-shape: bar;
         
     | 
| 
      
 92 
     | 
    
         
            +
                overflow: visible;
         
     | 
| 
      
 93 
     | 
    
         
            +
            }
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            .text {
         
     | 
| 
      
 96 
     | 
    
         
            +
                /*-webkit-text-fill-color: transparent;*/
         
     | 
| 
      
 97 
     | 
    
         
            +
                /*-webkit-background-clip: text;*/
         
     | 
| 
      
 98 
     | 
    
         
            +
                word-wrap: break-word;
         
     | 
| 
      
 99 
     | 
    
         
            +
                white-space: pre-wrap;
         
     | 
| 
      
 100 
     | 
    
         
            +
                position: relative;
         
     | 
| 
      
 101 
     | 
    
         
            +
            }
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
            .center {
         
     | 
| 
      
 104 
     | 
    
         
            +
                display: flex;
         
     | 
| 
      
 105 
     | 
    
         
            +
                justify-content: center;
         
     | 
| 
      
 106 
     | 
    
         
            +
                align-items: center;
         
     | 
| 
      
 107 
     | 
    
         
            +
                position: absolute;
         
     | 
| 
      
 108 
     | 
    
         
            +
                transform: translate(-50%, -50%);
         
     | 
| 
      
 109 
     | 
    
         
            +
            }
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            .center_vertical {
         
     | 
| 
      
 112 
     | 
    
         
            +
                display: flex;
         
     | 
| 
      
 113 
     | 
    
         
            +
                align-items: center;
         
     | 
| 
      
 114 
     | 
    
         
            +
                position: absolute;
         
     | 
| 
      
 115 
     | 
    
         
            +
                transform: translateY(-50%);
         
     | 
| 
      
 116 
     | 
    
         
            +
            }
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
            .center_horizontal{
         
     | 
| 
      
 119 
     | 
    
         
            +
                display: flex;
         
     | 
| 
      
 120 
     | 
    
         
            +
                justify-content: center;
         
     | 
| 
      
 121 
     | 
    
         
            +
                position: absolute;
         
     | 
| 
      
 122 
     | 
    
         
            +
                transform: translateX(-50%);
         
     | 
| 
      
 123 
     | 
    
         
            +
            }
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            .e_align_h_left {
         
     | 
| 
      
 126 
     | 
    
         
            +
                text-align: left;
         
     | 
| 
      
 127 
     | 
    
         
            +
            }
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
            .e_align_h_right {
         
     | 
| 
      
 130 
     | 
    
         
            +
                text-align: right;
         
     | 
| 
      
 131 
     | 
    
         
            +
            }
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            .e_align_h_center {
         
     | 
| 
      
 134 
     | 
    
         
            +
                text-align: center;
         
     | 
| 
      
 135 
     | 
    
         
            +
            }
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
            .el_align_h {
         
     | 
| 
      
 138 
     | 
    
         
            +
                text-align: justify;
         
     | 
| 
      
 139 
     | 
    
         
            +
            }
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
            .el_align_v {
         
     | 
| 
      
 142 
     | 
    
         
            +
                display: flex;
         
     | 
| 
      
 143 
     | 
    
         
            +
                align-items: center;
         
     | 
| 
      
 144 
     | 
    
         
            +
            }
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
            .el_align_v_bottom {
         
     | 
| 
      
 148 
     | 
    
         
            +
                display: flex;
         
     | 
| 
      
 149 
     | 
    
         
            +
                align-items: flex-end;
         
     | 
| 
      
 150 
     | 
    
         
            +
            }
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            /*::selection {*/
         
     | 
| 
      
 153 
     | 
    
         
            +
            /*    color: transparent;*/
         
     | 
| 
      
 154 
     | 
    
         
            +
            /*    background: none;*/
         
     | 
| 
      
 155 
     | 
    
         
            +
            /*}*/
         
     | 
| 
      
 156 
     | 
    
         
            +
            /*!* For Mozilla Firefox *!*/
         
     | 
| 
      
 157 
     | 
    
         
            +
            /*::-moz-selection {*/
         
     | 
| 
      
 158 
     | 
    
         
            +
            /*    color: transparent;*/
         
     | 
| 
      
 159 
     | 
    
         
            +
            /*    background: none;*/
         
     | 
| 
      
 160 
     | 
    
         
            +
            /*}*/
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [package]
         
     | 
| 
      
 2 
     | 
    
         
            +
            name = "atome"
         
     | 
| 
      
 3 
     | 
    
         
            +
            version = "0.0.0"
         
     | 
| 
      
 4 
     | 
    
         
            +
            description = "A Tauri App"
         
     | 
| 
      
 5 
     | 
    
         
            +
            authors = ["you"]
         
     | 
| 
      
 6 
     | 
    
         
            +
            license = ""
         
     | 
| 
      
 7 
     | 
    
         
            +
            repository = ""
         
     | 
| 
      
 8 
     | 
    
         
            +
            edition = "2021"
         
     | 
| 
      
 9 
     | 
    
         
            +
            rust-version = "1.57"
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            [build-dependencies]
         
     | 
| 
      
 14 
     | 
    
         
            +
            tauri-build = {version = "1.2", features = [] }
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            [dependencies]
         
     | 
| 
      
 17 
     | 
    
         
            +
            serde_json = "1.0"
         
     | 
| 
      
 18 
     | 
    
         
            +
            serde = { version = "1.0", features = ["derive"] }
         
     | 
| 
      
 19 
     | 
    
         
            +
            tauri = {version = "1.5", features = ["api-all"] }
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            [features]
         
     | 
| 
      
 22 
     | 
    
         
            +
            # by default Tauri runs in production mode
         
     | 
| 
      
 23 
     | 
    
         
            +
            # when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
         
     | 
| 
      
 24 
     | 
    
         
            +
            default = [ "custom-protocol" ]
         
     | 
| 
      
 25 
     | 
    
         
            +
            # this feature is used used for production builds where `devPath` points to the filesystem
         
     | 
| 
      
 26 
     | 
    
         
            +
            # DO NOT remove this
         
     | 
| 
      
 27 
     | 
    
         
            +
            custom-protocol = [ "tauri/custom-protocol" ]
         
     | 
    
        data/src-tauri/build.rs
    ADDED
    
    
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            use std::process::Command;
         
     | 
| 
      
 2 
     | 
    
         
            +
            use std::str;
         
     | 
| 
      
 3 
     | 
    
         
            +
            use std::fs;
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
         
     | 
| 
      
 6 
     | 
    
         
            +
            #[tauri::command]
         
     | 
| 
      
 7 
     | 
    
         
            +
            fn greet(name: &str) -> String {
         
     | 
| 
      
 8 
     | 
    
         
            +
                format!("Hello, {}! You've been greeted from Rust!", name)
         
     | 
| 
      
 9 
     | 
    
         
            +
            }
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            #[tauri::command]
         
     | 
| 
      
 12 
     | 
    
         
            +
            fn execute_command(command: &str) -> Result<String, String> {
         
     | 
| 
      
 13 
     | 
    
         
            +
                match Command::new("sh")
         
     | 
| 
      
 14 
     | 
    
         
            +
                    .arg("-c")
         
     | 
| 
      
 15 
     | 
    
         
            +
                    .arg(command)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    .output()
         
     | 
| 
      
 17 
     | 
    
         
            +
                {
         
     | 
| 
      
 18 
     | 
    
         
            +
                    Ok(output) => {
         
     | 
| 
      
 19 
     | 
    
         
            +
                        if output.status.success() {
         
     | 
| 
      
 20 
     | 
    
         
            +
                            Ok(str::from_utf8(&output.stdout).unwrap().to_string())
         
     | 
| 
      
 21 
     | 
    
         
            +
                        } else {
         
     | 
| 
      
 22 
     | 
    
         
            +
                            Err(str::from_utf8(&output.stderr).unwrap().to_string())
         
     | 
| 
      
 23 
     | 
    
         
            +
                        }
         
     | 
| 
      
 24 
     | 
    
         
            +
                    }
         
     | 
| 
      
 25 
     | 
    
         
            +
                    Err(error) => Err(error.to_string()),
         
     | 
| 
      
 26 
     | 
    
         
            +
                }
         
     | 
| 
      
 27 
     | 
    
         
            +
            }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            #[tauri::command]
         
     | 
| 
      
 30 
     | 
    
         
            +
            fn read_file(file_path: &str) -> Result<String, String> {
         
     | 
| 
      
 31 
     | 
    
         
            +
                let content = match fs::read_to_string(file_path) {
         
     | 
| 
      
 32 
     | 
    
         
            +
                    Ok(content) => content,
         
     | 
| 
      
 33 
     | 
    
         
            +
                    Err(_) => return Err("Failed to read file.".to_string()),
         
     | 
| 
      
 34 
     | 
    
         
            +
                };
         
     | 
| 
      
 35 
     | 
    
         
            +
                Ok(content)
         
     | 
| 
      
 36 
     | 
    
         
            +
            }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            #[tauri::command]
         
     | 
| 
      
 39 
     | 
    
         
            +
            fn write_file(file_path: &str, content: &str) -> Result<(), String> {
         
     | 
| 
      
 40 
     | 
    
         
            +
                let path = std::path::Path::new(file_path);
         
     | 
| 
      
 41 
     | 
    
         
            +
                match fs::write(path, content) {
         
     | 
| 
      
 42 
     | 
    
         
            +
                    Ok(_) => Ok(()),
         
     | 
| 
      
 43 
     | 
    
         
            +
                    Err(_) => Err("Failed to write to the file.".to_string()),
         
     | 
| 
      
 44 
     | 
    
         
            +
                }
         
     | 
| 
      
 45 
     | 
    
         
            +
            }
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            // Nouvelle commande pour lister le contenu du répertoire
         
     | 
| 
      
 48 
     | 
    
         
            +
            #[tauri::command]
         
     | 
| 
      
 49 
     | 
    
         
            +
            fn list_directory_content(directory_path: String) -> Result<Vec<String>, String> {
         
     | 
| 
      
 50 
     | 
    
         
            +
                let path = std::path::Path::new(&directory_path);
         
     | 
| 
      
 51 
     | 
    
         
            +
                match fs::read_dir(path) {
         
     | 
| 
      
 52 
     | 
    
         
            +
                    Ok(entries) => {
         
     | 
| 
      
 53 
     | 
    
         
            +
                        let entries: Vec<String> = entries
         
     | 
| 
      
 54 
     | 
    
         
            +
                            .filter_map(|entry| {
         
     | 
| 
      
 55 
     | 
    
         
            +
                                entry.ok().and_then(|e| {
         
     | 
| 
      
 56 
     | 
    
         
            +
                                    e.path().file_name().and_then(std::ffi::OsStr::to_str).map(|s| s.to_owned())
         
     | 
| 
      
 57 
     | 
    
         
            +
                                })
         
     | 
| 
      
 58 
     | 
    
         
            +
                            })
         
     | 
| 
      
 59 
     | 
    
         
            +
                            .collect();
         
     | 
| 
      
 60 
     | 
    
         
            +
                        Ok(entries)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    }
         
     | 
| 
      
 62 
     | 
    
         
            +
                    Err(_) => Err("Failed to read directory.".to_string()),
         
     | 
| 
      
 63 
     | 
    
         
            +
                }
         
     | 
| 
      
 64 
     | 
    
         
            +
            }
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            fn main() {
         
     | 
| 
      
 67 
     | 
    
         
            +
                tauri::Builder::default()
         
     | 
| 
      
 68 
     | 
    
         
            +
                    .invoke_handler(tauri::generate_handler![greet, execute_command, read_file, write_file, list_directory_content])
         
     | 
| 
      
 69 
     | 
    
         
            +
                    .run(tauri::generate_context!())
         
     | 
| 
      
 70 
     | 
    
         
            +
                    .expect("error while running tauri application");
         
     | 
| 
      
 71 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "build": {
         
     | 
| 
      
 3 
     | 
    
         
            +
                "beforeDevCommand": "",
         
     | 
| 
      
 4 
     | 
    
         
            +
                "beforeBuildCommand": "",
         
     | 
| 
      
 5 
     | 
    
         
            +
                "devPath": "../src",
         
     | 
| 
      
 6 
     | 
    
         
            +
                "distDir": "../src",
         
     | 
| 
      
 7 
     | 
    
         
            +
                "withGlobalTauri": true
         
     | 
| 
      
 8 
     | 
    
         
            +
              },
         
     | 
| 
      
 9 
     | 
    
         
            +
              "package": {
         
     | 
| 
      
 10 
     | 
    
         
            +
                "productName": "atome",
         
     | 
| 
      
 11 
     | 
    
         
            +
                "version": "0.0.0"
         
     | 
| 
      
 12 
     | 
    
         
            +
              },
         
     | 
| 
      
 13 
     | 
    
         
            +
              "tauri": {
         
     | 
| 
      
 14 
     | 
    
         
            +
                "allowlist": {
         
     | 
| 
      
 15 
     | 
    
         
            +
                  "all": true,
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "shell": {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    "all": true,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    "open": true
         
     | 
| 
      
 19 
     | 
    
         
            +
                  }
         
     | 
| 
      
 20 
     | 
    
         
            +
                },
         
     | 
| 
      
 21 
     | 
    
         
            +
                "bundle": {
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "active": true,
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "category": "DeveloperTool",
         
     | 
| 
      
 24 
     | 
    
         
            +
                  "copyright": "",
         
     | 
| 
      
 25 
     | 
    
         
            +
                  "deb": {
         
     | 
| 
      
 26 
     | 
    
         
            +
                    "depends": []
         
     | 
| 
      
 27 
     | 
    
         
            +
                  },
         
     | 
| 
      
 28 
     | 
    
         
            +
                  "externalBin": [],
         
     | 
| 
      
 29 
     | 
    
         
            +
                  "icon": [
         
     | 
| 
      
 30 
     | 
    
         
            +
                    "icons/32x32.png",
         
     | 
| 
      
 31 
     | 
    
         
            +
                    "icons/128x128.png",
         
     | 
| 
      
 32 
     | 
    
         
            +
                    "icons/128x128@2x.png",
         
     | 
| 
      
 33 
     | 
    
         
            +
                    "icons/icon.icns",
         
     | 
| 
      
 34 
     | 
    
         
            +
                    "icons/icon.ico"
         
     | 
| 
      
 35 
     | 
    
         
            +
                  ],
         
     | 
| 
      
 36 
     | 
    
         
            +
                  "identifier": "com.atome.dev",
         
     | 
| 
      
 37 
     | 
    
         
            +
                  "longDescription": "",
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "macOS": {
         
     | 
| 
      
 39 
     | 
    
         
            +
                    "entitlements": null,
         
     | 
| 
      
 40 
     | 
    
         
            +
                    "exceptionDomain": "",
         
     | 
| 
      
 41 
     | 
    
         
            +
                    "frameworks": [],
         
     | 
| 
      
 42 
     | 
    
         
            +
                    "providerShortName": null,
         
     | 
| 
      
 43 
     | 
    
         
            +
                    "signingIdentity": null
         
     | 
| 
      
 44 
     | 
    
         
            +
                  },
         
     | 
| 
      
 45 
     | 
    
         
            +
                  "resources": [],
         
     | 
| 
      
 46 
     | 
    
         
            +
                  "shortDescription": "",
         
     | 
| 
      
 47 
     | 
    
         
            +
                  "targets": "all",
         
     | 
| 
      
 48 
     | 
    
         
            +
                  "windows": {
         
     | 
| 
      
 49 
     | 
    
         
            +
                    "certificateThumbprint": null,
         
     | 
| 
      
 50 
     | 
    
         
            +
                    "digestAlgorithm": "sha256",
         
     | 
| 
      
 51 
     | 
    
         
            +
                    "timestampUrl": ""
         
     | 
| 
      
 52 
     | 
    
         
            +
                  }
         
     | 
| 
      
 53 
     | 
    
         
            +
                },
         
     | 
| 
      
 54 
     | 
    
         
            +
                "security": {
         
     | 
| 
      
 55 
     | 
    
         
            +
                  "csp": null
         
     | 
| 
      
 56 
     | 
    
         
            +
                },
         
     | 
| 
      
 57 
     | 
    
         
            +
                "updater": {
         
     | 
| 
      
 58 
     | 
    
         
            +
                  "active": false
         
     | 
| 
      
 59 
     | 
    
         
            +
                },
         
     | 
| 
      
 60 
     | 
    
         
            +
                "windows": [
         
     | 
| 
      
 61 
     | 
    
         
            +
                  {
         
     | 
| 
      
 62 
     | 
    
         
            +
                    "fullscreen": false,
         
     | 
| 
      
 63 
     | 
    
         
            +
                    "height": 600,
         
     | 
| 
      
 64 
     | 
    
         
            +
                    "resizable": true,
         
     | 
| 
      
 65 
     | 
    
         
            +
                    "title": "atome",
         
     | 
| 
      
 66 
     | 
    
         
            +
                    "width": 800
         
     | 
| 
      
 67 
     | 
    
         
            +
                  }
         
     | 
| 
      
 68 
     | 
    
         
            +
                ]
         
     | 
| 
      
 69 
     | 
    
         
            +
              }
         
     | 
| 
      
 70 
     | 
    
         
            +
            }
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -13,4 +13,4 @@ puts "b.compute  left return the position on the screen of the item : #{b.comput 
     | 
|
| 
       13 
13 
     | 
    
         
             
            puts "b.compute left : #{b.compute({ particle: :left })[:value]}, c left : #{b.left}"
         
     | 
| 
       14 
14 
     | 
    
         
             
            puts "b.compute top :#{b.compute({ particle: :top })[:value]}, c top: #{b.top}"
         
     | 
| 
       15 
15 
     | 
    
         
             
            puts  "i.compute width :#{i.compute({ particle: :width })[:value]}, i width: #{i.width}"
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
            puts "i.compute height :#{i.compute({ particle: :height })[:value]}, i height: #{i.height}"
         
     |