first commit
This commit is contained in:
		
							parent
							
								
									3936f652e9
								
							
						
					
					
						commit
						dd53c6a842
					
				
					 21 changed files with 116 additions and 114 deletions
				
			
		|  | @ -14,6 +14,7 @@ class SmileyLoader(util.Singleton): | |||
|     """ | ||||
| 
 | ||||
|     def __init__(self, settings): | ||||
|         SmileyLoader._instance = self | ||||
|         self._settings = settings | ||||
|         self._curr_pack = None  # current pack name | ||||
|         self._smileys = {}  # smileys dict. key - smiley (str), value - path to image (str) | ||||
|  | @ -33,7 +34,7 @@ class SmileyLoader(util.Singleton): | |||
|                     self._smileys = json.loads(fl.read()) | ||||
|                     fl.seek(0) | ||||
|                     tmp = json.loads(fl.read(), object_pairs_hook=OrderedDict) | ||||
|                 print 'Smiley pack {} loaded'.format(pack_name) | ||||
|                 print('Smiley pack {} loaded'.format(pack_name)) | ||||
|                 keys, values, self._list = [], [], [] | ||||
|                 for key, value in tmp.items(): | ||||
|                     value = self.get_smileys_path() + value | ||||
|  | @ -44,7 +45,7 @@ class SmileyLoader(util.Singleton): | |||
|             except Exception as ex: | ||||
|                 self._smileys = {} | ||||
|                 self._list = [] | ||||
|                 print 'Smiley pack {} was not loaded. Error: {}'.format(pack_name, ex) | ||||
|                 print('Smiley pack {} was not loaded. Error: {}'.format(pack_name, ex)) | ||||
| 
 | ||||
|     def get_smileys_path(self): | ||||
|         return util.curr_directory() + '/smileys/' + self._curr_pack + '/' | ||||
|  | @ -69,7 +70,7 @@ class SmileyLoader(util.Singleton): | |||
|         for i in range(len(arr)): | ||||
|             if arr[i] in self._smileys: | ||||
|                 file_name = self._smileys[arr[i]]  # image name | ||||
|                 arr[i] = u'<img title=\"{}\" src=\"{}\" />'.format(arr[i], file_name) | ||||
|                 arr[i] = '<img title=\"{}\" src=\"{}\" />'.format(arr[i], file_name) | ||||
|                 if file_name.endswith('.gif'):  # animated smiley | ||||
|                     edit.addAnimation(QtCore.QUrl(file_name), self.get_smileys_path() + file_name) | ||||
|         return ' '.join(arr) | ||||
|  | @ -85,6 +86,6 @@ def sticker_loader(): | |||
|     for key in keys: | ||||
|         path = d + key + '/' | ||||
|         files = filter(lambda f: f.endswith('.png'), os.listdir(path)) | ||||
|         files = map(lambda f: unicode(path + f), files) | ||||
|         files = map(lambda f: str(path + f), files) | ||||
|         result.extend(files) | ||||
|     return result | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 ingvar1995
						ingvar1995