Ejemplo n.º 1
0
PythonConsole::PythonConsole( QWidget* parent)
	: QMainWindow( parent )
{
	setupUi(this);
	setWindowIcon(loadIcon("AppIcon.png"));

	changedLabel = new QLabel(this);
	cursorTemplate = tr("Col: %1 Row: %2/%3");
	cursorLabel = new QLabel(this);
	statusBar()->addPermanentWidget(changedLabel);
	statusBar()->addPermanentWidget(cursorLabel);

	action_Open->setIcon(loadIcon("16/document-open.png"));
	action_Save->setIcon(loadIcon("16/document-save.png"));
	actionSave_As->setIcon(loadIcon("16/document-save-as.png"));
	action_Exit->setIcon(loadIcon("exit.png"));
	action_Run->setIcon(loadIcon("ok.png"));

	action_Open->setShortcut(tr("Ctrl+O"));
	action_Save->setShortcut(tr("Ctrl+S"));
	action_Run->setShortcut(Qt::Key_F9);
	actionRun_As_Console->setShortcut(Qt::CTRL + Qt::Key_F9);

	commandEdit->setTabStopWidth(qRound(commandEdit->fontPointSize() * 4));

	// install syntax highlighter.
	//SyntaxHighlighter *sxHigh =
	new SyntaxHighlighter(commandEdit);

	languageChange();
	commandEdit_cursorPositionChanged();

	// welcome note
	QString welcomeText("\"\"\"");
	welcomeText += tr("Scribus Python Console");
	welcomeText += "\n\n";
	welcomeText += tr(
			"This is a standard Python console with some \n"
			"known limitations. Please consult the Scribus \n"
			"Scripter documentation for futher information. ");
	welcomeText += "\"\"\"\n";
	commandEdit->setText(welcomeText);
	commandEdit->selectAll();

	connect(commandEdit, SIGNAL(cursorPositionChanged()), this, SLOT(commandEdit_cursorPositionChanged()));
	connect(commandEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(documentChanged(bool)));

	connect(action_Open, SIGNAL(triggered()), this, SLOT(slot_open()));
	connect(action_Save, SIGNAL(triggered()), this, SLOT(slot_save()));
	connect(actionSave_As, SIGNAL(triggered()), this, SLOT(slot_saveAs()));
	connect(action_Exit, SIGNAL(triggered()), this, SLOT(slot_quit()));
	connect(action_Run, SIGNAL(triggered()), this, SLOT(slot_runScript()));
	connect(actionRun_As_Console, SIGNAL(triggered()), this, SLOT(slot_runScriptAsConsole()));
	connect(action_Save_Output, SIGNAL(triggered()), this, SLOT(slot_saveOutput()));
}
Ejemplo n.º 2
0
qvortaro::qvortaro(QWidget *parent) :
  QMainWindow(parent)
{
  Config::instance()->read();

  ui.setupUi(this);
  statusBar()->hide();
  createMenuAndActions();
  QObject::connect(m_aBeenden, SIGNAL(triggered()), this, SLOT(slot_quit()));
  QObject::connect(m_agAnordnungLexika, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeAnordnungLexika(QAction*)));
  QObject::connect(m_agGestaltungLexikaAnordnung, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeGestaltungLexika(QAction*)));
  QObject::connect(m_agGestaltungLexikaGestaltung, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeGestaltungLexika(QAction*)));
  QObject::connect(m_agLexika1, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeLexika1(QAction*)));
  QObject::connect(m_agLexika2, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeLexika2(QAction*)));
  QObject::connect(m_agCaption, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeCaption(QAction*)));
  QObject::connect(m_aProgrammEinrichten, SIGNAL(triggered()), this, SLOT(slot_configDgl()));
  QObject::connect(m_aAnsichtSpeichern, SIGNAL(triggered()), this, SLOT(slot_ansichtSpeichern()));
  QObject::connect(m_aAnsichtZeigeLanguage2, SIGNAL(triggered(bool)), this, SLOT(slot_zeigeLanguage2()));
  QObject::connect(m_aAnsichtZeigeLanguage2, SIGNAL(toggled(bool)), this, SLOT(slot_zeigeLanguage2()));
  QObject::connect(m_agAnsichtLaden, SIGNAL(triggered(QAction*)), this, SLOT(slot_ansichtLaden(QAction*)));
  QObject::connect(m_aUeber, SIGNAL(triggered()), this, SLOT(slot_showUeber()));
  QObject::connect(m_aStayOnTop, SIGNAL(triggered(bool)), this, SLOT(slot_stayOnTop()));

  mySearchLayout1 = new SearchLayout1();
  ui.sw->insertWidget(0, mySearchLayout1);

  ui.sw->setCurrentIndex(0);

  // Zwischenablage
  m_cb = QApplication::clipboard();
  m_cbStringLast = getCbString();
  m_cbTimer = new QTimer(this);
  m_cbTimer->setSingleShot(true);
  QObject::connect(m_cbTimer, SIGNAL(timeout()), this, SLOT(slot_checkCb()));
  slot_checkCb();

  // Keine Wörterbücher gefunden
  if (Config::instance()->languages().isEmpty())
  {
    if (!Config::instance()->containsPathLexika(QApplication::applicationDirPath()+QDir::separator()+"dict") && !Config::instance()->containsPathLexika(QApplication::applicationDirPath()))
      QMessageBox::warning(
          this,
          "qVortaro - "+trUtf8("Keine Wörterbücher gefunden"),
          trUtf8("Es konnten keine Wörterbucher gefunden werden!\n\n"
            "Bitte überprüfen Sie unter »Einstellungen->aVortaro einrichten«,\n" "ob der richtige Pfad zum Ordner mit den Wörterbüchern\n" "angegeben wurde."),
          QMessageBox::Ok);
  }

  if (Config::instance()->restoreOnStartup() && !Config::instance()->currentView().isEmpty() && Config::instance()->currentView().contains("zeigeLanguage2"))
  {
    restoreView(Config::instance()->currentView());
    m_aStayOnTop->setChecked(Config::instance()->stayOnTop());
    slot_stayOnTop();
  }
  else
  {
    m_aStayOnTop->setChecked(false);
    slot_stayOnTop();
    Config::instance()->setCurrentView(getDefaultView());
    restoreView(getDefaultView());
    adjustSize();
  }
}