def update_photoshop_grps( self, refresh = False ): export_grps = [] export_list = utilities.load_json_file( GROUPS_LOCATION ) if refresh: self.group_table.setRowCount( 0 ) try: layer_grps = self.ps_app.ActiveDocument.LayerSets self.message_report( error_level = 0, message = "Exporter successfully connected to Photoshop!" ) if ( len( layer_grps ) > 0 ): for grp in layer_grps: grp_name = grp.Name if ( grp_name in export_list ): export_grps.append( grp_name ) if refresh: utilities.add_table_item( self.group_table, [grp_name] ) self.update_table() else: self.message_report( error_level = 1, message = "Can't find any Photoshop groups!" ) except: self.message_report( error_level = 1, message = "Make sure there is a Photoshop file is open!" ) return export_grps
def add_group ( self ): group_name = str( self.groupName_line.text() ) suffix_name = str( self.groupSuffix_line.text() ) if group_name != '': if suffix_name != '': utilities.add_table_item( self.group_list_table, [group_name, suffix_name] ) group_list = utilities.load_json_file( GROUPS_LOCATION ) group_list[group_name] = suffix_name utilities.write_json_file( GROUPS_LOCATION, group_list )
def update_photoshop_grps(self, refresh=False): export_grps = [] export_list = utilities.load_json_file(GROUPS_LOCATION) if refresh: self.group_table.setRowCount(0) try: layer_grps = self.ps_app.ActiveDocument.LayerSets self.message_report( error_level=0, message="Exporter successfully connected to Photoshop!") if (len(layer_grps) > 0): for grp in layer_grps: grp_name = grp.Name if (grp_name in export_list): export_grps.append(grp_name) if refresh: utilities.add_table_item(self.group_table, [grp_name]) self.update_table() else: self.message_report(error_level=1, message="Can't find any Photoshop groups!") except: self.message_report( error_level=1, message="Make sure there is a Photoshop file is open!") return export_grps
def load_group_list( self ): if os.path.exists( DATA_PATH ): group_list = utilities.load_json_file( GROUPS_LOCATION ) for group in group_list: utilities.add_table_item( self.group_list_table, [group, group_list[group]] )