Esempio n. 1
0
int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);
    AOQPlotWindow window;
    bool wantHelp = false;
    for(int i=1; i<argc; ++i)
    {
        if(argv[i][0]=='-') wantHelp = true;
    }
    if(wantHelp)
    {
        std::cout << "Syntax: aoqplot [<observation>]\n\n"
                  "If your observation consists of a single observation, specify a measurement\n"
                  "set. To get statistics for a (remote) observation consisting of multiple measurement\n"
                  "sets, specify a measurement set specifier instead (generally a .ref, .vds\n"
                  ".gvds or .gds file).\n\n"
                  "aoqplot is part of the AOFlagger software package, written\n"
                  "by André Offringa ([email protected]).\n";
    }
    else {
        if(argc>1)
        {
            std::vector<std::string> files;
            for(int i=1; i!=argc; ++i)
                files.push_back(argv[i]);
            window.Open(files);
        } else {
            Gtk::FileChooserDialog fileDialog(window, "Open observation set");

            fileDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
            fileDialog.add_button("Open", Gtk::RESPONSE_OK);

            Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
            filter->set_name("Observation sets (*.{vds,gds,ref,MS})");
            filter->add_pattern("*.vds");
            filter->add_pattern("*.gds");
            filter->add_pattern("*.gvds");
            filter->add_pattern("*.ref");
            filter->add_pattern("*.MS");
            fileDialog.add_filter(filter);

            if(fileDialog.run() == Gtk::RESPONSE_OK)
            {
                window.Open(fileDialog.get_filename());
            }
            else return 0;
        }
        kit.run();
    }
    return 0;
}
Esempio n. 2
0
File: View.cpp Progetto: GG31/vle
void View::exportCurrentModel()
{
    const vpz::Experiment& experiment = ((const Modeling*)mModeling)
        ->vpz().project().experiment();
    if (experiment.name().empty() || experiment.duration() == 0) {
        Error(_("Fix a Value to the name and the duration of the experiment before exportation."));
        return;
    }

    Gtk::FileChooserDialog file("VPZ file", Gtk::FILE_CHOOSER_ACTION_SAVE);
    file.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    file.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create ();
    filter->set_name(_("Vle Project gZipped"));
    filter->add_pattern("*.vpz");
    file.add_filter(filter);

    if (file.run() == Gtk::RESPONSE_OK) {
        std::string filename(file.get_filename());
        vpz::Vpz::fixExtension(filename);

        vpz::Vpz* save = new vpz::Vpz();
        if (utils::Path::existFile(filename)) {
            save->clear();
        }
        save->setFilename(filename);

        mModeling->exportCoupledModel(mCurrent, save, mCurrentClass);
        delete save;
    }
}
Esempio n. 3
0
void EditStrategyWindow::onOpenClicked()
{
  Gtk::FileChooserDialog dialog(*this, "OPEN strategy", Gtk::FILE_CHOOSER_ACTION_OPEN);

  dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  dialog.add_button("Open", Gtk::RESPONSE_OK);

  Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
  filter->set_name("RFI strategies");
  filter->add_pattern("*.rfis");
  filter->add_mime_type("text/rfistrategy+xml");
  dialog.add_filter(filter);

  int result = dialog.run();
  if(result == Gtk::RESPONSE_OK)
	{
		StrategyReader reader;
		std::string filename(dialog.get_filename());
		try {
			_strategy = reader.CreateStrategyFromFile(filename);
			_strategyController.SetStrategy(_strategy);
			_store->clear();
			fillStore();
		} catch(std::exception &e)
		{
			Gtk::MessageDialog dialog(*this, e.what(), false, Gtk::MESSAGE_ERROR);
			dialog.run();
		}
	}
}
void genericFilechooserWindow::setAudioFilter
(
	void
) 
{
	// filter for audio files 
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("Audio");
	filter->add_mime_type("audio/*");
	filter->add_pattern("*.mp3");
	filter->add_pattern("*.ogg");
	filter->add_pattern("*.wav");
	filter->add_pattern("*.wma");
	filter->add_pattern("*.pcm");
	// add the filters to the filechooser
	add_filter(filter);
}
void genericFilechooserWindow::setAllFilesFilter
(
	void
) 
{
	// no filter -> all files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("All files");
	filter->add_pattern("*");
	// add the filters to the filechooser
	add_filter(filter);
}
void genericFilechooserWindow::setXMLEBUCoreFilter
(
	void
) 
{
	// filter for XML ebucore files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("XML EBUCore");
	filter->add_pattern("*.xml");
	// add the filters to the filechooser
	add_filter(filter);
}
void genericFilechooserWindow::setPlaylistFilter
(
	void
) 
{
	// filter for playlist files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("Playlist");
	filter->add_pattern("*.m3u");
	// add the filters to the filechooser
	add_filter(filter);
}
void genericFilechooserWindow::setAVCITextFilter
(
	void
) 
{
	// filter for any raw AVC-Intra text files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("AVC-Intra Text");
	filter->add_pattern("*.txt");
	filter->add_pattern("*.dat");
	// add the filters to the filechooser
	add_filter(filter);
}
void genericFilechooserWindow::setMXFFilter
(
	void
) 
{
	// filter for MXF files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("MXF Container");
	filter->add_mime_type("application/mxf");//MXF Container
	filter->add_pattern("*.mxf");
	// add the filters to the filechooser
	add_filter(filter);
}
Esempio n. 10
0
void filechooserDialog::setXMLFilter
(
	void
) 
{
	// filter for any xml files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("Any XML source");
	filter->add_mime_type("text/xml");//xml mime type
	filter->add_pattern("*.xml");
	// add the filters to the filechooser
	add_filter(filter);
}
Esempio n. 11
0
void filechooserDialog::setBiMFilter
(
	void
) 
{
	// filter for any bin files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("Any BiM source");
	filter->add_mime_type("application/octet-stream");// RFC2046
	filter->add_pattern("*.bin");
	filter->add_pattern("*.txt");
	// add the filters to the filechooser
	add_filter(filter);
}
void genericFilechooserWindow::setAnyEBUCoreFilter
(
	void
) 
{
	// filter for any ebucore files
	Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
	filter->set_name("Any EBUCore source");
	filter->add_mime_type("application/mxf");//MXF Container mime type
	filter->add_mime_type("text/xml");//xml mime type
	filter->add_pattern("*.xml");
	filter->add_pattern("*.mxf");
	// add the filters to the filechooser
	add_filter(filter);
}
Esempio n. 13
0
void View::openFile() {
    if(checkUnsavedAgenda()) { 
        Gtk::FileChooserDialog dialog("Open file...");
        Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
        filter->set_name("ical files (*.ics)");
        filter->add_pattern("*.ics");
        dialog.add_filter(filter);
        dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL);
        dialog.add_button("_Open", Gtk::RESPONSE_OK);
        dialog.set_transient_for(_window);
        int result = dialog.run();
        if (result == Gtk::RESPONSE_OK) {
            _agenda.openFile(dialog.get_filename());
            refresh();
        }
    }
}
Esempio n. 14
0
void View::saveAsFile() {
    Gtk::FileChooserDialog dialog("Save as...", Gtk::FILE_CHOOSER_ACTION_SAVE);
    Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
    filter->set_name("ical files (*.ics)");
    filter->add_pattern("*.ics");
    dialog.add_filter(filter);
    dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL);
    dialog.add_button("_Save", Gtk::RESPONSE_OK);
    dialog.set_transient_for(_window);
    int result = dialog.run();
    if (result == Gtk::RESPONSE_OK) {
        std::string filename = dialog.get_filename();
        if (filename.substr(filename.size()-4, 4) != ".ics")
            filename += ".ics";
        _agenda.saveAsFile(filename);
        _unsavedAgenda = false;
        refresh();
    }
}
void ImagePlaneWindow::onSaveFitsButton()
{
	Gtk::FileChooserDialog dialog("Select a measurement set");
	dialog.set_transient_for(*this);

	//Add response buttons the the dialog:
	dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL);
	dialog.add_button("_Save", Gtk::RESPONSE_OK);

	Glib::RefPtr<Gtk::FileFilter> fitsFilter = Gtk::FileFilter::create();
	fitsFilter->set_name("Flexible Image Transport System (*.fits)");
	fitsFilter->add_pattern("*.fits");
	fitsFilter->add_mime_type("image/fits");
	dialog.add_filter(fitsFilter);
		
	if(dialog.run() == Gtk::RESPONSE_OK)
	{
		const std::string filename = dialog.get_filename();
		Image2DCPtr image = _heatMapPlot.Image();
		image->SaveToFitsFile(filename);
	}
}
Esempio n. 16
0
void EditStrategyWindow::onSaveClicked()
{
  Gtk::FileChooserDialog dialog(*this, "Save strategy", Gtk::FILE_CHOOSER_ACTION_SAVE);

  dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  dialog.add_button("Save", Gtk::RESPONSE_OK);

  Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
  filter->set_name("RFI strategies");
  filter->add_pattern("*.rfis");
  filter->add_mime_type("text/rfistrategy+xml");
  dialog.add_filter(filter);

  int result = dialog.run();
  if(result == Gtk::RESPONSE_OK)
	{
		rfiStrategy::StrategyWriter writer;
		std::string filename(dialog.get_filename());
		if(filename.find('.') == std::string::npos)
			filename += ".rfis";
		writer.WriteToFile(*_strategy, filename);
		
	}
}