From 19c37f70bef0e663644280768c6a377ed9cfeb0c Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 5 Dec 2010 17:42:41 +0100 Subject: [PATCH 1/5] ScriptManager: Improvements by Raymond. --- Projects/ScriptManager/scriptmanager.pas | 149 ++++++++++++++--------- 1 file changed, 94 insertions(+), 55 deletions(-) diff --git a/Projects/ScriptManager/scriptmanager.pas b/Projects/ScriptManager/scriptmanager.pas index cb17a24..f8ea4ce 100644 --- a/Projects/ScriptManager/scriptmanager.pas +++ b/Projects/ScriptManager/scriptmanager.pas @@ -1,6 +1,6 @@ { - This file is part of the Simba Project - Copyright (c) 2009 by Raymond van Venetiƫ and Merlijn Wajer + This file is part of the Simba Project + Copyright (c) 2009 by Raymond van Venetiƫ and Merlijn Wajer Simba is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with MML. If not, see . - See the file COPYING, included in this distribution, - for details about the copyright. + See the file COPYING, included in this distribution, + for details about the copyright. Script Manager for the Simba project. } @@ -45,10 +45,13 @@ type TSimbaScript = class(TObject) private + function IsInstalled: boolean; procedure LoadFromNode( Script : TDOMNode); public Name, Version, Author, Description: String; Tags, Files: TStringList; + LocalScript : TSimbaScript; + property Installed : boolean read IsInstalled; procedure Dbg; constructor Create; destructor Destroy; override; @@ -76,10 +79,13 @@ type FLScripts: TList; //Array of the local scripts FVersion : String; FUpdating : boolean; + function FindScriptByName(name : string) : Integer; + function FindLScriptByName(name : string) : Integer; function GetLScriptCount: integer; function GetMainDir: string; function GetScript(index : integer): TSimbaScript; function GetScriptCount: integer; + procedure MatchLocalOnline; public property MainDir : string read GetMainDir write FMaindir; property SimbaScript[index : integer] : TSimbaScript read GetScript; @@ -87,7 +93,7 @@ type procedure LUpdate; //Loads the local scripts, uses MainDir function NewVersion(Script : integer) : boolean; //Checks for updates for Script procedure InstallNewScript(Script : integer); //Installs Script (Online -> Local) - procedure UpdateScript(Script : integer); //Updates all the info/files of local script + procedure UpdateScript(Script : integer; ignoreupdating : boolean = false); //Updates all the info/files of local script procedure LSave; //Saves the local scripts, uses MainDir property LScriptCount : integer read GetLScriptCount; //LScript = Local Script = Installed Script property ScriptCount : integer read GetScriptCount; //Online script @@ -128,34 +134,6 @@ uses {$R *.lfm} { TForm1 } -procedure fill(s: TMMLSettings); -var - i:integer; - ss: TSimbaScript; - LI: TListItem; - strarr: TStringArray; - b: TButton; - -begin - if not s.ListKeys('Scripts/ScriptList', strarr) then - writeln('ListKeys returned false'); - writeln('strarr length: ' + inttostr(length(strarr))); - for i := 0 to high(strarr) do - begin - writeln(s.GetKeyValue('Scripts/ScriptList/Script/Name')); - ss := TSimbaScript.Create(); - ss.Name := s.GetKeyValue('Scripts/ScriptList/Script/Name'); - ss.Author:= s.GetKeyValue('Scripts/ScriptList/Script/Author'); - ss.Description:= s.GetKeyValue('Scripts/ScriptList/Script/Description'); - LI := Form1.ListView1.Items.Add; - LI.Caption := ss.Name; - LI.Data := ss; - LI.ImageIndex:= 0; - - s.DeleteKey('Scripts/ScriptList/Script'); - end; -end; - procedure TForm1.FormCreate(Sender: TObject); begin Mng := TScriptManager.Create; @@ -171,10 +149,11 @@ begin begin Memo1.Clear; Script := TSimbaScript(Item.data); - Memo1.Lines.Add('Name: ' + Script.Name); + Memo1.Lines.add('Name: ' + Script.Name); Memo1.lines.add('Author: ' + Script.Author); Memo1.Lines.add('Version: ' + Script.Version); - Memo1.Lines.Add('Description: ' + Script.Description); + Memo1.Lines.add('Installed: '+ BoolToStr(Script.Installed,true)); + Memo1.Lines.add('Description: ' + Script.Description); end; end; @@ -221,6 +200,11 @@ end; { TSimbaScript } +function TSimbaScript.IsInstalled: boolean; +begin + Result := (LocalScript <> nil); +end; + procedure TSimbaScript.LoadFromNode(Script: TDOMNode); function NodeContents(ItemStr : string; node : TDOMNode) : string; var @@ -268,6 +252,7 @@ begin Writeln(' Author: ' + Author); Writeln(' Version: ' + Version); Writeln(' Description: ' + Description); + Writeln(' Installed: '+ BoolToStr(Installed,true)); Writeln(' Tags:'); for i := 0 to Tags.Count - 1 do Writeln(' ' + Tags[i]); @@ -279,7 +264,6 @@ end; constructor TSimbaScript.Create; begin inherited; - {stuff here} end; @@ -296,6 +280,26 @@ end; { TScriptManager } +function TScriptManager.FindScriptByName(name: string): Integer; +var + I : integer; +begin + for i := FScripts.Count - 1 downto 0 do + if TSimbaScript(FScripts[i]).Name = Name then + exit(i); + result := -1; +end; + +function TScriptManager.FindLScriptByName(name: string): Integer; +var + I : integer; +begin + for i := FScripts.Count - 1 downto 0 do + if TLSimbaScript(FLScripts[i]).Name = Name then + exit(i); + result := -1; +end; + function TScriptManager.GetLScriptCount: integer; begin result := FLScripts.Count; @@ -316,6 +320,25 @@ begin result := FScripts.Count; end; +procedure TScriptManager.MatchLocalOnline; +var + Scrpt : TLSimbaScript; + I,II : integer; +begin + for ii := 0 to LScriptCount - 1 do + begin + Scrpt := TLSimbaScript(FLScripts[ii]); + if Scrpt.OnlineScript = nil then + for i := 0 to ScriptCount-1 do + if TSimbaScript(FScripts[i]).Name = Scrpt.Name then + begin + Scrpt.OnlineScript := TSimbaScript(FScripts[i]); + Break; + end; + Scrpt.OnlineScript.LocalScript := Scrpt; + end; +end; + procedure TScriptManager.Update; var XMLFile : string; @@ -325,6 +348,7 @@ var Subs : TStringList; Down : TDownloadThread; SScript : TSimbaScript; + I : integer; begin if FUpdating then exit; @@ -350,13 +374,21 @@ begin begin SScript := TSimbaScript.Create; SScript.LoadFromNode(Script); - FScripts.Add(SScript); SScript.Dbg; + i := FindScriptByName(SScript.Name); + if (i = -1) then + FScripts.Add(SScript) + else + begin + SScript.free; + TSimbaScript(FScripts[i]).LoadFromNode(Script); + end; Script := Script.NextSibling; end; end; XMLDoc.Free; FUpdating := false; + MatchLocalOnline; end; procedure TScriptManager.LUpdate; @@ -366,6 +398,7 @@ var Subs : TStringList; Down : TDownloadThread; SScript : TLSimbaScript; + I : integer; begin if DirectoryExists(MainDir) = false then exit; @@ -380,29 +413,28 @@ begin begin SScript := TLSimbaScript.Create; SScript.LoadFromName(Node.TextContent,maindir); - FLScripts.Add(SScript); + i := FindLScriptByName(SScript.Name); SScript.Dbg; + if (i = -1) then + FLScripts.Add(SScript) + else + begin + SScript.free; + TLSimbaScript(FLScripts[i]).LoadFromName(Node.TextContent,maindir); + end; Script := Script.NextSibling; end; end; XMLDoc.Free; end; + MatchLocalOnline; end; function TScriptManager.NewVersion(Script: integer): boolean; -var - Scrpt : TLSimbaScript; - I : integer; begin - Scrpt := TLSimbaScript(FLScripts[Script]); - if Scrpt.OnlineScript = nil then - for i := 0 to ScriptCount-1 do - if TSimbaScript(FScripts[i]).Name = Scrpt.Name then - begin - Scrpt.OnlineScript := TSimbaScript(FScripts[i]); - Break; - end; - result := Scrpt.OnlineScript.Version <> Scrpt.Version; + MatchLocalOnline; + with TLSimbaScript(FLScripts[Script]) do + result := OnlineScript.Version <> Version; end; procedure TScriptManager.InstallNewScript(Script: integer); @@ -411,6 +443,9 @@ var LScrpt: TLSimbaScript; Dir : string; begin + if FUpdating then + exit; + FUpdating := true; Scrpt := TSimbaScript(FScripts[Script]); LScrpt := TLSimbaScript.create; FLScripts.Add(LScrpt); @@ -421,17 +456,21 @@ begin Writeln('Directory already exists, yet continue?'); if not CreateDir(Dir) then Writeln('Failed to create dir..'); - UpdateScript(FLScripts.Count - 1); + UpdateScript(FLScripts.Count - 1,true); end; -procedure TScriptManager.UpdateScript(Script: integer); +procedure TScriptManager.UpdateScript(Script: integer; ignoreupdating : boolean = false); var LScrpt : TLSimbaScript; Scrpt : TSimbaScript; + DownloadThread : TDownloadThread; begin - LScrpt := TLSimbaScript(FLScripts[Script]); if not NewVersion(Script) then Exit; + if FUpdating and not ignoreupdating then + exit; + FUpdating := true; + LScrpt := TLSimbaScript(FLScripts[Script]); Scrpt := LScrpt.OnlineScript; with LScrpt do begin @@ -444,6 +483,8 @@ begin end; LScrpt.Save(MainDir); //Saves the setting file, now we only need to update the files //Download files & write to folder + + FUPdating := false; end; procedure TScriptManager.LSave; @@ -497,7 +538,6 @@ begin end; { TLSimbaScript } - procedure TLSimbaScript.LoadFromFile(const filename: string); var XMLDoc : TXMLDocument; @@ -571,4 +611,3 @@ begin end; end. - From 5835514acd7ec845ef5ac0c9c5e61481a8e078df Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Mon, 6 Dec 2010 23:30:01 +0100 Subject: [PATCH 2/5] Updated XPChars. --- Fonts/XPChars/32.bmp | Bin 0 -> 210 bytes Fonts/XPChars/44.bmp | Bin 0 -> 210 bytes Fonts/XPChars/48.bmp | Bin 366 -> 366 bytes Fonts/XPChars/49.bmp | Bin 366 -> 262 bytes Fonts/XPChars/50.bmp | Bin 366 -> 366 bytes Fonts/XPChars/51.bmp | Bin 366 -> 366 bytes Fonts/XPChars/52.bmp | Bin 366 -> 366 bytes Fonts/XPChars/53.bmp | Bin 366 -> 314 bytes Fonts/XPChars/54.bmp | Bin 366 -> 366 bytes Fonts/XPChars/55.bmp | Bin 366 -> 366 bytes Fonts/XPChars/56.bmp | Bin 366 -> 366 bytes Fonts/XPChars/57.bmp | Bin 366 -> 366 bytes Fonts/XPChars/58.bmp | Bin 198 -> 210 bytes Fonts/XPChars/80.bmp | Bin 342 -> 366 bytes Fonts/XPChars/88.bmp | Bin 390 -> 314 bytes 15 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Fonts/XPChars/32.bmp create mode 100644 Fonts/XPChars/44.bmp diff --git a/Fonts/XPChars/32.bmp b/Fonts/XPChars/32.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e02a4591aaa05cf344bde52f1ce3beca2741e45c GIT binary patch literal 210 icmZ?ry~F?kWE<`~M%pK<1*efofpNuoy&LAprMa B6>|Up literal 0 HcmV?d00001 diff --git a/Fonts/XPChars/48.bmp b/Fonts/XPChars/48.bmp index 13beb49f0f1cfe7cca2df03010d22a2aee7dc0ca..92a78400a930a23982523dc5b2d41926083c8b59 100644 GIT binary patch literal 366 zcmZ?r&0}N$12Z700mK|Y%nQVf3=%++fx!YQ59Sb0{AXYQA{6i+48TGNDWDicC7c1# r1LlI5Fa}5qHZ^36gUkb2fUpA2#$_f%EmRjsH5dS01$G#WkDCSneo{?% literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59Ux#{AXZ*AcRr>VE`-ylm!8Z7+5ig w4PhXOLz&3p5KV9rWD1xA7eO-zCXQ}CP#mHWLp@v=>PV0U5L3X;g>dnZ0BDJ2UjP6A diff --git a/Fonts/XPChars/49.bmp b/Fonts/XPChars/49.bmp index c043920b00ffa82a22c13b0865b4ec762ff1a81a..13ba69f83ec4233c92aae195ae1fcefa4a0d0a9b 100644 GIT binary patch literal 262 zcmZ?rWn*Lj12Z700mQ68%nQVf3=%++f#Cv}B!c+QzyL%4Q2|slP!OyHW)_8fkR4F- Xz$^v?A7}$e7A_C55zL2KjzR+fRx&=b literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59UyX_>XDI|NlTi`ildtMYk6$!hk6b TbTddbhI)u!z~Y$RLKgu5G5#!= diff --git a/Fonts/XPChars/50.bmp b/Fonts/XPChars/50.bmp index 4232d0f45e54ec07d3d4f338f5ae5c0aabd2e386..5bffb49c968dcd11c9c4b0ffebb7592d621623ec 100644 GIT binary patch literal 366 zcmZ?r&0}N$12Z700mK|Y%nQVf3=%++fx!YQ59Sa<{AXZ5Lk#~h0K_1mFqi=$Q4FWM a6xB1{Tp%$oiur0`Jpq)T2$i>L60r9~ASr9850Gdocg#Z8m diff --git a/Fonts/XPChars/51.bmp b/Fonts/XPChars/51.bmp index 9d7305fe85507f73ec89600fa46c6f074eec3dcb..1116bbc54560d221d305908fe0b39b7ebc136dbd 100644 GIT binary patch delta 28 dcmaFI^o~i`$v2OY0SwH5qy`XkY!r@W1OQSf1b6@d delta 28 dcmaFI^o~i`$v2OY0SwH5qy`YPZxoJZ1OQSa1a|-c diff --git a/Fonts/XPChars/52.bmp b/Fonts/XPChars/52.bmp index 62b106f2bf4dca31bb52ab63b3ccc423a01a2ee5..029362f1507ab537b6ae459cc897167b361924ba 100644 GIT binary patch literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59W|W{Kr)N|36R=O&lZw6Nk!z_^1G4 Z6i^JJ9nK&{9N`=^?QjXQ#NoOLGXS0AMt%SQ literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59Uyd_>XDO|NlTiG;xp!OdKi&;v)gL iIY2Qm8zhHj4nzcpILHDt^+0ogf+UGUw7?yMiva*@mqdU7 diff --git a/Fonts/XPChars/53.bmp b/Fonts/XPChars/53.bmp index e65350c7603e10f7b342566b1d1ef0d05e032801..e61d64446da24bb06d295672b4043f58f2d272cd 100644 GIT binary patch literal 314 zcmZ?rwPIud12Z700mN)T%nQVf3=%++fq?}o59Sa-{AXZ*Ac)%kFaYL)Wc~vQC;+n& lT!<2oJh5VMgTUs(b;0a}3jo#OvkPJ)l!R*rGhjAg&;V+9NfH16 literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59Ux#{AXZ*AcRr>VE`-ylm!8x7=!_1 uBe=N5k@cdnfn1O^$a-PcA_QS}foQl&I0LL5WDX2LW#Hx@n-AB8%m4r|;7WP` diff --git a/Fonts/XPChars/54.bmp b/Fonts/XPChars/54.bmp index 438ba24ebaa26f2b12a13d6d07f85c558bd1aef2..5590b37c06569b17ab02ab17982da1d7a7c93dfb 100644 GIT binary patch literal 366 zcmZ?r&0}N$12Z700mK|Y%nQVf3=%++fx!YQ59Sb0{AXYQA{6i+48TGNDWDic5sU%i zg4t+lkj2rofYgJvK(wN3M3RMAg>F7n6lyQX5SR#@0nq}If>{Jp0uh4w0wIcx1pwIh BOL_nR literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59Ux#{AXZ*AcRr>VE`-ylm!8x7+58# tY>;*|y$$ph;*_KrYZQ l5DB*h#D@X6I8Xpt0Yn@uNUAu*4ImrQ%mnel0B#X31_0!HO?UtR literal 366 zcmZ?r&0}N$12Z700mSS;%nQVf3=%++fx!YQ59Ux#{AXZ*AcRr>VE`-ylm!8x7=!_1 uBe-C3kRf0-2yuupXzJl=V6ss4aB*Dfv5AAkVDYs2MquLR#9^R diff --git a/Fonts/XPChars/58.bmp b/Fonts/XPChars/58.bmp index f48a5f5b0616294fbbd4de3498a5b36400ee0cdb..9a38cae3abc168a03cbc6c2b0548e5144092e629 100644 GIT binary patch literal 210 zcmZ?ry~F?kWsK~ssK~sugB46Xpkh69KoE)oDvaZ-T* diff --git a/Fonts/XPChars/88.bmp b/Fonts/XPChars/88.bmp index 2d27ffc5327c814794aa06d511882e31260b13d8..eb224f113680a2d66cc5819e70a655ca1a70c72a 100644 GIT binary patch literal 314 zcmZ?rwPIud12Z700mN)T%nQVf3=%++fq?}o59Z(}RAk=56@c0Q|Nn=J!Pqbwq!Pvk t(m)Z>suaS3NFYlii(s$; D5hX#e From 63dd0b8131de106bb6f0806d5bc8dc5e76fecad8 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Tue, 7 Dec 2010 11:06:43 +0100 Subject: [PATCH 3/5] XPChars: Fix '3'. --- Fonts/XPChars/51.bmp | Bin 366 -> 366 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Fonts/XPChars/51.bmp b/Fonts/XPChars/51.bmp index 1116bbc54560d221d305908fe0b39b7ebc136dbd..1f3fad24cda219a753413db0d5959d7ab209a5af 100644 GIT binary patch delta 19 bcmaFI^p0sl Date: Wed, 8 Dec 2010 01:02:42 +0100 Subject: [PATCH 4/5] Simbadoc: Update documentation. --- Doc/sphinx/features/autoupdate.rst | 9 +++++---- Doc/sphinx/features/notwellknown.rst | 5 ++++- Doc/sphinx/features/scriptmanager.rst | 2 +- Doc/sphinx/gettingstarted.rst | 5 +++++ Doc/sphinx/mmlref/libmml.rst | 6 ++++++ Doc/sphinx/referencemml.rst | 5 +++++ Doc/sphinx/troubleshooting.rst | 2 +- Doc/sphinx/tutorial.rst | 2 ++ Doc/sphinx/whatsnew.rst | 18 ++---------------- Doc/sphinx/whysimba.rst | 6 +++++- 10 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 Doc/sphinx/mmlref/libmml.rst diff --git a/Doc/sphinx/features/autoupdate.rst b/Doc/sphinx/features/autoupdate.rst index c3fa80a..2d214ab 100644 --- a/Doc/sphinx/features/autoupdate.rst +++ b/Doc/sphinx/features/autoupdate.rst @@ -1,8 +1,9 @@ Updater in Simba ================ -A notice should appear in the Simba GUI, or you can alternatively -use Tools -> Update. - -Don't forget to restart Simba when it has been updated! +As soon as there is an update for Simba, an extra icon will appear in the icon +bar. If you click it, an update window will appear. Click *update* and Simba +will update itself. Note that you will have to restart Simba to use the updated +version. +Alternatively you can use Tools -> Update to update. diff --git a/Doc/sphinx/features/notwellknown.rst b/Doc/sphinx/features/notwellknown.rst index 125ab16..c7be836 100644 --- a/Doc/sphinx/features/notwellknown.rst +++ b/Doc/sphinx/features/notwellknown.rst @@ -1,10 +1,13 @@ Not Well Known Features ======================= +Simba has several features that are relatively unknown. +A few will be listed here. + Timestamped Writeln ------------------- -Simba can timestamp all your *writeln* calls. +Simba can timestamp all your debug. .. code-block:: pascal diff --git a/Doc/sphinx/features/scriptmanager.rst b/Doc/sphinx/features/scriptmanager.rst index 7668534..774bacb 100644 --- a/Doc/sphinx/features/scriptmanager.rst +++ b/Doc/sphinx/features/scriptmanager.rst @@ -2,4 +2,4 @@ Simba Script Manager ==================== Community-created scripts will be available for download from the -Script Manager. +Script Manager. The script manager will appear in release 1.0. diff --git a/Doc/sphinx/gettingstarted.rst b/Doc/sphinx/gettingstarted.rst index d576fb4..c3d5aed 100644 --- a/Doc/sphinx/gettingstarted.rst +++ b/Doc/sphinx/gettingstarted.rst @@ -60,6 +60,11 @@ This is the only supported way. You can simply do a svn checkout on the srl repository, but if you can do that, then you should be able to set up SRL yourself as well. +Setting up SRL 5 with Simba +--------------------------- + +This will follow later, upon SRL 5 release. (Which will be quite soon) + Installing scripts ------------------ diff --git a/Doc/sphinx/mmlref/libmml.rst b/Doc/sphinx/mmlref/libmml.rst new file mode 100644 index 0000000..b56fff6 --- /dev/null +++ b/Doc/sphinx/mmlref/libmml.rst @@ -0,0 +1,6 @@ +libMML +====== + +libMML is an effort to bring the entire MML to a single standalone library. + +MML usage will appear here soon. diff --git a/Doc/sphinx/referencemml.rst b/Doc/sphinx/referencemml.rst index 65d33c5..4598022 100644 --- a/Doc/sphinx/referencemml.rst +++ b/Doc/sphinx/referencemml.rst @@ -6,6 +6,10 @@ provide scripts with the required functionality, but also used to pick colours and select windows with Simba itself. The MML can run without any user interface. +There currently is an effort to create a standalone library of the MML; called +*libMML*. This way any application can just load the library and use the MML +functionality. + The MML is split up in "Core" classes and "Addon" classes. .. note:: @@ -20,3 +24,4 @@ The MML is split up in "Core" classes and "Addon" classes. mmlref/finder.rst mmlref/bitmap.rst mmlref/ocr.rst + mmlref/libmml diff --git a/Doc/sphinx/troubleshooting.rst b/Doc/sphinx/troubleshooting.rst index d6a054b..e2dc2e3 100644 --- a/Doc/sphinx/troubleshooting.rst +++ b/Doc/sphinx/troubleshooting.rst @@ -25,7 +25,7 @@ This means your settings.xml has become corrupt somehow, or Simba may not be able to create it. If a settings.xml exists in your Simba directory, you can delete it. (All your settings will be lost, but this shouldn't be a bug deal) -There is a bug report pending on this issue. +Note that this should no longer happen with Simba 750 and up. .. Anything else? diff --git a/Doc/sphinx/tutorial.rst b/Doc/sphinx/tutorial.rst index cbe3d56..04bf7cc 100644 --- a/Doc/sphinx/tutorial.rst +++ b/Doc/sphinx/tutorial.rst @@ -2,3 +2,5 @@ Tutorial ================= Complete tutorial. + +.. What should be in here in the first place? diff --git a/Doc/sphinx/whatsnew.rst b/Doc/sphinx/whatsnew.rst index 5861641..c0c1640 100644 --- a/Doc/sphinx/whatsnew.rst +++ b/Doc/sphinx/whatsnew.rst @@ -5,22 +5,8 @@ Currently Simba is still in its beta stages; this includes the documentation. You will probably notice some parts of the documentation aren't finished or are just plain missing. -So what's new in Simba? This documentation system. - Simba is being updated almost every day. To see changes as they are added, view http://git.villavu.com/?p=simba.git;a=summary. Each commit should be explained -tersely in one line, and the exact changes can be viewed with "commitdiff". This -is a very verbose list of changes, large features or changes will be listed below: - -Changelog for 715:: - - - Array Operator support. (=, <>, +) - - Foldable comments - - Add Disguise - - Add Status - - Add ClearDebugImg - - Add PosEx - - Add a new interpreter - - Fix Hypot - - Fix Extension Menu Checkbox +tersely in one line, and the exact changes can be viewed with "commitdiff". +A list of new features since 750 will show up here eventually. diff --git a/Doc/sphinx/whysimba.rst b/Doc/sphinx/whysimba.rst index a1ee8e3..6ca1a7c 100644 --- a/Doc/sphinx/whysimba.rst +++ b/Doc/sphinx/whysimba.rst @@ -64,6 +64,10 @@ some issues remain. The biggest issue is the interpreter that executes your program. It is an external component and does not play too well on Linux. Hopefully this will be improved upon soon. +There are plans on supporting interpreter for alternative languages such as +Python, these would largely resolve the current problems wit the PascalScript +interpreter on Linux/Mac. + Fast ~~~~ @@ -91,5 +95,5 @@ Well Documented ~~~~~~~~~~~~~~~ Simba is well documented. (You're looking the documentation right now...) -There is still stuff left to document but overall the documentation is pretty +There is still a lot left to document but overall the documentation is pretty good. From 8bd3fd16b9d85ee758f95a565ba275087b339f81 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Thu, 9 Dec 2010 13:14:12 +0100 Subject: [PATCH 5/5] pyMML: Patch by iluffsyeww for color.py --- Projects/libmml/pymml/mml/color.py | 185 +++++++++++++++++++++++++++-- 1 file changed, 176 insertions(+), 9 deletions(-) diff --git a/Projects/libmml/pymml/mml/color.py b/Projects/libmml/pymml/mml/color.py index bcc050d..5b2e5bf 100644 --- a/Projects/libmml/pymml/mml/color.py +++ b/Projects/libmml/pymml/mml/color.py @@ -30,8 +30,21 @@ class Color(object): """ self._mc = MC self._cli = cli - self._initialiseDLLFuncs() + self._initialise_dll_funcs() + def get(self, pt): + """ + Gets color at pt[0], pt[1]. + Yields integer. + """ + col = c_int(-1) + self._mc.dll.get_color(self._cli, pt[0], pt[1], byref(col)) + if col is RESULT_OK: + return col + elif ret is RESULT_ERROR: + raise ColorException(self._mc.get_last_error()) + return None + def find(self, box, color, tol = 0): """ find a color in a box, with a specific tolerance. @@ -53,7 +66,7 @@ class Color(object): return None - def findAll(self, box, color, tol = 0): + def find_all(self, box, color, tol = 0): """ find all colors in a box, with a specific tolerance. returned are all the matching points @@ -73,19 +86,173 @@ class Color(object): self._mc.free(ptr) return l - - def _initialiseDLLFuncs(self): + + def find_spiral(self, col, box, tol = 0): + """ + Find a color in a box, searching in the direction of a spiral, with a + specific tolerance. + Yields a tuple of x, y values of found color. + """ + x, y = (c_int(-1), c_int(-1)) + if tol is 0: + ret = self._mc.dll.find_color_spiral(self._cli, byref(x), byref(y), + col, *box) + else: + ret = self._mc.dll.find_color_spiral_tolerance(self._cli, byref(x), + byref(y), col, *box, + tol) + if ret is RESULT_OK: + return (x, y) + elif ret is RESULT_ERROR: + raise ColorException(self._mc.get_last_error()) + return None + + def find_area(self, col, box, min_a, tol = 0): + """ + Finds a colored area in box with min area min_a with a specific + tolerance. + Yields a tuple of x, y values of found area. + """ + x, y = (c_int(-1), c_int(-1)) + if tol is 0: + ret = self._mc.dll.find_colored_area(self._cli, byref(x), byref(y), + col, *box, min_a) + else: + ret = self._mc.dll.find_colored_area_tolerance(self._cli, byref(x), + byref(y), col, *box, + min_a, tol) + if ret is RESULT_OK: + return (x, y) + elif ret is RESULT_ERROR: + raise ColorException(self._mc.get_last_error()) + return None + + def count_color(self, count, col, box, tol = 0): + """ + Counts color col in box with tol. + Yields integer of count. + """ + count = 0 + if tol is 0: + ret = self._mc.dll.count_color(self._cli, count, col, *box) + else: + ret = self._mc.dll.count_color_tolerance(self._cli, count, col, + *box, tol) + if ret is RESULT_OK: + return count + elif ret is RESULT_ERROR: + raise ColorException(self._mc.get_last_error()) + return None + + def similar_colors(self, col1, col2, tol = 0): + """ + Compares col1 and col2 with tol. + Yields boolean + """ + ret = self._mc.dll.similar_colors(col1, col2, tol) + if ret is RESULT_OK: + return True + else: + return False + + def set_tolerance_speed(self, ncts = 0): + """ + Sets CTS to ncts. + """ + self._mc.dll.set_tolerance_speed(self._cli, ncts) + + def get_tolerance_speed(self): + """ + Gets CTS. + Yields CTS. + """ + self._mc.dll.get_tolerance_speed(self._cli, out_cts) + return out_cts + + def set_tolerance_speed_2_modifiers(self, hue = 0, sat = 0): + """ + Sets CTS2 modifiers with hue, sat. + """ + self._mc.dll.set_tolerance_speed_2_modifiers(self._cli, hue, sat) + + def get_tolerance_speed_2_modifiers(self): + """ + Gets CTS2 modifiers. + Yields tuple of hue and sat mods. + """ + self._mc.dll.get_tolerance_speed_2_modifiers(self._cli, h, s) + return (h, s) + + def _initialise_dll_funcs(self): self._mc.dll.find_color.restype = c_int self._mc.dll.find_color.argtypes = [c_ulong, PINTEGER, PINTEGER, c_int, - c_int, c_int, c_int, c_int] + c_int, c_int, c_int, c_int] + self._mc.dll.find_color_tolerance.restype = c_int self._mc.dll.find_color_tolerance.argtypes = [c_ulong, PINTEGER, - PINTEGER, c_int, c_int, c_int, c_int, c_int, c_int] + PINTEGER, c_int, c_int, + c_int, c_int, c_int, + c_int] + self._mc.dll.find_colors.restype = c_int self._mc.dll.find_colors.argtypes = [c_ulong, POINTER(PPOINT), - POINTER(c_int), c_int, c_int, c_int, c_int, c_int] + POINTER(c_int), c_int, c_int, + c_int, c_int, c_int] + self._mc.dll.find_colors_tolerance.restype = c_int self._mc.dll.find_colors_tolerance.argtypes = [c_ulong, - POINTER(PPOINT), POINTER(c_int), c_int, c_int, - c_int, c_int, c_int, c_int] + POINTER(PPOINT), + POINTER(c_int), c_int, + c_int, c_int, c_int, + c_int, c_int] + self._mc.dll.find_color_spiral.restype = c_int + self._mc.dll.find_color_spiral.argtypes = [c_ulong, PINTEGER, PINTEGER, + c_int, c_int, c_int, c_int, + c_int] + + self._mc.dll.find_color_spiral_tolerance.restype = c_int + self._mc.dll.find_color_spiral_tolerance.argtypes = [c_ulong, PINTEGER, + PINTEGER, c_int, + c_int, c_int, + c_int, c_int, + c_int] + + self._mc.dll.find_colored_area.restype = c_int + self._mc.dll.find_colored_area.argtypes = [c_ulong, PINTEGER, PINTEGER, + c_int, c_int, c_int, c_int, + c_int, c_int] + + self._mc.dll.find_colored_area_tolerance.restype = c_int + self._mc.dll.find_colored_area_tolerance.argtypes = [c_ulong, PINTEGER, + PINTEGER, c_int, + c_int, c_int, + c_int, c_int, + c_int, c_int] + + self._mc.dll.count_color.restype = c_int + self._mc.dll.count_color.argtypes = [c_ulong, PINTEGER, c_int, c_int, + c_int, c_int, c_int] + + self._mc.dll.count_color_tolerance.restype = c_int + self._mc.dll.count_color_tolerance.argtypes = [c_ulong, PINTEGER, + c_int, c_int, c_int, + c_int, c_int, c_int] + + self._mc.dll.similar_colors.restype = c_int + self._mc.dll.similar_colors.argtypes = [c_ulong, c_int, c_int, c_int] + + self._mc.dll.set_tolerance_speed.restype = c_int + self._mc.dll.set_tolerance_speed.argtypes = [c_ulong, c_int] + + self._mc.dll.get_tolerance_speed.restype = c_int + self._mc.dll.get_tolerance_speed.argtypes = [c_ulong, PINTEGER] + + self._mc.dll.set_tolerance_speed_2_modifiers.restype = c_int + self._mc.dll.set_tolerance_speed_2_modifiers.argtypes = [c_ulong, + c_int, c_int] + + self._mc.dll.get_tolerance_speed_2_modifiers.restype = c_int + self._mc.dll.get_tolerance_speed_2_modifiers.argtypes = [c_ulong, + PINTEGER, + PINTEGER] \ No newline at end of file