本文整理汇总了Python中Messages类的典型用法代码示例。如果您正苦于以下问题:Python Messages类的具体用法?Python Messages怎么用?Python Messages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Messages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnModify
def OnModify(self, event):
if self.selected == None:
Messages.messageError('No se ha seleccionado ningun servidor', 'Modificar configuracion')
else:
NewConfigurationWindow.showModifWindow(self)
event.Skip()
示例2: __init__
def __init__(self, file_paths, platform):
"""
ActionHandler constructor.
Create the main window, setup the message handler, import the preferences,
and connect all of the action handlers. Finally, enter the gtk main loop and block.
@param file_paths a list of flow graph file passed from command line
@param platform platform module
"""
self.clipboard = None
for action in Actions.get_all_actions(): action.connect('activate', self._handle_action)
#setup the main window
self.main_window = MainWindow(platform)
self.main_window.connect('delete-event', self._quit)
self.main_window.connect('key-press-event', self._handle_key_press)
self.get_page = self.main_window.get_page
self.get_flow_graph = self.main_window.get_flow_graph
self.get_focus_flag = self.main_window.get_focus_flag
#setup the messages
Messages.register_messenger(self.main_window.add_report_line)
Messages.send_init(platform)
#initialize
self.init_file_paths = file_paths
Actions.APPLICATION_INITIALIZE()
#enter the mainloop
gtk.main()
示例3: _gotShortHandshake
def _gotShortHandshake(self, connId, connSet):
success = False
data = ''.join(connSet['inBuffer'])
connSet['inBuffer'] = [data]
#decode handshake
length, proto, reserved, infohash = Messages.decodeShortHandshake(data)
if not proto.lower()=='bittorrent protocol':
#invalid handshake, close conn
self._closeConn(connId, 'received invalid handshake')
elif not infohash in self.torrents:
#invalid handshake, close conn
self._closeConn(connId, 'received handshake with unknown infohash')
else:
#valid handshake
connSet['torrentIdent'] = self.torrents[infohash]
if self.peerPool.establishedConnection(connSet['torrentIdent'], connSet['sock'].getpeername()):
#no connection to this address exists up to now
success = True
connSet['added'] = True
self.log.info("Conn %d: Got valid handshake, sending response", connId)
connSet['sock'].send(Messages.generateHandshake(infohash, self.peerId))
else:
#we already have a connection to this address
self._closeConn(connId, 'we already have a connection to this address')
return success
示例4: OnTestConfig
def OnTestConfig(self, event):
message = Utils.setParams(self)
if message != None:
Messages.messageError(message, 'Probar')
else:
if sap.testServerConfig(*self.params):
Messages.messageInformation('La configuracion es correcta, ahora puede guardar', 'Probar configuracion')
event.Skip()
示例5: OnExecute
def OnExecute(self, event):
ix = self.choice.GetCurrentSelection()
if ix < 0:
Messages.messageError('Select a SAP Server', 'Execute ABAP Code')
else:
result = sap.executeCode(self.servers[ix], self.parent.code )
self.parent.outtext.SetValue(result)
示例6: cancelRequestFor
def cancelRequestFor(self,piece_index,block_index):
if((piece_index,block_index) in self.set_of_blocks_requested):
self.set_of_blocks_requested.remove((piece_index,block_index))
begin = block_index*BLOCK_SIZE
piece_index = Messages.number_to_bytes(piece_index)
begin = Messages.number_to_bytes(block_index)
length = Messages.number_to_bytes(BLOCK_SIZE)
self.transport.write(str(Messages.Cancel(index = piece_index, begin = begin, length = length)))
示例7: OnDelete
def OnDelete(self, event):
if self.selected == None:
Messages.messageError('No se ha seleccionado ningun servidor', 'Eliminar configuracion')
else:
ret = Messages.messageChoice('Realmente desea eliminar la configuracion?', 'Eliminar configuracion')
if ret == wx.ID_YES:
if db.deleteConfig(self.sel_text):
self.list.DeleteItem(self.selected)
event.Skip()
示例8: _setLocalInterest
def _setLocalInterest(self, value):
if value == False and self.localInterest == True:
# changing to negative, we were interested before
assert self._amountOfInRequests() == 0, "Local Requests are running and we are not interested?"
# self._cancelAllInRequests()
self._queueSend(Messages.generateNotInterested())
self.localInterest = value
elif value == True and self.localInterest == False:
self._queueSend(Messages.generateInterested())
self.localInterest = value
示例9: _setLocalChoke
def _setLocalChoke(self, value):
if value == True and self.localChoke == False:
# choking
self._delAllOutRequests()
self._queueSend(Messages.generateChoke())
self.localChoke = value
elif value == False and self.localChoke == True:
self._queueSend(Messages.generateUnChoke())
self.localChoke = value
示例10: _clearJVMOutputFiles
def _clearJVMOutputFiles(self):
"""
Clears JVM output files.
"""
try:
open(self._globJVMOutPath, 'w').close()
open(self._globJVMErrPath, 'w').close()
except:
Messages.warning(__name__, "Cannot remove JVM output files!", verbose=2)
示例11: OnSave
def OnSave(self, event):
message = Utils.setParams(self)
if message != None:
Messages.messageError(message, 'Guardar')
else:
r = db.saveServerConfig(*self.params)
if r:
for field, label in self.fields:
field.SetValue('')
event.Skip()
示例12: requestMessages
def requestMessages(self, user_id):
user = Users.getUser(user_id)
c.log('info', 'Requesting messages for user %s %s %s' % (user_id, user['data']['first_name'], user['data']['last_name']))
if user_id not in self.data:
self.data[user_id] = {
'id' : user_id,
'log' : []
}
Messages.requestMessages({'user_id': user_id}, self.data[user_id])
示例13: _deleteJVMOutputFiles
def _deleteJVMOutputFiles(self):
"""
Deletes JVM output files.
"""
try:
IO.removeFile(self._globJVMOutPath)
IO.removeFile(self._globJVMErrPath)
except:
Messages.warning(__name__, "Cannot remove JVM output files!", verbose=2)
示例14: write
def write(self):
#do throttle warning
throttled = any(map(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks()))
if not throttled and self._generate_options != 'hb':
Messages.send_warning('''\
This flow graph may not have flow control: no audio or usrp blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
#generate
open(self.get_file_path(), 'w').write(str(self))
if self._generate_options == 'hb':
#convert hier block to xml wrapper
convert_hier.convert_hier(self._flow_graph, self.get_file_path())
os.chmod(self.get_file_path(), self._mode)
示例15: __shutdownJVM
def __shutdownJVM(self):
"""
Shuts down the Java Virtual Machine
"""
if self._globJVMOn:
jpype.shutdownJVM()
self._globJVMOn = False
self._globJVMSymm = None
Messages.log(__name__, "JVM shut down!", verbose=1)
self._deleteJVMOutputFiles()