Exemplo n.º 1
0
RheiaApplicationConfigurationDialog::RheiaApplicationConfigurationDialog(wxWindow* parent)
{
    RheiaConfigurationManager *cfg = RheiaProfileManager::Get()->GetActiveProfileManager();

    wxString resPath = RheiaStandardPaths::DataDirectoryGlobal();
    wxString xrcDialogName = _T("dlgEnvironmentSettings");

    wxXmlResource *myres = wxXmlResource::Get();

    if ( !myres->Load(resPath + _T("/resource.zip#zip:environement_dialog.xrc")) )
        wxMessageBox(_("Error loadding ressource") , _("Error") );

    myres->LoadDialog(this, parent, _T("dlgEnvironmentSettings"));

    int siz = cfg->ReadInt(_T("/environment/application_dialog/settings_size"), 80);

    wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
    m_lbImages = new wxImageList( siz , siz );
    lb->AssignImageList( m_lbImages );

    DoLoadConfigurationTools();
    // make sure everything is laid out properly
    GetSizer()->SetSizeHints(this);
    CentreOnParent();
}
Exemplo n.º 2
0
bool RheiaApplicationConfigurationDialog::AddPage( wxString name, RheiaConfigurationPanel* page )
{
    RheiaConfigurationPageInfoMap::iterator pit = m_pages.find(name);
    wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);

    if( pit != m_pages.end() )
        return false;

    RheiaConfigurationPageInfo info;
    info.page = page;
    info.title = name;

    wxString bmpBase = page->GetBitmapBaseName();
    RheiaConfigurationManager *cfg = RheiaProfileManager::Get()->GetActiveProfileManager();
    int siz = cfg->ReadInt(_T("/environment/application_dialog/settings_size"), 80);

    wxString path;
    path = bmpBase;
    wxBitmap bmpOn = RheiaLoadBitmap( path + wxString::Format( wxT("_%d.png") , siz ) );
    wxBitmap bmpOff = RheiaLoadBitmap( path + wxString::Format( wxT("_%d-off.png") , siz ) );

    int idxOn = m_lbImages->Add( bmpOn );
    int idxOff  = m_lbImages->Add( bmpOff );

    info.idxOn = idxOn;
    info.idxOff = idxOff;

    m_pages[name] = info;
    bool show = ( lb->GetPageCount() == 0 );

    lb->AddPage( page , name , show , idxOn );
    return true;
}
Exemplo n.º 3
0
RheiaHtmlLogger::RheiaHtmlLogger() :
    m_window(NULL)
{
    wxString path = RheiaStandardPaths::DataDirectoryUser( ) + wxT("/htmllog.html");
    RheiaConfigurationManager* cfg = RheiaManager::Get()->GetConfigurationManager( wxT("RheiaHtmlLogger") );
    path = cfg->Read( wxT("/default_file") , path );
    SetFile(path);
}
Exemplo n.º 4
0
PyConsole::PyConsole( RheiaManagedFrame* toplevel , wxWindow* parent ):
    RheiaBookPage(parent),
    m_parent(toplevel),
    m_context(NULL)
{
    RheiaPythonUtils::Get()->PythonInit();
    m_context = new PyContext;
    wxPanel::Create(parent,wxID_ANY);
    m_ID = wxNewId();

    m_nolines = 0;
    m_currentHistoryPos = 0;

    idSaveMe                = wxNewId();
    idSaveAs                = wxNewId();
    idCut                   = wxNewId();
    idCopy                  = wxNewId();
    idPaste                 = wxNewId();
    idDelete                = wxNewId();
    idSelectAll             = wxNewId();
    idSelectLine            = wxNewId();

    wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
    m_control = new wxSStyledTextCtrl( this, m_ID, wxPoint(10,10), wxSize(200,200), 0 );

    m_stdoutred = new wxSStreamToTextRedirector(m_control,wxSTD cout );
    m_stderrred = new wxSStreamToTextRedirector(m_control,wxSTD cerr );

    m_control->SetText(defText);
    int eof = m_control->GetLength();
    m_control->GotoPos(eof);
    m_control->AddText(wxT(">>> ")); 

    Reload();

    Registerevents();
    RegisterSTCEvents();

    RheiaConfigurationManager* cfg = RheiaManager::Get()->GetConfigurationManager(wxT("pyconsole"));
    m_history = cfg->ReadArrayString(wxT("/history"));
	wxString res;

    sizer->Add( m_control, 1, wxEXPAND | wxALL, 5 );
    this->SetSizer( sizer );
    this->Layout();
}
Exemplo n.º 5
0
void RheiaTextLogger::UpdateSettings()
{
    RheiaConfigurationManager* cfg = RheiaManager::Get()->GetConfigurationManager( wxT("RheiaTextLogger") );
    bool isFirstTime = true;

    isFirstTime = (bool) cfg->ReadInt( wxT("/first_time") , (int) true );

    if( isFirstTime )
    {
        int size = 10;
        wxFont default_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
        wxFont bold_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
        wxFont italic_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL);

        bold_font.SetWeight(wxFONTWEIGHT_BOLD);

        wxFont bigger_font(bold_font);
        bigger_font.SetPointSize(size + 1);

        wxFont small_font(default_font);
        small_font.SetPointSize(size - 4);

        for(unsigned int i = 0; i < (unsigned int) RheiaLogging::RheiaLogLevelNumber ; ++i)
        {
            m_textattr[i].SetFlags( wxTEXT_ATTR_FONT | wxTEXT_ATTR_ALIGNMENT );
            m_textattr[i].SetFont(default_font);
            m_textattr[i].SetAlignment(wxTEXT_ALIGNMENT_LEFT);
            m_textattr[i].SetTextColour(*wxBLACK);
            m_textattr[i].SetBackgroundColour(*wxWHITE);
        }

        m_textattr[RheiaLogging::warning].SetFont(italic_font);
        m_textattr[RheiaLogging::warning].SetTextColour(*wxBLUE);

        m_textattr[RheiaLogging::success].SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
        bigger_font.SetUnderlined(true);
        m_textattr[RheiaLogging::success].SetFont(bigger_font);
        m_textattr[RheiaLogging::success].SetTextColour(*wxBLUE);

        m_textattr[RheiaLogging::error].SetFont(bold_font);
        m_textattr[RheiaLogging::error].SetTextColour(*wxRED);

        m_textattr[RheiaLogging::fatalerror].SetFont(bold_font);
        m_textattr[RheiaLogging::fatalerror].SetTextColour(*wxWHITE);
        m_textattr[RheiaLogging::fatalerror].SetBackgroundColour(*wxRED);

        m_textattr[RheiaLogging::syserror].SetFont(bold_font);
        m_textattr[RheiaLogging::syserror].SetTextColour(*wxWHITE);
        m_textattr[RheiaLogging::syserror].SetBackgroundColour(*wxBLUE);

        m_textattr[RheiaLogging::info].SetFont(italic_font);

        m_textattr[RheiaLogging::status].SetFont(bold_font);
        m_textattr[RheiaLogging::status].SetTextColour(*wxGREEN);

        m_textattr[RheiaLogging::debug].SetFont(italic_font);
        m_textattr[RheiaLogging::debug].SetTextColour(*wxGREEN);

        m_textattr[RheiaLogging::trace].SetFont(italic_font);
        m_textattr[RheiaLogging::trace].SetTextColour(*wxGREEN);

        if( cfg != NULL )
        {
            cfg->Write( wxT("/message") , m_textattr[RheiaLogging::message] );
            cfg->Write( wxT("/warning") , m_textattr[RheiaLogging::warning] );
            cfg->Write( wxT("/success") , m_textattr[RheiaLogging::success] );
            cfg->Write( wxT("/error") , m_textattr[RheiaLogging::error] );
            cfg->Write( wxT("/fatalerror") , m_textattr[RheiaLogging::fatalerror] );
            cfg->Write( wxT("/info") , m_textattr[RheiaLogging::info] );
            cfg->Write( wxT("/status") , m_textattr[RheiaLogging::status] );
            cfg->Write( wxT("/syserror") , m_textattr[RheiaLogging::syserror] );
            cfg->Write( wxT("/debug") , m_textattr[RheiaLogging::debug] );
            cfg->Write( wxT("/trace") , m_textattr[RheiaLogging::trace] );
            cfg->Write( wxT("/first_time") , (int) false );
        }

        return;
    }

    m_textattr[RheiaLogging::message] = cfg->ReadTextAttr( wxT("/message") );
    m_textattr[RheiaLogging::warning] = cfg->ReadTextAttr( wxT("/warning") );
    m_textattr[RheiaLogging::success] = cfg->ReadTextAttr( wxT("/success") );
    m_textattr[RheiaLogging::error] = cfg->ReadTextAttr( wxT("/error") );
    m_textattr[RheiaLogging::fatalerror] = cfg->ReadTextAttr( wxT("/fatalerror") );
    m_textattr[RheiaLogging::info] = cfg->ReadTextAttr( wxT("/info") );
    m_textattr[RheiaLogging::status] = cfg->ReadTextAttr( wxT("/status") );
    m_textattr[RheiaLogging::syserror] = cfg->ReadTextAttr( wxT("/syserror") );
    m_textattr[RheiaLogging::debug] = cfg->ReadTextAttr( wxT("/debug") );
    m_textattr[RheiaLogging::trace] = cfg->ReadTextAttr( wxT("/trace") );
}
Exemplo n.º 6
0
PyConsole::~PyConsole()
{
	//RheiaPythonUtils::Get()->PythonExit();
    RheiaConfigurationManager* cfg = RheiaManager::Get()->GetConfigurationManager(wxT("pyconsole"));
    cfg->Write(wxT("/history"),m_history);
}