forked from pyscripter/pyscripter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlgImportDirectory.pas
75 lines (64 loc) · 1.74 KB
/
dlgImportDirectory.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
unit dlgImportDirectory;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Controls, Forms,
Dialogs, StdCtrls,
SpTBXControls, dlgPyIDEBase, SpTBXItem, SpTBXEditors;
type
TImportDirectoryForm = class(TPyIDEDlgBase)
Panel1: TSpTBXPanel;
ebMask: TEdit;
cbRecursive: TCheckBox;
Label1: TSpTBXLabel;
Label2: TSpTBXLabel;
Button1: TSpTBXButton;
Button2: TSpTBXButton;
DirectoryEdit: TSpTBXButtonEdit;
procedure DirectoryEditBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
class var
FileMasks : string;
Directory : string;
Recursive : Boolean;
class function Execute: Boolean;
end;
implementation
uses FileCtrl;
{$R *.dfm}
{ TImportDirectoryForm }
procedure TImportDirectoryForm.DirectoryEditBtnClick(Sender: TObject);
var
NewDir: string;
begin
NewDir := DirectoryEdit.Text;
if SelectDirectory('Select Directory:', '', NewDir) then
DirectoryEdit.Text := NewDir;
end;
class function TImportDirectoryForm.Execute: Boolean;
Var
Owner : TCustomForm;
begin
if Assigned(Screen.ActiveCustomForm) then
Owner := Screen.ActiveCustomForm
else
Owner := Application.MainForm;
with TImportDirectoryForm.Create(Owner) do begin
Result := False;
DirectoryEdit.Text := Directory;
ebMask.Text := FileMasks;
cbRecursive.Checked := Recursive;
if ShowModal = mrOK then begin
Result := True;
FileMasks := ebMask.Text;
Directory := DirectoryEdit.Text;
Recursive := cbRecursive.Checked;
end;
end;
end;
initialization
TImportDirectoryForm.FileMasks := '*.py;*.pyw';
TImportDirectoryForm.Recursive := True;
end.