Tools/TRSingleApplication.py

changeset 500
c3abc7895a01
parent 428
58405c24aa09
child 791
9ec2ac20e54e
equal deleted inserted replaced
499:622ab17a68d5 500:c3abc7895a01
7 Module implementing the single application server and client. 7 Module implementing the single application server and client.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt4.QtCore import SIGNAL 12 from PyQt4.QtCore import pyqtSignal
13 13
14 from Utilities.SingleApplication import SingleApplicationClient, SingleApplicationServer 14 from Utilities.SingleApplication import SingleApplicationClient, SingleApplicationServer
15 15
16 ########################################################################### 16 ###########################################################################
17 # define some module global stuff 17 # define some module global stuff
26 class TRSingleApplicationServer(SingleApplicationServer): 26 class TRSingleApplicationServer(SingleApplicationServer):
27 """ 27 """
28 Class implementing the single application server embedded within the 28 Class implementing the single application server embedded within the
29 Translations Previewer. 29 Translations Previewer.
30 30
31 @signal loadForm(fname) emitted to load a form file 31 @signal loadForm(str) emitted to load a form file
32 @signal loadTranslation(fname, first) emitted to load a translation file 32 @signal loadTranslation(str, bool) emitted to load a translation file
33 """ 33 """
34 loadForm = pyqtSignal(str)
35 loadTranslation = pyqtSignal(str, bool)
36
34 def __init__(self, parent): 37 def __init__(self, parent):
35 """ 38 """
36 Constructor 39 Constructor
37 40
38 @param parent parent widget (QWidget) 41 @param parent parent widget (QWidget)
61 Private method used to handle the "Load Form" command. 64 Private method used to handle the "Load Form" command.
62 65
63 @param fnames filenames of the forms to be loaded (list of strings) 66 @param fnames filenames of the forms to be loaded (list of strings)
64 """ 67 """
65 for fname in fnames: 68 for fname in fnames:
66 self.emit(SIGNAL('loadForm'), fname) 69 self.loadForm.emit(fname)
67 70
68 def __saLoadTranslation(self, fnames): 71 def __saLoadTranslation(self, fnames):
69 """ 72 """
70 Private method used to handle the "Load Translation" command. 73 Private method used to handle the "Load Translation" command.
71 74
72 @param fnames filenames of the translations to be loaded (list of strings) 75 @param fnames filenames of the translations to be loaded (list of strings)
73 """ 76 """
74 first = True 77 first = True
75 for fname in fnames: 78 for fname in fnames:
76 self.emit(SIGNAL('loadTranslation'), fname, first) 79 self.loadTranslation.emit(fname, first)
77 first = False 80 first = False
78 81
79 class TRSingleApplicationClient(SingleApplicationClient): 82 class TRSingleApplicationClient(SingleApplicationClient):
80 """ 83 """
81 Class implementing the single application client of the Translations Previewer. 84 Class implementing the single application client of the Translations Previewer.

eric ide

mercurial