Пример #1
0
std::string
PyAxisTitles_ToString(const AxisTitles *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    if(atts->GetVisible())
        SNPRINTF(tmpStr, 1000, "%svisible = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%svisible = 0\n", prefix);
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "font.";
        str += PyFontAttributes_ToString(&atts->GetFont(), objPrefix.c_str());
    }
    if(atts->GetUserTitle())
        SNPRINTF(tmpStr, 1000, "%suserTitle = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%suserTitle = 0\n", prefix);
    str += tmpStr;
    if(atts->GetUserUnits())
        SNPRINTF(tmpStr, 1000, "%suserUnits = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%suserUnits = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%stitle = \"%s\"\n", prefix, atts->GetTitle().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sunits = \"%s\"\n", prefix, atts->GetUnits().c_str());
    str += tmpStr;
    return str;
}
Пример #2
0
static int
FontAttributes_print(PyObject *v, FILE *fp, int flags)
{
    FontAttributesObject *obj = (FontAttributesObject *)v;
    fprintf(fp, "%s", PyFontAttributes_ToString(obj->data, "").c_str());
    return 0;
}
Пример #3
0
std::string
PyFontAttributes_GetLogString()
{
    std::string s("FontAtts = FontAttributes()\n");
    if(currentAtts != 0)
        s += PyFontAttributes_ToString(currentAtts, "FontAtts.");
    return s;
}
Пример #4
0
static void
PyFontAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("FontAtts = FontAttributes()\n");
        s += PyFontAttributes_ToString(currentAtts, "FontAtts.");
        cb(s);
    }
}
Пример #5
0
PyObject *
FontAttributes_str(PyObject *v)
{
    FontAttributesObject *obj = (FontAttributesObject *)v;
    return PyString_FromString(PyFontAttributes_ToString(obj->data,"").c_str());
}