11import os
22import glob
3+ import re
34import sys
45import codecs
56import platform
1314
1415from util_classes import ExistingProjectDialog
1516from util_classes import BackgroundThread , Validator
17+ from util_classes import CompleterLineEdit , TagsCompleter
1618
1719from PySide import QtGui , QtCore
1820from PySide .QtGui import (QApplication , QHBoxLayout , QVBoxLayout )
1921from PySide .QtNetwork import QHttp
20- from PySide .QtCore import QUrl , QFile , QIODevice , QCoreApplication
22+ from PySide .QtCore import Qt , QUrl , QFile , QIODevice , QCoreApplication
2123
2224from image_utils .pycns import pngs_from_icns
2325
@@ -46,6 +48,7 @@ def __init__(self, width, height, app, parent=None):
4648
4749 self .script_line = None
4850 self .output_line = None
51+ self .output_name_line = None
4952
5053 self .download_bar_widget = None
5154 self .app_settings_widget = None
@@ -814,6 +817,12 @@ def load_project(self, directory):
814817 script_setting = self .get_setting ('custom_script' )
815818 self .script_line .setText (script_setting .value )
816819
820+ output_name_setting = self .get_setting ('output_pattern' )
821+ self .output_name_line .setText (output_name_setting .value )
822+
823+ self .output_name_line .textChanged .connect (self .output_name_line .text_changed )
824+ self .output_name_line .textChanged .connect (self .completer .update )
825+
817826 self .set_window_icon ()
818827 self .open_export_button .setEnabled (True )
819828 self .update_json = True
@@ -906,25 +915,62 @@ def create_setting(self, name):
906915
907916 def create_window_settings (self ):
908917 group_box = QtGui .QWidget ()
909- vlayout = self .create_layout (self .settings ['order' ]['window_setting_order' ], cols = 3 )
918+ win_setting_order = self .settings ['order' ]['window_setting_order' ]
919+ vlayout = self .create_layout (win_setting_order , cols = 3 )
910920
911921 group_box .setLayout (vlayout )
912922 return group_box
913923
914924 def create_export_settings (self ):
915925 group_box = QtGui .QWidget ()
916- vlayout = self .create_layout (self .settings ['order' ]['export_setting_order' ], cols = 4 )
926+
927+ ex_setting_order = self .settings ['order' ]['export_setting_order' ]
928+
929+ vlayout = self .create_layout (ex_setting_order , cols = 4 )
930+
931+
932+ output_name_layout = QtGui .QHBoxLayout ()
933+
934+ output_name_setting = self .get_setting ('output_pattern' )
935+ output_name_label = QtGui .QLabel (output_name_setting .display_name + ':' )
936+ output_name_label .setMinimumWidth (155 )
937+
938+ tag_dict = self .get_tag_dict ()
939+ self .output_name_line = CompleterLineEdit (tag_dict )
940+
941+ completer = TagsCompleter (self .output_name_line , tag_dict )
942+ completer .setCaseSensitivity (Qt .CaseInsensitive )
943+
944+ completer .activated .connect (self .output_name_line .complete_text )
945+ self .completer = completer
946+ self .completer .setWidget (self .output_name_line )
947+
948+ self .output_name_line .textChanged .connect (
949+ self .call_with_object ('setting_changed' ,
950+ self .output_name_line ,
951+ output_name_setting )
952+ )
953+
954+ self .output_name_line .setStatusTip (output_name_setting .description )
955+
956+ output_name_layout .addWidget (output_name_label )
957+ output_name_layout .addWidget (self .output_name_line )
917958
918959 output_layout = QtGui .QHBoxLayout ()
919960
920- output_label = QtGui .QLabel ('Output Directory:' )
921- output_label .setMinimumWidth (150 )
961+ ex_dir_setting = self .get_setting ('export_dir' )
962+ output_label = QtGui .QLabel (ex_dir_setting .display_name + ':' )
963+ output_label .setMinimumWidth (155 )
922964 self .output_line = QtGui .QLineEdit ()
923- self .output_line .textChanged .connect (self .call_with_object ('setting_changed' ,
924- self .output_line ,
925- self .get_setting ('export_dir' )))
965+
966+ self .output_line .textChanged .connect (
967+ self .call_with_object ('setting_changed' ,
968+ self .output_line ,
969+ ex_dir_setting )
970+ )
971+
926972 self .output_line .textChanged .connect (self .project_path_changed )
927- self .output_line .setStatusTip ('The output directory relative to the project directory.' )
973+ self .output_line .setStatusTip (ex_dir_setting . description )
928974 output_button = QtGui .QPushButton ('...' )
929975 output_button .clicked .connect (self .browse_out_dir )
930976
@@ -934,19 +980,20 @@ def create_export_settings(self):
934980
935981 script_layout = QtGui .QHBoxLayout ()
936982
937- script_label = QtGui .QLabel ('Execute Script:' )
938- script_label .setMinimumWidth (150 )
983+ script_setting = self .get_setting ('custom_script' )
984+ script_label = QtGui .QLabel (script_setting .display_name + ':' )
985+ script_label .setMinimumWidth (155 )
939986
940987 self .script_line = QtGui .QLineEdit ()
941988
942- script_setting = self .get_setting ('custom_script' )
943989 self .script_line .setObjectName (script_setting .name )
944990
945- self .script_line .textChanged .connect (self .call_with_object ('setting_changed' ,
946- self .script_line ,
947- script_setting ))
948- self .script_line .setStatusTip ('The script to execute after a '
949- 'project was successfully exported.' )
991+ self .script_line .textChanged .connect (
992+ self .call_with_object ('setting_changed' ,
993+ self .script_line ,
994+ script_setting )
995+ )
996+ self .script_line .setStatusTip (script_setting .description )
950997 script_button = QtGui .QPushButton ('...' )
951998
952999 file_types = ['*.py' ]
@@ -956,15 +1003,20 @@ def create_export_settings(self):
9561003 else :
9571004 file_types .append ('*.bash' )
9581005
959- script_button .clicked .connect (self .call_with_object ('get_file_reg' ,
960- self .script_line , script_setting ,
961- ' ' .join (file_types )))
1006+ script_button .clicked .connect (
1007+ self .call_with_object ('get_file_reg' ,
1008+ self .script_line ,
1009+ script_setting ,
1010+ ' ' .join (file_types ))
1011+ )
1012+
9621013 script_layout .addWidget (script_label )
9631014 script_layout .addWidget (self .script_line )
9641015 script_layout .addWidget (script_button )
9651016
9661017 vbox = QtGui .QVBoxLayout ()
9671018 vbox .addLayout (vlayout )
1019+ vbox .addLayout (output_name_layout )
9681020 vbox .addLayout (output_layout )
9691021 vbox .addLayout (script_layout )
9701022
@@ -1321,7 +1373,7 @@ def show_and_raise(self):
13211373 self .existing_dialog .raise_ ()
13221374
13231375
1324- if __name__ == '__main__' :
1376+ def main () :
13251377 app = QApplication (sys .argv )
13261378
13271379 QCoreApplication .setApplicationName ("Web2Executable" )
@@ -1333,3 +1385,6 @@ def show_and_raise(self):
13331385 frame .show_and_raise ()
13341386
13351387 sys .exit (app .exec_ ())
1388+
1389+ if __name__ == '__main__' :
1390+ main ()
0 commit comments