Example #1
0
// Show message
std::ostream& operator << (std::ostream& o, XmippError& xe)
{
    String error = formatString("XMIPP_ERROR %d: %s", xe.__errno, xe.getDefaultMessage().c_str());
    o << colorString(error.c_str(), RED) << std::endl;
    o << colorString(xe.msg.c_str(), RED) << std::endl;
    error = formatString("File: %s line: %ld", xe.file.c_str(), xe.line);
    o << colorString(error.c_str(), RED) << std::endl;
    return o;
}
Example #2
0
void ChatView::renderMessage(const MessageView &mv)
{
	QString timestr = formatTimeStamp(mv.dateTime());
	QString color = colorString(mv.isLocal(), mv.isSpooled());
	if (useMessageIcons_ && mv.isAwaitingReceipt()) {
		document()->addResource(QTextDocument::ImageResource, QUrl(QString("icon:delivery") + mv.messageId()), logIconSend);
	}
	QString icon = useMessageIcons_?
		(QString("<img src=\"%1\" />").arg(mv.isLocal()?
		(mv.isAwaitingReceipt()?QString("icon:delivery") + mv.messageId():"icon:log_icon_send"):"icon:log_icon_receive")):"";
	if (mv.isEmote()) {
		appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(TextUtil::escape(mv.nick())) + mv.formattedText() + "</span>");
	} else {
		if (PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
			appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1] ").arg(timestr) + tr("%1 says:").arg(TextUtil::escape(mv.nick())) + "</span><br>" + mv.formattedText());
		}
		else {
			appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1] &lt;").arg(timestr) + TextUtil::escape(mv.nick()) + QString("&gt;</span> ") + mv.formattedText());
		}
	}

	if (mv.isLocal()) {
		deferredScroll();
	}
}
Example #3
0
PyObject *
xmipp_colorStr(PyObject *obj, PyObject *args)
{
    char *str;
    int color;
    int attrib = BRIGHT;
    if (PyArg_ParseTuple(args, "is|i", &color, &str, &attrib))
    {
        String labelStr = colorString(str, color, attrib);
        return PyString_FromString(labelStr.c_str());
    }
    return NULL;
}
Example #4
0
// Object Constructor
XmippError::XmippError(const ErrorType nerr, const String &what,
                       const String &fileArg, const long lineArg)
{
    __errno = nerr;
    msg = colorString(what.c_str(), RED);
    file = fileArg;
    line = lineArg;
    char* path = getenv("XMIPP_DEBUG");
    if (path != NULL)
        std::cout << "XMIPP_DEBUG: " << getMessage() << std::endl;

    //Store information about the stack calls
//#ifdef LINUX
//    void *array[10];
//    size = backtrace(array, 10);
//    strings = backtrace_symbols(array, size);
//#endif
}
Example #5
0
void reportWarning(const String& what)
{
    String error = formatString("=== XMIPP_WARNING ===\n%s", what.c_str());
    std::cerr << colorString(error.c_str(), MAGENTA) << std::endl;
}