Lately I’ve ‘written’ this module: user-contributions.org/projects/ … ckedit.jpg
which is to be used in the archwd project (rasat did some posts about this)
(coordinates are a bit messed up…)
So here is the question. I can’t get the ‘delete’ button to work properly. Here is what I can:
I can delete files pushing the button, and the list refreshes. But when implementing a script (bash, confirmation dialog) it does refreshing before the script is finished. I probably should use piperead for this, but I really can’t get that working
Hence, the file is deleted, but I should push a button to refresh.
Next I thought about is writing the confirmation dialog also in FvwmScript. But then, I should probably using LaunchScript, SendToScript, etc, but whatever I try, it does not work (or locks itself down).
Most likely the second option is the nicest. If anybody has any idea what I’m doing wrong, please help me
here is the code (widget 17 is the delete button):
QuickEdit:
UseGettext
WindowLocaleTitle {Quick Config Editor}
WindowSize 360 380 # Taille
Font {}
Init
Begin
Set $PWD=(GetScriptArgument 1)
Set $POS=50
Set $LOOP=1
While $LOOP==1 Do
Begin
If (StrCopy $PWD $POS $POS)=={/} Then
Set $LOOP=0
If $POS==0 Then
Set $LOOP=0
Set $POS=(Add $POS -1)
End
Set $PWD=(StrCopy $PWD 1 $POS)
Set $CMD2={cd;cd .fvwm/archwd-user/etc } $PWD {; pwd}
Set $PWD=(GetOutput $CMD2 0 0)
Set $OPT={ }
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
Set $rcwmconf=$PWD {/rc.wmconf}
Set $del={no}
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
Widget 1
Property
Size 80 20
Position 140 340
Flags NoReliefString
Type PushButton
LocaleTitle {View}
Main
Case message of
SingleClic :
Begin
Do {Exec Xdialog --textbox } $PWD {/} (GetTitle 9) { 30 100}
End
End
Widget 2
Property
Size 80 20
Position 240 340
Flags NoReliefString
Type PushButton
LocaleTitle {Edit}
Main
Case message of
SingleClic :
Begin
Do {Exec Xdialog --editbox } $PWD {/} (GetTitle 9) { 30 100}
End
End
Widget 3
Property
Position 10 10
Flags NoReliefString
Size 340 280
Type Rectangle
Main
Case message of
SingleClic :
Begin
End
End
Widget 4
Property
Position 20 15
Size 320 20
Flags NoReliefString NoFocus Left
Type ItemDraw
LocaleTitle {Path:}
Main
Case message of
SingleClic :
Begin
End
End
Widget 5
Property
Position 25 42
Flags NoReliefString NoFocus Left
Size 270 0
Type ItemDraw
Title {*}
Main
Case message of
SingleClic :
Begin
End
End
Widget 10
Property
Position 20 40
Size 320 20
Type Rectangle
Main
Case message of
SingleClic :
Begin
End
End
Widget 6
Property
Position 30 97
Flags NoReliefString
Size 60 18
Title {Conf.d}
#Icon up.xpm
Type PushButton
Main
Case message of
SingleClic :
Begin
Set $CMD={cd;cd .fvwm/archwd-user/etc/conf.d } $PWD {; pwd}
Set $PWD=(GetOutput $CMD 0 0)
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Widget 11
Property
Position 110 97
Flags NoReliefString
Size 60 18
Title {Home}
#Icon home.xpm
Type PushButton
Main
Case message of
SingleClic :
Begin
Set $CMD={cd;cd .fvwm/archwd-user/etc } $PWD {; pwd}
Set $PWD=(GetOutput $CMD 0 0)
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Widget 12
Property
Position 190 102
Flags NoReliefString
Type CheckBox
LocaleTitle { Show hidden files}
Main
Case message of
SingleClic :
Begin
If (GetValue 12) == 1 Then
Set $OPT={ -A }
Else
Set $OPT={ }
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Widget 7
Property
Position 20 130
Flags NoReliefString
Size 320 125
Type List
Title {}
Main
Case message of
SingleClic :
Begin
Set $CMD3={cd } $PWD {; ls} $OPT {-1}
Set $PWD2=$PWD {/} (GetOutput $CMD3 (GetValue 7) -1)
Set $CMD2={cd } $PWD {;cd } $PWD2 { 2>/dev/null; pwd}
Set $PWD2=(GetOutput $CMD2 0 0)
If $PWD2 <> $PWD Then
Begin
Set $PWD = $PWD2
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
Else
Begin
ChangeTitle 9 (GetOutput $CMD3 (GetValue 7) -1)
End
End
End
Widget 8
Property
Position 20 260
Flags NoReliefString NoFocus
Type ItemDraw
LocaleTitle {Selected file:}
Main
Case message of
SingleClic :
Begin
End
End
Widget 9
Property
Position 20 260
Flags NoReliefString
Size 320 20
Type TextField
Title {}
Main
Case message of
SingleClic :
Begin
End
End
Widget 14
Property
Position 110 67
Flags NoReliefString
Size 60 20
Title {Rc.m}
#Icon up.xpm
Type PushButton
Main
Case message of
SingleClic :
Begin
Set $CMD={cd;cd .fvwm/archwd-user/etc/rc.m } $PWD {; pwd}
Set $PWD=(GetOutput $CMD 0 0)
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Widget 15
Property
Position 190 67
Flags NoReliefString
Size 60 20
Title {Rc.d}
#Icon up.xpm
Type PushButton
Main
Case message of
SingleClic :
Begin
Set $CMD={cd;cd .fvwm/archwd-user/etc/rc.d } $PWD {; pwd}
Set $PWD=(GetOutput $CMD 0 0)
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Widget 13
Property
Position 30 67
Flags NoReliefString
Size 60 20
Title {Rc.wmconf}
#Icon up.xpm
Type PushButton
Main
Case message of
SingleClic :
Begin
Do {Exec Xdialog --editbox } $rcwmconf { 30 100}
End
End
Widget 16
Property
Position 270 67
Flags NoReliefString
Size 60 20
Title {Rc.s}
#Icon up.xpm
Type PushButton
Main
Case message of
SingleClic :
Begin
Set $CMD={cd;cd .fvwm/archwd-user/etc/rc.s } $PWD {; pwd}
Set $PWD=(GetOutput $CMD 0 0)
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Widget 17
Property
Size 80 20
Position 40 340
Flags NoReliefString
Type PushButton
LocaleTitle {Delete}
Main
Case message of
SingleClic :
Begin
Set $file = $PWD {/} (GetTitle 9)
#Do {Exec rm } $file
#Set $CalID = (LaunchScript {/home/pressh/yesno})
#Set $del=(ReceivFromScript $CalID)
#Do {Echo} $del
#Do {FvwmScript /home/pressh/yesno } $file
Do {Exec /home/pressh/.fvwm/archwd-user/sbin/del.sh } $file
Set $POS=50
Set $LOOP=1
While $LOOP==1 Do
Begin
If (StrCopy $PWD $POS $POS)=={/} Then
Set $LOOP=0
If $POS==0 Then
Set $LOOP=0
Set $POS=(Add $POS -1)
End
Set $OPT={ }
Set $CMD={cd } $PWD {; ls} $OPT {-1 -F}
Set $LS=(GetOutput $CMD 1 -1)
Set $ID=2
While (GetOutput $CMD $ID -1) <> {} Do
Begin
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
Set $ID=(Add $ID 1)
End
ChangeTitle 7 $LS
ChangeTitle 5 $PWD
ChangeTitle 9 {}
End
End
Confirmation:
WindowTitle {Confirm}
WindowSize 300 105 # Taille
WindowPosition 191 143 # Position
Init
Begin
End
Widget 11
Property
Position 20 20
Size 160 15
Type ItemDraw
Flags Center
Title {Are you sure you want to delete this file?}
Main
Case message of
SingleClic :
Begin
End
End
Widget 2
Property
Size 280 85
Position 10 10
Type Rectangle
Main
Case message of
SingleClic :
Begin
End
End
Widget 4
Property
Title {Yes}
Size 90 28
Position 160 50
Flags NoReliefString
Type PushButton
Value 1
Main
Case message of
SingleClic :
Begin
Set $del = {yes}
SendToScript (GetScriptFather) $del
Quit
End
End
Widget 5
Property
Title {No}
Size 90 28
Position 50 50
Flags NoReliefString
Type PushButton
Value 1
Main
Case message of
SingleClic :
Begin
Set $del = {no}
SendToScript (GetScriptFather) $del
Quit
End
End