[#389739] Ruby Challenge — teresa nuagen <unguyen90@...>

Here is a ruby challenge for all you computer science lovers out there,

22 messages 2011/11/05
[#389769] Re: Ruby Challenge — "Jonan S." <jonanscheffler@...> 2011/11/05

Totally unrelated to any husker computer science programs right? Like

[#389905] Re: Ruby Challenge — Stephen Ramsay <sramsay.unl@...> 2011/11/09

Jonan S. wrote in post #1030330:

[#389907] Re: Ruby Challenge — aseret nuagen <unguyen90@...> 2011/11/09

> You mean like the professor for the course? Because that would be me .

[#389915] Re: Ruby Challenge — Robert Klemme <shortcutter@...> 2011/11/09

On Wed, Nov 9, 2011 at 4:52 AM, aseret nuagen <unguyen90@aim.com> wrote:

[#389792] Tricky DSL, how to do it? — Intransition <transfire@...>

I'd want to write a DSL such that a surface method_missing catches

18 messages 2011/11/06

[#389858] Compiling Ruby Inline C code - resolving errors — Martin Hansen <mail@...>

I am trying to get this Ruby inline C code http://pastie.org/2825882 to

12 messages 2011/11/08

[#389928] Forming a Ruby meetup group... — "Darryl L. Pierce" <mcpierce@...>

Where I work we have a local Ruby group that used to meet up, until the

12 messages 2011/11/09

[#389950] The faster way to read files — "Noé Alejandro" <casanejo@...>

Does anybody know which is the fastest way to read a file? Lets say

18 messages 2011/11/09

[#390064] referring to version numbers in a gem — Chad Perrin <code@...>

How do I specify and access a gem's version number within the code of the

28 messages 2011/11/11

[#390238] RVM problem, plz help — Misha Ognev <b1368810@...>

Hi, I have this problem:

15 messages 2011/11/16

[#390308] any command line tools for querying yaml files — Rahul Kumar <sentinel1879@...>

(Sorry, this is not exactly a ruby question).

11 messages 2011/11/18

[#390338] Newbie - cmd question — Otto Dydakt <ottodydakt@...>

I've literally JUST downloaded ruby from rubyinstaller.org.

21 messages 2011/11/19
[#390342] Re: Newbie - cmd question — Otto Dydakt <ottodydakt@...> 2011/11/19

OK thank you, I uninstalled & reinstalled, checking the three boxes at

[#390343] Re: Newbie - cmd question — "Ian M. Asaff" <ian.asaff@...> 2011/11/19

did you type "irb" first to bring up the ruby command prompt?

[#391154] Re: Newbie - cmd question — "Hussain A." <hahmad@...> 2011/12/12

Hi all,

[#391165] Re: Newbie - cmd question — Luis Lavena <luislavena@...> 2011/12/12

Hussain A. wrote in post #1036281:

[#390374] Principle of Best Principles — Intransition <transfire@...>

I seem to run into a couple of design issue a lot and I never know what is

16 messages 2011/11/20

[#390396] how to call Function argument into another ruby script. — hari mahesh <harismahesh@...>

Consider I have a ruby file called library.rb.

10 messages 2011/11/21

[#390496] How to make 1.9.2 my default version using RVM — Fily Salas <fs_tigre@...>

Hi,

25 messages 2011/11/24

[#390535] Is high-speed sorting impossible with Ruby? — "Gaurav C." <chande.gaurav@...>

Well, first of all, I'm new to Ruby, and to this forum. So, hello. :)

39 messages 2011/11/25
[#390580] Re: Is high-speed sorting impossible with Ruby? — Joao Pedrosa <joaopedrosa@...> 2011/11/27

Hi,

[#390593] Re: Is high-speed sorting impossible with Ruby? — "Gaurav C." <chande.gaurav@...> 2011/11/27

Joao Pedrosa wrote in post #1033884:

[#390600] Re: Is high-speed sorting impossible with Ruby? — Douglas Seifert <doug@...> 2011/11/27

A big gain can be had by disabling the garbage collector. Here is my best

[#390601] Re: Is high-speed sorting impossible with Ruby? — Douglas Seifert <doug@...> 2011/11/27

I've thrown various solutions up on github here:

[#390650] Loading a faulty ruby file - forcing this — Marc Heiler <shevegen@...>

Hi.

10 messages 2011/11/29

[#390689] Stupid question — James Gallagher <lollyproductions@...>

Hi everyone.

22 messages 2011/11/30

Re: need spome help please :)

From: "marcin k." <doreklamster@...>
Date: 2011-11-06 07:49:24 UTC
List: ruby-talk #389781
well.. it was only pice of code as whole one is long :P
but ok here it is:



require 'tk'

`chcp 65001`
root =3D TkRoot.new() {title "Migrator RUCH v1.03 sakej update"}

content =3D Tk::Tile::Frame.new(root) {padding "20 20 125 125"}.grid( =

:sticky =3D> 'nsew')
$content =3D content
TkGrid.columnconfigure root, 0, :weight =3D> 1
TkGrid.rowconfigure root, 0, :weight =3D> 1

# Deklaracja zmiennych globalnych
$psd                =3D TkVariable.new
$miejscowosc        =3D TkVariable.new
$service_check      =3D TkVariable.new

#=C5=9Acie=C5=BCki do plik=C3=B3w
$file_protokol_path   =3D TkVariable.new
$file_csq_path        =3D TkVariable.new
$file_serwis_1_path   =3D TkVariable.new
$file_serwis_2_path   =3D TkVariable.new
$file_serwis_3_path   =3D TkVariable.new
$file_modem_path      =3D TkVariable.new
$file_sprzedaz_path   =3D TkVariable.new
$file_plomba_path     =3D TkVariable.new
$file_pos_path         =3D TkVariable.new
$file_kableprzed_path  =3D TkVariable.new
$file_kablepo_path     =3D TkVariable.new
$file_posprzed_path    =3D TkVariable.new
$file_name =3D TkVariable.new



# Nazwy plik=C3=B3w plus rozszerzenia
$file_protokol_name =3D TkVariable.new
$file_protokol_ext  =3D TkVariable.new
$file_csq_name      =3D TkVariable.new
$file_csq_ext       =3D TkVariable.new
$file_modem_name    =3D TkVariable.new
$file_modem_ext     =3D TkVariable.new
$file_serwis_1_name =3D TkVariable.new
$file_serwis_1_ext  =3D TkVariable.new
$file_serwis_2_name =3D TkVariable.new
$file_serwis_2_ext  =3D TkVariable.new
$file_serwis_3_name =3D TkVariable.new
$file_serwis_3_ext  =3D TkVariable.new
$file_sprzedaz_name =3D TkVariable.new
$file_sprzedaz_ext  =3D TkVariable.new
$file_plomba_name   =3D TkVariable.new
$file_plomba_ext    =3D TkVariable.new
$file_pos_name      =3D TkVariable.new
$file_pos_ext       =3D TkVariable.new
$file_kableprzed_name =3D TkVariable.new
$file_kableprzed_ext =3D TkVariable.new
$file_kablepo_name =3D TkVariable.new
$file_kablepo_ext =3D TkVariable.new
$file_posprzed_name =3D TkVariable.new
$file_posprzed_ext =3D TkVariable.new
$miejscowosc =3D TkVariable.new

# Pola na wprowadzenie warto=C5=9Bci PSD i Miejscowo=C5=9Bci
psd =3D Tk::Tile::Entry.new(content) {width 6; textvariable $psd}.grid( =

:column =3D> 2, :row =3D> 1, :sticky =3D> 'we' )
miejscowosc =3D Tk::Tile::Entry.new(content) {width 20; textvariable =

$miejscowosc}.grid(:column =3D> 5, :row =3D> 1, :sticky =3D> 'we')
Tk::Tile::Label.new(content) {text 'PSD'}.grid( :column =3D> 1, :row =3D>=
1, =

:sticky =3D> 'e')
Tk::Tile::Label.new(content) {text 'Miejscowo=C5=9B=C4=87'}.grid( :column=
 =3D> 4, =

:row =3D> 1, :sticky =3D> 'e')

# Protok=C3=B3=C5=82 elektroniczny
Tk::Tile::Label.new(content) {text 'Protokol elektroniczny'}.grid( =

:column =3D> 1, :columnspan =3D> 2, :row =3D> 2, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.protokol_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

2, :sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_protokol_name}.grid( =

:column =3D> 5, :row =3D> 2, :sticky =3D> 'ne', :columnspan =3D> 4)

# Zdj=C4=99cie modemu
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie modemu'}.grid( :column =3D=
> 1, =

:columnspan =3D> 2, :row =3D> 3, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.modem_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D>=
 3, =

:sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_modem_name}.grid( =

:column =3D> 5, :row =3D> 3, :sticky =3D> 'ne')

# Zdj=C4=99cie CSQ
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie CSQ'}.grid( :column =3D>=
 1, =

:columnspan =3D> 2, :row =3D> 4, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.csq_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D> 4=
, =

:sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_csq_name}.grid( :column =

=3D> 5, :row =3D> 4, :sticky =3D> 'ne')

#Zdj=C4=99cia 3 pierwszych stron ksi=C4=85=C5=BCki serwisowej
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cia ksi=C4=85=C5=BCki serwis=
owej'}.grid( =

:column =3D> 1, :row =3D> 5, :sticky =3D> 'e')
Tk::Tile::Label.new(content) {text '1'}.grid( :column =3D> 2, :row =3D> 5=
, =

:sticky =3D> 'e')
Tk::Tile::Label.new(content) {text '3'}.grid( :column =3D> 2, :row =3D> 6=
, =

:sticky =3D> 'e')
Tk::Tile::Label.new(content) {text '4'}.grid( :column =3D> 2, :row =3D> 7=
, =

:sticky =3D> 'e')

  Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.serwis_1_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

5, :sticky =3D> 'nw', :padx =3D> 15)
  Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.serwis_2_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

6, :sticky =3D> 'nw', :padx =3D> 15)
  Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.seriws_3_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

7, :sticky =3D> 'nw', :padx =3D> 15)

Tk::Tile::Label.new(content) {textvariable $file_serwis_1_name}.grid( =

:column =3D> 5, :row =3D> 5, :sticky =3D> 'ne')
Tk::Tile::Label.new(content) {textvariable $file_serwis_2_name}.grid( =

:column =3D> 5, :row =3D> 6, :sticky =3D> 'ne')
Tk::Tile::Label.new(content) {textvariable $file_serwis_3_name}.grid( =

:column =3D> 5, :row =3D> 7, :sticky =3D> 'ne')

# Zdj=C4=99cie sprzeda=C5=BC pr=C3=B3bnej
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie sprzeda=C5=BCy pr=C3=B3b=
nej'}.grid( =

:column =3D> 1, :columnspan =3D> 2, :row =3D> 9, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.sprzedaz_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

9, :sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_sprzedaz_name}.grid( =

:column =3D> 5, :row =3D> 9, :sticky =3D> 'ne')

# Zdj=C4=99cie plomby serwisowej
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie plomby serwisowej'}.grid=
( =

:column =3D> 1, :columnspan =3D> 2, :row =3D> 10, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.plomba_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

10, :sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_plomba_name}.grid( =

:column =3D> 5, :row =3D> 10, :sticky =3D> 'ne')

# Zdj=C4=99cie stanowiska POS
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie stanowiska POS'}.grid( =

:column =3D> 1, :columnspan =3D> 2, :row =3D> 11, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.pos_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D> 1=
1, =

:sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_pos_name}.grid( :column =

=3D> 5, :row =3D> 11, :sticky =3D> 'ne')

# Zdj=C4=99cie kabli przed migracj=C4=85
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie kabli przed migracj=C4=85=
'}.grid( =

:column =3D> 1, :columnspan =3D> 2, :row =3D> 12, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.kableprzed_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row=
 =

=3D> 12, :sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_kableprzed_name}.grid( =

:column =3D> 5, :row =3D> 12, :sticky =3D> 'ne')

# Zdj=C4=99cie kabli po migracji
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie kabli po migracji'}.grid=
( =

:column =3D> 1, :columnspan =3D> 2, :row =3D> 13, :sticky =3D> 'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.kablepo_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

13, :sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_kablepo_name}.grid( =

:column =3D> 5, :row =3D> 13, :sticky =3D> 'ne')

# Zdj=C4=99cie stanowiska POS przed migracj=C4=85
Tk::Tile::Label.new(content) {text 'Zdj=C4=99cie stanowiska POS przed =

migracj=C4=85'}.grid( :column =3D> 1, :columnspan =3D> 2, :row =3D> 14, :=
sticky =3D> =

'e')
Tk::Tile::Button.new(content) {text '...'; command =

{Generuj.new.posprzed_name(Tk.getOpenFile)}}.grid( :column =3D> 4, :row =3D=
> =

14, :sticky =3D> 'nw', :padx =3D> 15)
Tk::Tile::Label.new(content) {textvariable $file_posprzed_name}.grid( =

:column =3D> 5, :row =3D> 14, :sticky =3D> 'ne')

# Generowanie
Tk::Tile::Label.new(content) {text ''}.grid(:column =3D> 2, :columnspan =3D=
> =

2, :row =3D> 15, :sticky =3D> 'ne')
Tk::Tile::Button.new(content) {text 'Generuj'; command =

{Generuj.new.execute}}.grid( :column =3D> 4, :columnspan =3D> 1, :row =3D=
> 17, =

:sticky =3D> 's')

#  Zamykanie programu
Tk::Tile::Button.new(content) {text 'Zamknij'; command { =

root.destroy}}.grid(:column =3D> 5, :columnspan =3D> 1, :row =3D> 17, :st=
icky =

=3D> 'w' )

# Czy w psd by=C5=82a ksi=C4=85=C5=BCka serwisowa
Tk::Tile::CheckButton.new(content) {text "Brak ksi=C4=85=C5=BCki serwisow=
ej"; =

variable $service_check; onvalue 'brak'; offvalue '1'; command =

{Generuj.new.service_check}}.grid( :column =3D> 3, :columnspan =3D> 2, :r=
ow =

=3D> 8, :sticky =3D> 'e')

# Wyczy=C5=9B=C4=87 wszystkie pola
Tk::Tile::Button.new(content) {text 'Wyczy=C5=9B=C4=87'; command =

{Generuj.new.clear_all}}.grid(:column =3D> 2, :columnspan =3D> 2, :row =3D=
>17, =

:sticky =3D> 'w')

class Generuj
  #
  def service_check
    if $service_check =3D=3D 'brak' then
      $file_serwis_1_name.value =3D "brak ksi=C4=85=C5=BCki serwisowej w =
PSD"
      $file_serwis_2_name.value =3D "brak ksi=C4=85=C5=BCki serwisowej w =
PSD"
      $file_serwis_3_name.value =3D "brak ksi=C4=85=C5=BCki serwisowej w =
PSD"

    else
      $file_serwis_1_name.value =3D nil
      $file_serwis_2_name.value =3D nil
      $file_serwis_3_name.value =3D nil

    end
  end
  # Nazwa pliku protoko=C5=82u
  def protokol_name(path)
    $file_protokol_path.value =3D path
    $file_protokol_name.value =3D File.basename(path, ".*")
    $file_protokol_ext.value  =3D File.extname(path)
  end

  # Nazwa pliku modemu
  def modem_name(path)
    $file_modem_path.value    =3D path
    $file_modem_name.value    =3D File.basename(path, ".*")
    $file_modem_ext.value     =3D File.extname(path)
  end

  # Nazwa pliku csq
  def csq_name(path)
    $file_csq_path.value      =3D path
    $file_csq_name.value      =3D File.basename(path, ".*")
    $file_csq_ext.value       =3D File.extname(path)
  end

  # Nazwa pliku serwis_1
  def serwis_1_name(path)
    $file_serwis_1_path.value =3D path
    $file_serwis_1_name.value =3D File.basename(path, ".*")
    $file_serwis_1_ext.value  =3D File.extname(path)
  end

  # Nazwa pliku serwis_2
  def serwis_2_name(path)
    $file_serwis_2_path.value =3D path
    $file_serwis_2_name.value =3D File.basename(path, ".*")
    $file_serwis_2_ext.value  =3D File.extname(path)
  end

  # Nazwa pliku serwis_3
  def seriws_3_name(path)
    $file_serwis_3_path.value =3D path
    $file_serwis_3_name.value =3D File.basename(path, ".*")
    $file_serwis_3_ext.value  =3D File.extname(path)
  end

  # Nazwa pliku sprzeda=C5=BCy
  def sprzedaz_name(path)
    $file_sprzedaz_path.value =3D path
    $file_sprzedaz_name.value =3D File.basename(path, ".*")
    $file_sprzedaz_ext.value  =3D File.extname(path)
  end

  # Nazwa pliku plomby
  def plomba_name(path)
    $file_plomba_path.value   =3D path
    $file_plomba_name.value   =3D File.basename(path, ".*")
    $file_plomba_ext.value    =3D File.extname(path)
  end

  # Nazwa pliku pos
  def pos_name(path)
    $file_pos_path.value      =3D path
    $file_pos_name.value      =3D File.basename(path, ".*")
    $file_pos_ext.value       =3D File.extname(path)
  end

  # Nazwa pliku kable przed migracj=C4=85
  def kableprzed_name(path)
    $file_kableprzed_path.value      =3D path
    $file_kableprzed_name.value      =3D File.basename(path, ".*")
    $file_kableprzed_ext.value       =3D File.extname(path)
  end


  # Nazwa pliku kable po migracji
  def kablepo_name(path)
    $file_kablepo_path.value      =3D path
    $file_kablepo_name.value      =3D File.basename(path, ".*")
    $file_kablepo_ext.value       =3D File.extname(path)
  end


  # Nazwa pliku pos przed migracj=C4=85
  def posprzed_name(path)
    $file_posprzed_path.value      =3D path
    $file_posprzed_name.value      =3D File.basename(path, ".*")
    $file_posprzed_ext.value       =3D File.extname(path)
  end

  # Zmie=C5=84 nazw=C4=99 pliku
  def file_rename(path)
    case path
      when $file_protokol_path    then $file_name.value =3D =

String.new("potwierdzenie migracji w PSD") and file_ext =3D =

$file_protokol_ext and old_file =3D $file_protokol_path
      when $file_modem_path       then $file_name.value =3D "potwierdzeni=
e =

inslatacji modemu GSM w PSD" and file_ext =3D $file_modem_ext and old_fil=
e =

=3D $file_modem_path
      when $file_csq_path         then $file_name.value =3D "zasi=C4=99g =

stanowiska GSM w PSD" and file_ext =3D $file_csq_ext and old_file =3D =

$file_csq_path
      when $file_serwis_1_path    then $file_name.value =3D "zdj=C4=99cie=
 =

ksi=C4=85=C5=BCki serwisowej w PSD (1)" and file_ext =3D $file_serwis_1_e=
xt and =

old_file =3D $file_serwis_1_path
      when $file_serwis_2_path    then $file_name.value =3D "zdj=C4=99cie=
 =

ksi=C4=85=C5=BCki serwisowej w PSD (2)" and file_ext =3D $file_serwis_2_e=
xt and =

old_file =3D $file_serwis_2_path
      when $file_serwis_3_path    then $file_name.value =3D "zdj=C4=99cie=
 =

ksi=C4=85=C5=BCki serwisowej w PSD (3)" and file_ext =3D $file_serwis_3_e=
xt and =

old_file =3D $file_serwis_3_path
      when $file_sprzedaz_path    then $file_name.value =3D "potwierdzeni=
e =

sprzeda=C5=BCy pr=C3=B3bnej w PSD" and file_ext =3D $file_sprzedaz_ext an=
d old_file =

=3D $file_sprzedaz_path
      when $file_plomba_path      then $file_name.value =3D "zdj=C4=99cie=
 =

plomby drukarki w PSD" and file_ext =3D $file_plomba_ext and old_file =3D=
 =

$file_plomba_path
      when $file_pos_path         then $file_name.value =3D "zdj=C4=99cie=
 =

stanowiska POS w PSD" and file_ext =3D $file_pos_ext and old_file =3D =

$file_pos_path
      when $file_kableprzed_path  then $file_name.value =3D "stan =

okablowania POS przed migracj=C4=85 w PSD " and file_ext =3D =

$file_kableprzed_ext and old_file =3D $file_kableprzed_path
      when $file_kablepo_path    then $file_name.value =3D "stan =

okablowania POS po migracji w PSD " and file_ext =3D $file_kablepo_ext an=
d =

old_file =3D $file_kablepo_path
      when $file_posprzed_path    then $file_name.value =3D "stan POS po =

migracji w PSD " and file_ext =3D $file_posprzed_ext and old_file =3D =

$file_posprzed_path

    end
    if path !=3D nil or "#{path}".length !=3D 0 then
      File.rename("#{old_file}", "Ruch, #{$file_name} #{$psd} , =

#{$miejscowosc}#{file_ext}")
    #else
    #  name_of_file =3D "Brak pliku Ruch, #{file_name}.txt"
    #  file =3D File.new(name_of_file, "w")
    #  file.write "Brak danych dla pliku: Ruch, #{file_name}.txt"
    #  file.close
    end

    $file_name.value =3D nil

  end

  # Zmie=C5=84 nazwy plik=C3=B3w
  def execute
    if "#{$psd}".length !=3D 6 or "#{$psd}".to_i =3D=3D 0 then
      Tk::messageBox :message =3D> "Z=C5=82y kod psd"
    else
      if not File.directory?("PSD #{$psd}, #{$miejscowosc}") then
        Dir.mkdir( "PSD #{$psd}, #{$miejscowosc}" )
      end
      Dir.chdir( "PSD #{$psd}, #{$miejscowosc}" )

      #$win =3D TkToplevel.new($content)
      #$win['geometry'] =3D '300x200+500+200'
      #Tk::Tile::Button.new($win) {text 'Zamknij'; command =

{$win.destroy}}.grid( :column =3D> 3, :row =3D> 3, :sticky =3D> 'w')


            #Tk::Tile::Label.new($win) {textvariable $file_name}.grid( =

:column =3D> 2, :row =3D> 2, :sticky =3D> 'we');


      # Zmie=C5=84 nazw=C4=99 protoko=C5=82u
      file_rename($file_protokol_path)
      file_rename($file_modem_path)
      file_rename($file_csq_path)
      file_rename($file_serwis_1_path)
      file_rename($file_serwis_2_path)
      file_rename($file_serwis_3_path)
      file_rename($file_sprzedaz_path)
      file_rename($file_plomba_path)
      file_rename($file_pos_path)
      file_rename($file_kableprzed_path)
      file_rename($file_kablepo_path)
      file_rename($file_posprzed_path)
      if $service_check =3D=3D "brak" then
        file =3D File.new( "Brak ksi=C4=85=C5=BCki serwisowej w PSD #{$ps=
d}, =

#{$miesjcowosc}")
      end

      if all_files_correct? then
        Tk::messageBox :message =3D> "Wykonano pomy=C5=9Blnie"
      else
        Tk::messageBox :message =3D> "Brakuje plik=C3=B3w"
      end
    end
    Dir.chdir("..")

  end

  # Uzupe=C5=82nij braki
  def complete_rest
    if File.exist?("{$protokol_new}")
      puts "isntnieje!"
    else
      puts "nie ma mnie!"
    end
  end

  # Wyczy=C5=9B=C4=87 wszystkie pola
  def clear_all
    $miejscowosc.value =3D nil
    $psd.value =3D nil
    $file_protokol_path.value =3D nil
    $file_csq_path.value =3D nil
    $file_serwis_1_path.value =3D nil
    $file_serwis_2_path.value =3D nil
    $file_serwis_3_path.value =3D nil
    $file_modem_path.value =3D nil
    $file_sprzedaz_path.value =3D nil
    $file_plomba_path.value =3D nil
    $file_pos_path.value =3D nil
    $file_kableprzed_path.value =3D nil
    $file_kablepo_path.value =3D nil
    $file_posprzed_path.value =3D nil
    $file_protokol_name.value =3D nil
    $file_protokol_ext.value =3D nil
    $file_csq_name.value =3D nil
    $file_csq_ext.value =3D nil
    $file_modem_name.value =3D nil
    $file_modem_ext.value =3D nil
    $file_serwis_1_name.value =3D nil
    $file_serwis_1_ext.value =3D nil
    $file_serwis_2_name.value =3D nil
    $file_serwis_2_ext.value =3D nil
    $file_serwis_3_name.value =3D nil
    $file_serwis_3_ext.value =3D nil
    $file_sprzedaz_name.value =3D nil
    $file_sprzedaz_ext.value =3D nil
    $file_plomba_name.value =3D nil
    $file_plomba_ext.value =3D nil
    $file_pos_name.value =3D nil
    $file_pos_ext.value =3D nil
    $file_kableprzed_ext.value =3D nil
    $file_kableprzed_name.value =3D nil
    $file_kablepo_ext.value =3D nil
    $file_kablepo_name.value =3D nil
    $file_posprzed_ext.value =3D nil
    $file_posprzed_name.value =3D nil
    $miejscowosc.value =3D nil

  end

  # Wszystkich plik=C3=B3w
  def all_files_correct?
    if $service_check =3D=3D "brak" then
      @all_files =3D 6
    else
      @all_files =3D 9
    end
      i =3D 0
      Dir['*.*'].each do |k|
        i =3D i + 1
      end
      if i =3D=3D @all_files then
        return true
      else
        return false
      end
    end


  end

#end
Tk.mainloop

-- =

Posted via http://www.ruby-forum.com/.=

In This Thread