Esempio n. 1
0
/* delete the property in the given device, including widgets and data structs.
 * when last property is deleted, delete the device too.
 * if no property name attribute at all, delete the whole device regardless.
 * return 0 if ok, else -1 with reason in errmsg[].
 */
int INDI::BaseClientQt::delPropertyCmd (XMLEle * root, char * errmsg)
{
    XMLAtt * ap;
    INDI::BaseDevice * dp;

    /* dig out device and optional property name */
    dp = findDev (root, 0, errmsg);
    if (!dp)
        return INDI_DEVICE_NOT_FOUND;

    dp->checkMessage(root);

    ap = findXMLAtt (root, "name");

    /* Delete property if it exists, otherwise, delete the whole device */
    if (ap)
    {
        INDI::Property * rProp = dp->getProperty(valuXMLAtt(ap));
        removeProperty(rProp);
        int errCode = dp->removeProperty(valuXMLAtt(ap), errmsg);

        return errCode;
    }
    // delete the whole device
    else
        return deleteDevice(dp->getDeviceName(), errmsg);
}
Esempio n. 2
0
void IndiGui::OnNewDeviceFromThread(wxThreadEvent& event)
{
    INDI::BaseDevice *dp = (INDI::BaseDevice *) event.GetExtraLong();
    //printf("newdevice from thread %s \n",dp->getDeviceName());
    wxString devname =  wxString::FromAscii(dp->getDeviceName());
    IndiDev *indiDev = new IndiDev();
    wxPanel *panel = new wxPanel(parent_notebook);
    indiDev->page = new wxNotebook(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP);
    wxBoxSizer *nb_sizer = new wxBoxSizer(wxVERTICAL);
    panel->SetSizer(nb_sizer);
    nb_sizer->Add(indiDev->page, 1,  wxEXPAND | wxALL);
    parent_notebook->AddPage(panel, devname);
    indiDev->dp = dp;
    devlist[devname] = indiDev;
    panel->Fit();
    sizer->Layout();
    Fit();
}