Advertisement
atm-irbis

Icont GUI frontend

Aug 27th, 2012
826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Unicon 10.54 KB | None | 0 0
  1. import gui
  2. $include "guih.icn"
  3. # основной класс фронтэнда. благодаря наличию откровенно убойной логики,этот класс наследуется от диалогового
  4. # окна. Хотя тут все окна такие!
  5. class GIF : Dialog(check_box_1, label_1, label_2, text_button_1, text_button_2, text_button_3, text_field_1, text_field_2)
  6.    method component_setup()
  7.       self.setup()
  8.    end
  9.  
  10.    method end_dialog()
  11.    end
  12.  
  13. # отдаем команды в консоль для генерации программки, заодно проверяем установлен ли флажок upx
  14.    method exe_gen(ev)
  15.    src_path:=text_field_1.get_contents()
  16.    exe_path:=text_field_2.get_contents()
  17.    if upxed=0  then compile(src_path,exe_path) else {
  18.    compile(src_path,exe_path)
  19.    system("C:\WINICON\\BIN\\upx.exe -9 " || exe_path)
  20. }
  21.    end
  22.  
  23.    method init_dialog()
  24.    end
  25.  
  26. # генерируем ucode, который будет размещен в той же (!) папке что и исходник
  27.    method ucode_gen(ev)
  28.    ucode_path:=text_field_1.get_contents()
  29.    system("wicont -c " || ucode_path)
  30.    end
  31.  
  32. # запускаем наш Icon-суррогат
  33.    method exe_run(ev)
  34.     src_path:=text_field_1.get_contents()
  35.     system("wicont -s " || src_path || " -x")  
  36.    end
  37.  
  38. # установка флажка upx
  39.    method upx_flag(ev)
  40.    if check_box_1.is_checked() then upxed:=0 else upxed:=1
  41.    end
  42.  
  43. # закрыть окно
  44.    method on_close(ev)
  45.    dispose()
  46.    end
  47.  
  48. # параметризируем (настраиваем то есть) интерфейс и его базовые элементы
  49.    method setup()
  50.       self.set_attribs("size=548,257","label=Icont graphical frontend")
  51.       self.set_min_size(300, 300)
  52.       text_field_1 := TextField()
  53.       text_field_1.set_pos("16", "43")
  54.       text_field_1.set_size("513", "28")
  55.       text_field_1.set_draw_border()
  56.       text_field_1.set_contents("C:\\WINICON\\BIN\\")
  57.       self.add(text_field_1)
  58.       check_box_1 := CheckBox()
  59.       check_box_1.set_pos("19", "163")
  60.       check_box_1.connect(self, "upx_flag", MOUSE_PRESS_EVENT)
  61.       check_box_1.set_toggles()
  62.       check_box_1.set_label("Compress with UPX")
  63.       self.add(check_box_1)
  64.       text_button_1 := TextButton()
  65.       text_button_1.set_pos("343", "194")
  66.       text_button_1.connect(self, "exe_gen", BUTTON_PRESS_EVENT)
  67.       text_button_1.clear_toggles()
  68.       text_button_1.set_label("Create executable")
  69.       text_button_1.set_internal_alignment("c")
  70.       self.add(text_button_1)
  71.       text_field_2 := TextField()
  72.       text_field_2.set_pos("17", "112")
  73.       text_field_2.set_size("513", "28")
  74.       text_field_2.set_draw_border()
  75.       text_field_2.set_contents("C:\\")
  76.       self.add(text_field_2)
  77.       label_1 := Label()
  78.       label_1.set_pos("17", "17")
  79.       label_1.set_internal_alignment("l")
  80.       label_1.set_label("Path to Icon source file :")
  81.       self.add(label_1)
  82.       text_button_2 := TextButton()
  83.       text_button_2.set_pos("215", "194")
  84.       text_button_2.connect(self, "ucode_gen", BUTTON_PRESS_EVENT)
  85.       text_button_2.clear_toggles()
  86.       text_button_2.set_label("Generate ucode")
  87.       text_button_2.set_internal_alignment("c")
  88.       self.add(text_button_2)
  89.       text_button_3 := TextButton()
  90.       text_button_3.set_pos("493", "194")
  91.       text_button_3.connect(self, "exe_run", ACTION_EVENT)
  92.       text_button_3.clear_toggles()
  93.       text_button_3.set_label("Run")
  94.       text_button_3.set_internal_alignment("c")
  95.       self.add(text_button_3)
  96.       label_2 := Label()
  97.       label_2.set_pos("17", "85")
  98.       label_2.set_internal_alignment("l")
  99.       label_2.set_label("Path to executable file :")
  100.       self.add(label_2)
  101.       self.connect(self, "on_close", CLOSE_BUTTON_EVENT)
  102.    end
  103.  
  104.    initially
  105.       self.Dialog.initially()
  106. end
  107.  
  108. # запускаем !
  109. global upxed
  110. procedure main()
  111.    local d
  112.    upxed:=0
  113.    d := GIF()
  114.    d.show_modal()
  115. end
  116.  
  117.    procedure  compile (src,exe)
  118.    local cmd_line
  119.    cmd_line:="wicont -o " || exe || " " || src
  120.    system(cmd_line)  
  121.    end
  122.  
  123.  
  124. ### Ivib-v2 layout ##
  125. #class|Canvas|17|Name Table|table|integer|0|7|string|check_box|integer|
  126. #1|string|label|integer|2|string|menu|integer|1|string|menu_bar|integer
  127. #|1|string|text_button|integer|3|string|text_field|integer|2|string|tre
  128. #e|integer|1|SuperClass Name|string|Dialog|Import Name|string|gui|Butto
  129. #n Groups|class|ButtonGroupSet|2|Parent Canvas|1|Boxes|list|0|Checkbox
  130. #Groups|class|CheckBoxGroupSet|2|Parent Canvas|1|Boxes|list|0|Gen Inden
  131. #t|integer|3|Gen Main|integer|1|Gen Component Setup|integer|1|Gen Init
  132. #Dialog|integer|1|Gen Initially|integer|1|Dialog Struct|class|CDialog|4
  133. #|Min Width|integer|300|Min Height|integer|300|Ticker Rate|null|Attribs
  134. #|list|0|Name|string|Untitled|Width|integer|548|Height|integer|257|Item
  135. #s|list|8|class|CanvasTextField|27|Parent Canvas|1|Name|string|text_fie
  136. #ld_1|Class Name|string|TextField|Import Name|string|gui|X Fix|null|Y F
  137. #ix|null|W Fix|null|H Fix|null|W Default|null|H Default|null|X Spec|str
  138. #ing|16|Y Spec|string|43|W Spec|string|513|H Spec|string|28|X Align|str
  139. #ing|l|Y Align|string|t|Is shaded|null|Is Button Subclass|null|Draw Bor
  140. #der|integer|1|Attribs|list|0|Tooltip|null|Accel|null|Event Handlers|li
  141. #st|0|Class Variable|integer|1|Parent Component|1|Contents|string|C:\09
  142. #2WINICON\092BIN\092|Filter String|string||class|CanvasCheckBox|35|Pare
  143. #nt Canvas|1|Name|string|check_box_1|Class Name|string|CheckBox|Import
  144. #Name|string|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix|null|W Default|
  145. #integer|1|H Default|integer|1|X Spec|string|19|Y Spec|string|163|W Spe
  146. #c|integer|142|H Spec|integer|14|X Align|string|l|Y Align|string|t|Is s
  147. #haded|null|Is Button Subclass|integer|1|Draw Border|null|Attribs|list|
  148. #0|Tooltip|null|Accel|null|Event Handlers|list|1|list|2|string|MOUSE_PR
  149. #ESS_EVENT|string|upx_flag|Class Variable|integer|1|Parent Component|1|
  150. #Label|string|Compress with UPX|No Keyboard|null|Img Up|string|(0=shado
  151. #w;1=hilite;~=trans)13,c6,~~~~~~~~~~~~~~11111111111~~11111111110~~11~~~
  152. #~~~~00~~11~~~~~~~00~~11~~~~~~~00~~11~~~~~~~00~~11~~~~~~~00~~11~~~~~~~0
  153. #0~~11~~~~~~~00~~11000000000~~10000000000~~~~~~~~~~~~~~|Img Down|string
  154. #|(b=black;0=shadow;1=hilite;~=trans)13,c6,~~~~~~~~~~~~~~00000000001~~0
  155. #0000000001~~00~~~~~~~11~~00~bbbbb~11~~00~bbbbb~11~~00~bbbbb~11~~00~bbb
  156. #bb~11~~00~bbbbb~11~~00~~~~~~~11~~01111111111~~11111111111~~~~~~~~~~~~~
  157. #~|Img Width|integer|13|Img Height|integer|13|Is Checked Flag|null|Is C
  158. #heckbox Flag|integer|1|Parent CheckBoxGroup|null|Parent Button Group|n
  159. #ull|class|CanvasTextButton|36|Parent Canvas|1|Name|string|text_button_
  160. #1|Class Name|string|TextButton|Import Name|string|gui|X Fix|null|Y Fix
  161. #|null|W Fix|null|H Fix|null|W Default|integer|1|H Default|integer|1|X
  162. #Spec|string|343|Y Spec|string|194|W Spec|integer|135|H Spec|integer|24
  163. #|X Align|string|l|Y Align|string|t|Is shaded|null|Is Button Subclass|i
  164. #nteger|1|Draw Border|null|Attribs|list|0|Tooltip|null|Accel|null|Event
  165. # Handlers|list|1|list|2|string|BUTTON_PRESS_EVENT|string|exe_gen|Class
  166. # Variable|integer|1|Parent Component|1|Label|string|Create executable|
  167. #No Keyboard|null|Img Up|null|Img Down|null|Img Width|null|Img Height|n
  168. #ull|Is Checked Flag|null|Is Checkbox Flag|null|Parent CheckBoxGroup|nu
  169. #ll|Parent Button Group|null|Internal Align|string|c|class|CanvasTextFi
  170. #eld|27|Parent Canvas|1|Name|string|text_field_2|Class Name|string|Text
  171. #Field|Import Name|string|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix|nu
  172. #ll|W Default|null|H Default|null|X Spec|string|17|Y Spec|string|112|W
  173. #Spec|string|513|H Spec|string|28|X Align|string|l|Y Align|string|t|Is
  174. #shaded|null|Is Button Subclass|null|Draw Border|integer|1|Attribs|list
  175. #|0|Tooltip|null|Accel|null|Event Handlers|list|0|Class Variable|intege
  176. #r|1|Parent Component|1|Contents|string|C:\092|Filter String|string||cl
  177. #ass|CanvasLabel|27|Parent Canvas|1|Name|string|label_1|Class Name|stri
  178. #ng|Label|Import Name|string|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix
  179. #|null|W Default|integer|1|H Default|integer|1|X Spec|string|17|Y Spec|
  180. #string|17|W Spec|integer|182|H Spec|integer|14|X Align|string|l|Y Alig
  181. #n|string|t|Is shaded|null|Is Button Subclass|null|Draw Border|null|Att
  182. #ribs|list|0|Tooltip|null|Accel|null|Event Handlers|list|0|Class Variab
  183. #le|integer|1|Parent Component|1|Label|string|Path to Icon source file
  184. #:|Internal Align|string|l|class|CanvasTextButton|36|Parent Canvas|1|Na
  185. #me|string|text_button_2|Class Name|string|TextButton|Import Name|strin
  186. #g|gui|X Fix|null|Y Fix|null|W Fix|null|H Fix|null|W Default|integer|1|
  187. #H Default|integer|1|X Spec|string|215|Y Spec|string|194|W Spec|integer
  188. #|114|H Spec|integer|24|X Align|string|l|Y Align|string|t|Is shaded|nul
  189. #l|Is Button Subclass|integer|1|Draw Border|null|Attribs|list|0|Tooltip
  190. #|null|Accel|null|Event Handlers|list|1|list|2|string|BUTTON_PRESS_EVEN
  191. #T|string|ucode_gen|Class Variable|integer|1|Parent Component|1|Label|s
  192. #tring|Generate ucode|No Keyboard|null|Img Up|null|Img Down|null|Img Wi
  193. #dth|null|Img Height|null|Is Checked Flag|null|Is Checkbox Flag|null|Pa
  194. #rent CheckBoxGroup|null|Parent Button Group|null|Internal Align|string
  195. #|c|class|CanvasTextButton|36|Parent Canvas|1|Name|string|text_button_3
  196. #|Class Name|string|TextButton|Import Name|string|gui|X Fix|null|Y Fix|
  197. #null|W Fix|null|H Fix|null|W Default|integer|1|H Default|integer|1|X S
  198. #pec|string|493|Y Spec|string|194|W Spec|integer|37|H Spec|integer|24|X
  199. # Align|string|l|Y Align|string|t|Is shaded|null|Is Button Subclass|int
  200. #eger|1|Draw Border|null|Attribs|list|0|Tooltip|null|Accel|null|Event H
  201. #andlers|list|1|list|2|string|ACTION_EVENT|string|exe_run|Class Variabl
  202. #e|integer|1|Parent Component|1|Label|string|Run|No Keyboard|null|Img U
  203. #p|null|Img Down|null|Img Width|null|Img Height|null|Is Checked Flag|nu
  204. #ll|Is Checkbox Flag|null|Parent CheckBoxGroup|null|Parent Button Group
  205. #|null|Internal Align|string|c|class|CanvasLabel|27|Parent Canvas|1|Nam
  206. #e|string|label_2|Class Name|string|Label|Import Name|string|gui|X Fix|
  207. #null|Y Fix|null|W Fix|null|H Fix|null|W Default|integer|1|H Default|in
  208. #teger|1|X Spec|string|17|Y Spec|string|85|W Spec|integer|175|H Spec|in
  209. #teger|14|X Align|string|l|Y Align|string|t|Is shaded|null|Is Button Su
  210. #bclass|null|Draw Border|null|Attribs|list|0|Tooltip|null|Accel|null|Ev
  211. #ent Handlers|list|0|Class Variable|integer|1|Parent Component|1|Label|
  212. #string|Path to executable file :|Internal Align|string|l|Initial Focus
  213. #|null|Event Handlers|list|1|list|2|string|CLOSE_BUTTON_EVENT|string|on
  214. #_Untitled|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement