Beispiel #1
0
 def _postOrSchedule(self, severity, message):
     '''If the caller is not in our thread, we'll schedule to post
     the message later'''
     if self._isMainThread():
         vim_helpers.postVimInfo(message)
     else:
         self._ui_msg_queue.put({'type' : severity, 'text' : message})
Beispiel #2
0
 def postQueuedMessages(self):
     '''Because Vim doesn't allows commands from non-GUI threads,
     we enqueue messages generated by background threads and post
     them whenever Vim is ready'''
     while not self._ui_msg_queue.empty():
         msg = self._ui_msg_queue.get()
         if msg['type'] == 'info':
             vim_helpers.postVimInfo(msg['text'])
         elif msg['type'] == 'warning':
             vim_helpers.postVimWarning(msg['text'])
         elif msg['type'] == 'error':
             vim_helpers.postVimError(msg['text'])
Beispiel #3
0
    def rebuildProject(self):
        "Rebuilds the current project"
        vim_helpers.postVimInfo("Rebuilding project...")
        project_file = vim_helpers.getProjectFile()
        request = RequestProjectRebuild(host=self._host, port=self._port,
                                        project_file=project_file)

        response = request.sendRequest()

        if response is None:
            return "hdlcc server is not running"

        self._logger.info("Response: %s", repr(response))
Beispiel #4
0
 def _postQueuedMessages(self):
     "Empty our queue in a single message"
     while not self._ui_queue.empty():
         messages = self._ui_queue.get()
         for severity, message in messages.json().get('ui_messages', []):
             if severity == 'info':
                 vim_helpers.postVimInfo(message)
             elif severity == 'warning':
                 vim_helpers.postVimWarning(message)
             elif severity == 'error':
                 vim_helpers.postVimError(message)
             else:
                 vim_helpers.postVimError(
                     "Unknown severity '%s' for message '%s'" %
                     (severity, message))
Beispiel #5
0
 def _postQueuedMessages(self):
     """
     Empty our queue in a single message
     """
     while not self._ui_queue.empty():
         messages = self._ui_queue.get()
         for severity, message in messages.json().get('ui_messages', []):
             if severity == 'info':
                 vim_helpers.postVimInfo(message)
             elif severity == 'warning':
                 self._postWarning(message)
             elif severity == 'error':
                 self._postError(message)
             else:
                 vim_helpers.postVimError(
                     "Unknown severity '%s' for message '%s'" %
                     (severity, message))
Beispiel #6
0
    def rebuildProject(self):
        """
        Rebuilds the current project
        """
        if vim.eval('&filetype') not in ('vhdl', 'verilog', 'systemverilog'):
            vim_helpers.postVimWarning("Not a VHDL file, can't rebuild")
            return

        vim_helpers.postVimInfo("Rebuilding project...")
        project_file = vim_helpers.getProjectFile()
        request = RequestProjectRebuild(project_file=project_file)

        response = request.sendRequest()

        if response is None:
            return "hdlcc server is not running"

        self._logger.info("Response: %s", repr(response))
Beispiel #7
0
 def test():
     vim_helpers.postVimInfo("Some info")
     vim.command.assert_called_with(
         "redraw | echom 'Some info' | echohl None")
Beispiel #8
0
 def test():
     vim_helpers.postVimInfo("Some info")
     vim.command.assert_called_with(
         "redraw | echom 'Some info' | echohl None")