示例#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()));
}
示例#2
0
ThemeBuilderUI::ThemeBuilderUI(QWidget* parent)
 : QWidget(parent), config(NULL)
{
  setupUi(this);

  config = new ThemeConfig();
  defaultConfig = new ThemeConfig(":default.cfg");

  QObject::connect(elementList,SIGNAL(currentTextChanged(const QString &)), this,SLOT(slot_ElementChanged(const QString &)));
  QObject::connect(quitButton,SIGNAL(clicked()), this,SLOT(close()));
  QObject::connect(loadButton,SIGNAL(clicked()), this,SLOT(slot_open()));
  QObject::connect(newButton,SIGNAL(clicked()), this,SLOT(slot_new()));

  elementList->addItems(ThemeConfig::getManagedElements());
  inheritElementCombo->addItems(ThemeConfig::getManagedElements());
  inheritFrameCombo->addItems(ThemeConfig::getManagedElements());
  inheritInteriorCombo->addItems(ThemeConfig::getManagedElements());
  inheritIndicatorCombo->addItems(ThemeConfig::getManagedElements());
}
示例#3
0
//-----Constructor------------------------------------------------------------
CFileDlg::CFileDlg(const char *szId, unsigned long nPPID, CICQDaemon *daemon,
  QWidget* parent)
  : QWidget(parent, "FileDialog", WDestructiveClose)
{
  // If we are the server, then we are receiving a file
  m_szId = szId ? strdup(szId) : 0;
  m_nPPID = nPPID;
  licqDaemon = daemon;

  setCaption(tr("Licq - File Transfer (%1)").arg(m_szId));

  unsigned short CR = 0;
  QGridLayout* lay = new QGridLayout(this, 8, 3, 8, 8);
  lay->setColStretch(1, 2);

  lblTransferFileName = new QLabel(tr("Current:"), this);
  lay->addWidget(lblTransferFileName, CR, 0);
  nfoTransferFileName = new CInfoField(this, true);
  nfoTransferFileName->setMinimumWidth(nfoTransferFileName->sizeHint().width()*2);
  lay->addWidget(nfoTransferFileName, CR, 1);
  nfoTotalFiles = new CInfoField(this, true);
  nfoTotalFiles->setMinimumWidth((nfoTotalFiles->sizeHint().width()*3)/2);
  lay->addWidget(nfoTotalFiles, CR, 2);

  lblLocalFileName = new QLabel(tr("File name:"), this);
  lay->addWidget(lblLocalFileName, ++CR, 0);
  nfoLocalFileName = new CInfoField(this, true);
  lay->addMultiCellWidget(nfoLocalFileName, CR, CR, 1, 2);

  lay->addRowSpacing(++CR, 10);

  // Information stuff about the current file
  lblTrans = new QLabel(tr("File:"), this);
  lay->addWidget(lblTrans, ++CR, 0);
  barTransfer = new QProgressBar(this);
  lay->addWidget(barTransfer, CR, 1);
  nfoFileSize = new CInfoField(this, true);
  lay->addWidget(nfoFileSize, CR, 2);

  // Information about the batch file transfer
  lblBatch = new QLabel(tr("Batch:"), this);
  lay->addWidget(lblBatch, ++CR, 0);
  barBatchTransfer = new QProgressBar(this);
  lay->addWidget(barBatchTransfer, CR, 1);
  nfoBatchSize = new CInfoField(this, true);
  lay->addWidget(nfoBatchSize, CR, 2);

  lblTime = new QLabel(tr("Time:"), this);
  lay->addWidget(lblTime, ++CR, 0);

  QHBox* hbox = new QHBox(this);
  hbox->setSpacing(8);
  lay->addMultiCellWidget(hbox, CR, CR, 0, 1);
  nfoTime = new CInfoField(hbox, true);
  nfoBPS = new CInfoField(hbox, true);
  lblETA = new QLabel(tr("ETA:"), hbox);
  nfoETA = new CInfoField(this, true);
  lay->addWidget(nfoETA, CR++, 2);
  lay->addRowSpacing(++CR, 10);

  mleStatus = new MLEditWrap(true, this);
  ++CR;
  lay->addMultiCellWidget(mleStatus, CR, CR, 0, 2);
  mleStatus->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);

  lay->setRowStretch(++CR, 3);

  hbox = new QHBox(this);
  hbox->setSpacing(8);
  lay->addMultiCellWidget(hbox, CR, CR, 0, 2);
  
  btnCancel = new QPushButton(tr("&Cancel Transfer"), hbox);
  btnCancel->setMinimumWidth(75);
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));

  //TODO fix this
  ftman = new CFileTransferManager(licqDaemon, strtoul(m_szId, (char **)NULL, 10));
  ftman->SetUpdatesEnabled(2);
  sn = new QSocketNotifier(ftman->Pipe(), QSocketNotifier::Read);
  connect(sn, SIGNAL(activated(int)), SLOT(slot_ft()));

  #ifdef USE_KDE
    btnOpen = new QPushButton(tr("&Open"), hbox);
    btnOpenDir = new QPushButton(tr("O&pen Dir"), hbox);
    btnOpen->hide();
    btnOpenDir->hide();
    connect(btnOpen, SIGNAL(clicked()), SLOT(slot_open()));
    connect(btnOpenDir, SIGNAL(clicked()), SLOT(slot_opendir()));
  #else
    btnOpen = 0;
    btnOpenDir = 0;
  #endif
}