本文整理汇总了Python中Settings.Settings.reload方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.reload方法的具体用法?Python Settings.reload怎么用?Python Settings.reload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.reload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Stabilizer
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import reload [as 别名]
class Stabilizer(QApplication):
def __init__(self):
QApplication.__init__(self, sys.argv, True)
# ** All persistent settings need to be put in here **
self.settings = Settings({
# Counter clockwise order starting at instrument 0 (from visualizer's point of view)
'instrument_order' : ['tim','daniel','sus','dom','kacper','panos','tadeo','wallace']
}, log_function=lambda x, module="Settings": self.log(x, module))
self.event_log = ListModel(deque(maxlen=1000))
self.dispatcher = ThreadDispatcher(self)
self.dispatcher.start()
# OSC input
self.osc_receiver = dispatch.Receiver()
self.osc_receiver.fallback = self.osc_message_callback
self.is_listening = False
self._input_socket = None
# OSC output over UDP
self.osc_sender = async.DatagramClientProtocol()
# defined in open_output_socket below
self._output_socket = None
# program state
# ** Non-persistent internal settings go here ** #
self.internal_settings = {
# Of form (host, port)
'visualizer_address' : None,
# For providing feedback in gui:
'calculated_instrument_order' : [],
'missing_instruments' : [],
'surplus_instruments' : [],
}
self.enable_log_incoming_messages = False
self.enable_log_outgoing_messages = False
self.aboutToQuit.connect(self.shutdown)
# for now just use dictionaries to represent states
# parameter -> { instrument -> value }
self.world_state = {}
# parameter -> { instrument -> converged_value }
self.converged_state = {}
# properties of an instrument:
# instrument -> { property -> value }
# also contains the state of the instrument:
# instrument -> { 'state' -> { parameter -> value } }
# instrument -> { 'address' -> (host, port) }
self.instruments = {}
# instrument -> { instrument -> connection_amount }
self.connections = {}
# State variables that are to be sent to the visualizer
# property -> value (where value is always a list)
self.visualizer_state = {
'connections' : self.connections,
'debug' : False,
}
self.settings.reload()
self.input_processor = InputProcessor(
self.world_state,
self.instruments,
self.internal_settings,
self.visualizer_state,
lambda message,module='InputProcessor': self.log(message, module))
self.connection_detector = ConnectionDetector(self.connections,
self.instruments)
self.convergence_manager = ConvergenceManager(
self.settings,
lambda message,module='ConvergenceManager': self.log(message, module),
self.world_state,
self.connections,
self.converged_state,
self.visualizer_state,
self,
)
self.output_processor = OutputProcessor(
self.converged_state,
self.instruments,
self.visualizer_state,
self.settings,
self.internal_settings,
self.convergence_manager,
self.send_osc,
lambda message,module='OutputProcessor': self.log(message, module)
)
def shutdown(self):
self.log("Shutting down")
print("Stabilizer.shutdown()")
#.........这里部分代码省略.........