Пример #1
0
	def loadInfo(self, dict_name) :
		dict_name = str(dict_name)

		dict_file_name = Utils.joinPath(Const.AllDictsDirPath, dict_name)
		dict_file = Qt.QFile(dict_file_name)
		dict_file_stream = Qt.QTextStream(dict_file)
		if not dict_file.open(Qt.QIODevice.ReadOnly) :
			Logger.warning(Qt.QString("Cannot open dict file \"%1\" for reading info").arg(dict_file_name))
			return

		self.__info_cache_dict[dict_name] = {}
		for all_tags_list_item in AllTagsList :
			self.__info_cache_dict[dict_name][all_tags_list_item] = Qt.QString()

		while not dict_file_stream.atEnd() :
			Qt.QCoreApplication.processEvents(Qt.QEventLoop.ExcludeUserInputEvents)
			line = dict_file_stream.readLine()

			if line.isEmpty() :
				continue
			if line[0] != "#" and line.contains("  ") :
				break

			if line[0] == "#" :
				line.remove(0, 1)
				line = line.trimmed()

				key = MiscTag
				for key_item in self.__info_cache_dict[dict_name].keys() :
					tag = Qt.QString(key_item+":")
					if line.startsWith(tag) :
						line = line.remove(0, tag.length()).simplified()
						key = str(key_item)
						break
				if not self.__info_cache_dict[dict_name][key].isEmpty() :
					self.__info_cache_dict[dict_name][key].append("<br>")
				self.__info_cache_dict[dict_name][key].append(line)

		dict_file.close()

		###

		self.__info_cache_dict[dict_name][FileSizeTag] = Qt.QString().setNum(dict_file.size() / 1024)

		lang_codes_dict = LangsList.langCodes()
		direction_regexp = Qt.QRegExp("((..)-(..))")
		if direction_regexp.exactMatch(self.__info_cache_dict[dict_name][DirectionTag]) :
			icon_width = icon_height = Qt.QApplication.style().pixelMetric(Qt.QStyle.PM_SmallIconSize)
			self.__info_cache_dict[dict_name][DirectionTag] = (
				Qt.QString("<img src=\"%3\" width=\"%1\" height=\"%2\"> &#187; <img src=\"%4\" width=\"%1\" height=\"%2\">"
					"&nbsp;&nbsp;&nbsp;%5 &#187; %6 (%7)").arg(icon_width).arg(icon_height)
						.arg(IconsLoader.iconPath(Utils.joinPath("flags", direction_regexp.cap(2))))
						.arg(IconsLoader.iconPath(Utils.joinPath("flags", direction_regexp.cap(3))))
						.arg(LangsList.langName(direction_regexp.cap(2), lang_codes_dict))
						.arg(LangsList.langName(direction_regexp.cap(3), lang_codes_dict))
						.arg(direction_regexp.cap(1)) )

		for tag_key in self.__info_cache_dict[dict_name].keys() :
			if self.__info_cache_dict[dict_name][tag_key].isEmpty() :
				self.__info_cache_dict[dict_name][tag_key] = tr("Unavailable")
Пример #2
0
	def translateUi(self) :
		self.setWindowTitle(tr("Google Translate"))
		self.__translate_button.setText(tr("T&ranslate"))
		self.__translate_button.setToolTip(tr("Ctrl+Enter"))

		###

		lang_codes_dict = LangsList.langCodes()
		langs_list = LangsList.langs()
		main_lang = Locale.Locale().mainLang()

		sl_lang = self.__sl_combobox.itemData(self.__sl_combobox.currentIndex()).toString()
		self.__sl_combobox.clear()
		self.__sl_combobox.addItem(IconsLoader.icon("help-hint"), tr("Guess"), Qt.QVariant(""))
		self.__sl_combobox.insertSeparator(1)

		tl_lang = self.__tl_combobox.itemData(self.__tl_combobox.currentIndex()).toString()
		self.__tl_combobox.clear()
		self.__tl_combobox.addItem(IconsLoader.icon(Utils.joinPath("flags", main_lang)),
			LangsList.langName(main_lang, lang_codes_dict), Qt.QVariant(main_lang))
		self.__tl_combobox.insertSeparator(1)

		for combobox in (self.__sl_combobox, self.__tl_combobox) :
			for langs_list_item in langs_list :
				combobox.addItem(IconsLoader.icon(Utils.joinPath("flags", langs_list_item["code"])),
					langs_list_item["name"], Qt.QVariant(langs_list_item["code"]))

		for (combobox, lang) in ((self.__sl_combobox, sl_lang), (self.__tl_combobox, tl_lang)) :
			for count in xrange(combobox.count()) :
				if combobox.itemData(count).toString() == lang and not combobox.itemText(count).isEmpty() :
					combobox.setCurrentIndex(count)
					break
Пример #3
0
	def __init__(self, parent = None) :
		Qt.QWidget.__init__(self, parent)

		#####

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.__main_layout.setSpacing(0)
		self.setLayout(self.__main_layout)

		#####

		self.__shred_lock_flag = False

		self.__translate_browsers_list = []
		self.__old_index = -1

		self.__tmp_text_cursor = Qt.QTextCursor()

		#####

		self.__tab_widget = Qt.QTabWidget(self)
		self.__tab_widget.setTabsClosable(True)
		self.__main_layout.addWidget(self.__tab_widget)

		self.__add_tab_button = Qt.QToolButton(self)
		self.__add_tab_button.setIcon(IconsLoader.icon("tab-new"))
		self.__add_tab_button.setIconSize(Qt.QSize(16, 16))
		self.__add_tab_button.setCursor(Qt.Qt.ArrowCursor)
		self.__add_tab_button.setAutoRaise(True)
		self.__tab_widget.setCornerWidget(self.__add_tab_button, Qt.Qt.TopLeftCorner)

		self.__remove_tab_button = Qt.QToolButton(self)
		self.__remove_tab_button.setIcon(IconsLoader.icon("tab-close"))
		self.__remove_tab_button.setIconSize(Qt.QSize(16, 16))
		self.__remove_tab_button.setCursor(Qt.Qt.ArrowCursor)
		self.__remove_tab_button.setAutoRaise(True)
		self.__tab_widget.setCornerWidget(self.__remove_tab_button, Qt.Qt.TopRightCorner)

		self.__text_search_frame = TextSearchFrame.TextSearchFrame(self)
		self.__text_search_frame.hide()
		self.__main_layout.addWidget(self.__text_search_frame)

		#####

		self.connect(self.__add_tab_button, Qt.SIGNAL("clicked()"), self.addTab)
		self.connect(self.__remove_tab_button, Qt.SIGNAL("clicked()"), self.removeTab)

		self.connect(self.__tab_widget, Qt.SIGNAL("currentChanged(int)"), self.tabChanged)
		self.connect(self.__tab_widget, Qt.SIGNAL("tabCloseRequested(int)"), self.removeTab)

		self.connect(self.__text_search_frame, Qt.SIGNAL("findNextRequest(const QString &)"), self.findNext)
		self.connect(self.__text_search_frame, Qt.SIGNAL("findPreviousRequest(const QString &)"), self.findPrevious)
		self.connect(self.__text_search_frame, Qt.SIGNAL("instantSearchRequest(const QString &)"), self.instantSearch)

		#####

		self.addTab()
Пример #4
0
	def translateUi(self) :
		self.clear()

		self.addMailLink(IconsLoader.icon("mail-send"), tr("Developer e-mail"), Const.DeveloperMail, Const.Package)
		self.addMailLink(IconsLoader.icon("mail-send"), tr("Offers e-mail"), Const.OffersMail, Const.Package)
		self.addMailLink(IconsLoader.icon("mail-send"), tr("Bugtrack e-mail"), Const.BugtrackMail, Const.Package)
		self.addSeparator()
		self.addLink(IconsLoader.icon("applications-internet"), tr("Home page"), Const.HomePageAddress)
		self.addSeparator()

		self.addMailLink(IconsLoader.icon("mail-send"), tr("Register %1").arg(Const.Package), Const.UserCountMail,
			"&body="+tr("Count me, please :-)\nRegistration date/time: %1\nPackage version: %2")
				.arg(Qt.QDateTime().currentDateTime().toString()).arg(Const.PackageVersion))
Пример #5
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("xsl"),
			"title" : Qt.QT_TR_NOOP("SL Search"),
			"area" : Qt.Qt.LeftDockWidgetArea,
			"hotkey" : Qt.QKeySequence("Ctrl+S")
		}
Пример #6
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("applications-internet"),
			"title" : Qt.QT_TR_NOOP("Google Translate"),
			"area" : Qt.Qt.LeftDockWidgetArea,
			"hotkey" : Qt.QKeySequence("Ctrl+G")
		}
Пример #7
0
	def stopSpy(self) :
		self.__spy.stop()
		self.__start_spy_action.setEnabled(True)
		self.__stop_spy_action.setEnabled(False)
		self.__tray_icon.setIcon(IconsLoader.icon("xsl_22"))
		self.__tray_icon.setToolTip(tr("%1 - graphical interface for SL\nSpy is stopped").arg(Const.MyName))
		self.__status_bar.showMessage(tr("Spy is stopped"))
Пример #8
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("view-history"),
			"title" : Qt.QT_TR_NOOP("Search history"),
			"area" : Qt.Qt.LeftDockWidgetArea,
			"hotkey" : Qt.QKeySequence("Ctrl+H")
		}
Пример #9
0
    def __init__(self, parent=None):
        Qt.QStatusBar.__init__(self, parent)

        #####

        self.__activation_semaphore = 0

        self.__timer = Qt.QTimer(self)

        #####

        icon_width = icon_height = label_height = self.style().pixelMetric(Qt.QStyle.PM_SmallIconSize)

        self.__message_label = Qt.QLabel(self)
        self.__message_label.setTextFormat(Qt.Qt.PlainText)
        self.__message_label.setMaximumHeight(label_height)
        self.addWidget(self.__message_label, 1)

        self.__wait_picture_movie = IconsLoader.gifMovie("circular")
        self.__wait_picture_movie.setScaledSize(Qt.QSize(icon_width, icon_height))
        self.__wait_picture_movie.jumpToFrame(0)
        self.__wait_picture_movie_label = Qt.QLabel(self)
        self.__wait_picture_movie_label.setMovie(self.__wait_picture_movie)
        self.__wait_picture_movie_label.hide()
        self.addWidget(self.__wait_picture_movie_label)

        #####

        self.connect(self.__timer, Qt.SIGNAL("timeout()"), self.clearStatusMessage)
Пример #10
0
	def __init__(self, parent = None) :
		Qt.QTextEdit.__init__(self, parent)

		self.setAcceptRichText(False)

		#####

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setAlignment(Qt.Qt.AlignRight|Qt.Qt.AlignBottom)
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.__main_layout.setSpacing(0)
		self.setLayout(self.__main_layout)

		#####

		self.__clear_button = Qt.QToolButton(self)
		self.__clear_button.setIcon(IconsLoader.icon("edit-clear-locationbar-rtl"))
		self.__clear_button.setIconSize(Qt.QSize(16, 16))
		self.__clear_button.setCursor(Qt.Qt.ArrowCursor)
		self.__clear_button.setAutoRaise(True)
		self.__clear_button.setEnabled(False)
		self.__main_layout.addWidget(self.__clear_button)

		#####

		self.connect(self, Qt.SIGNAL("textChanged()"), self.setStatusFromTextEdit)

		self.connect(self.__clear_button, Qt.SIGNAL("clicked()"), self.clearTextEdit)
Пример #11
0
	def __init__(self, parent = None) :
		Qt.QDialog.__init__(self, parent)

		self.setModal(True)

		self.setWindowIcon(IconsLoader.icon("xsl"))

		#####

		self.__main_layout = Qt.QVBoxLayout()
		self.setLayout(self.__main_layout)

		self.__info_label_layout = Qt.QHBoxLayout()
		self.__main_layout.addLayout(self.__info_label_layout)

		self.__ok_button_layout = Qt.QHBoxLayout()
		self.__ok_button_layout.setAlignment(Qt.Qt.AlignRight)
		self.__main_layout.addLayout(self.__ok_button_layout)

		#####

		self.__icon_label = Qt.QLabel(self)
		self.__icon_label.setAlignment(Qt.Qt.AlignTop)
		self.__icon_label.setPixmap(IconsLoader.icon("xsl_64").pixmap(Qt.QSize(64, 64)))
		self.__info_label_layout.addWidget(self.__icon_label)

		self.__text_label = Qt.QLabel(self)
		self.__text_label.setTextFormat(Qt.Qt.RichText)
		self.__text_label.setOpenExternalLinks(True)
		self.__info_label_layout.addWidget(self.__text_label)

		self.__ok_button = Qt.QPushButton(self)
		self.__ok_button.setDefault(True)
		self.__ok_button_layout.addWidget(self.__ok_button)

		#####

		self.connect(self.__ok_button, Qt.SIGNAL("clicked()"), self.accept)

		#####

		self.translateUi()
Пример #12
0
	def __init__(self, parent = None) :
		Qt.QDockWidget.__init__(self, parent)

		self.setAllowedAreas(Qt.Qt.AllDockWidgetAreas)

		#####

		self.__main_widget = Qt.QWidget(self)
		self.setWidget(self.__main_widget)

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_widget.setLayout(self.__main_layout)

		self.__history_browser_layout = Qt.QVBoxLayout()
		self.__main_layout.addLayout(self.__history_browser_layout)

		self.__control_buttons_layout = Qt.QHBoxLayout()
		self.__main_layout.addLayout(self.__control_buttons_layout)

		#####

		self.__settings = Settings.Settings(self)

		#####

		self.__line_edit = LineEdit.LineEdit(self)
		self.__history_browser_layout.addWidget(self.__line_edit)

		self.__history_browser = Qt.QListWidget(self)
		self.__history_browser_layout.addWidget(self.__history_browser)

		self.__clear_history_button = Qt.QPushButton(self)
		self.__clear_history_button.setEnabled(False)
		self.__control_buttons_layout.addWidget(self.__clear_history_button)

		self.__export_list_button = Qt.QToolButton(self)
		self.__export_list_button.setIcon(IconsLoader.icon("document-save-as"))
		self.__export_list_button.setIconSize(Qt.QSize(16, 16))
		self.__control_buttons_layout.addWidget(self.__export_list_button)

		#####

		self.connect(self, Qt.SIGNAL("visibilityChanged(bool)"), self.activateDockWidget)

		self.connect(self.__line_edit, Qt.SIGNAL("textChanged(const QString &)"), self.setFilter)
		self.connect(self.__history_browser, Qt.SIGNAL("itemActivated(QListWidgetItem *)"), self.wordChangedSignal)

		self.connect(self.__clear_history_button, Qt.SIGNAL("clicked()"), self.clearHistory)
		self.connect(self.__export_list_button, Qt.SIGNAL("clicked()"), self.exportWordsList)

		#####

		self.translateUi()
Пример #13
0
	def translateUi(self) :
		self.__show_tray_icon_checkbox.setText(tr("Show tray icon"))
		self.__show_splash_checkbox.setText(tr("Show splash screen on startup"))
		self.__force_main_lang_label.setText(tr("Force language:"))
		self.__debug_mode_checkbox.setText(tr("Debug mode (write info to stderr)"))

		###

		last_index = self.__force_main_lang_combobox.currentIndex()
		self.__force_main_lang_combobox.clear()

		lang_codes_dict = LangsList.langCodes()
		system_lang = Locale.Locale.systemLang()

		self.__force_main_lang_combobox.addItem(IconsLoader.icon(Utils.joinPath("flags", system_lang)),
			tr("By default (%1)").arg(LangsList.langName(system_lang, lang_codes_dict)), Qt.QVariant(""))

		self.__force_main_lang_combobox.insertSeparator(1)

		for langs_list_item in Locale.Locale.validLangs() :
			self.__force_main_lang_combobox.addItem(IconsLoader.icon(Utils.joinPath("flags", langs_list_item)),
				LangsList.langName(langs_list_item, lang_codes_dict), Qt.QVariant(langs_list_item))
		self.__force_main_lang_combobox.setCurrentIndex(last_index)
Пример #14
0
	def controlAct(self, reason) :
		if sys.modules.has_key("KeysGrabber") and reason == self.__main_window_hotkey :
			self.visibleChange()
		elif reason == Qt.QSystemTrayIcon.Trigger :
			self.visibleChange()
		elif reason == Qt.QSystemTrayIcon.Context :
			menu = EntitledMenu.EntitledMenu(IconsLoader.icon("xsl"), Const.Package+" "+Const.MyName)
			menu.addAction(self.__start_spy_action)
			menu.addAction(self.__stop_spy_action)
			menu.addSeparator()
			menu.addAction(tr("Dictionary window")+( "\tWin+L" if sys.modules.has_key("KeysGrabber") else "" ), self.visibleChange)
			menu.addSeparator()
			menu.addAction(self.__exit_action)
			menu.exec_(Qt.QCursor.pos())
Пример #15
0
	def run(self) :
		self.__app = MainApplication.MainApplication(sys.argv)

		StartupLock.test()

		show_splash_flag = Settings.Settings().value("application/misc/show_splash_flag", Qt.QVariant(True)).toBool()

		if show_splash_flag :
			splash_pixmap = IconsLoader.pixmap("xsl_splash")
			splash = Qt.QSplashScreen(splash_pixmap)
			if not self.__app.isSessionRestored() :
				splash.show()

		self.__app.processEvents()

		self.__main_window = MainWindow.MainWindow()
		self.connect(self.__app, Qt.SIGNAL("focusChanged(QWidget *, QWidget*)"), self.__main_window.focusChanged)
		self.connect(self.__app, Qt.SIGNAL("saveSettingsRequest()"), self.__main_window.exit)
		self.__main_window.load()

		if show_splash_flag :
			splash.finish(self.__main_window)

		self.__app.exec_()
Пример #16
0
	def __init__(self, parent = None) :
		Qt.QDockWidget.__init__(self, parent)

		self.setAllowedAreas(Qt.Qt.AllDockWidgetAreas)

		#####

		self.__main_widget = Qt.QWidget(self)
		self.setWidget(self.__main_widget)

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_widget.setLayout(self.__main_layout)

		self.__langs_layout = Qt.QHBoxLayout()
		self.__main_layout.addLayout(self.__langs_layout)

		self.__text_edit_layout = Qt.QHBoxLayout()
		self.__main_layout.addLayout(self.__text_edit_layout)

		self.__control_buttons_layout = Qt.QHBoxLayout()
		self.__main_layout.addLayout(self.__control_buttons_layout)

		#####

		self.__settings = Settings.Settings(self)
		self.__google_translate = GoogleTranslate.GoogleTranslate(self)

		#####

		self.__sl_combobox = Qt.QComboBox(self)
		self.__sl_combobox.setSizeAdjustPolicy(Qt.QComboBox.AdjustToMinimumContentsLength)
		self.__sl_combobox.setMaxVisibleItems(15)
		self.__langs_layout.addWidget(self.__sl_combobox)

		self.__invert_langs_button = Qt.QToolButton(self)
		self.__invert_langs_button.setIcon(IconsLoader.icon("go-jump"))
		self.__invert_langs_button.setIconSize(Qt.QSize(16, 16))
		self.__invert_langs_button.setCursor(Qt.Qt.ArrowCursor)
		self.__invert_langs_button.setAutoRaise(True)
		self.__langs_layout.addWidget(self.__invert_langs_button)

		self.__tl_combobox = Qt.QComboBox(self)
		self.__tl_combobox.setSizeAdjustPolicy(Qt.QComboBox.AdjustToMinimumContentsLength)
		self.__tl_combobox.setMaxVisibleItems(15)
		self.__langs_layout.addWidget(self.__tl_combobox)

		self.__text_edit = TextEdit.TextEdit(self)
		self.__text_edit_layout.addWidget(self.__text_edit)

		self.__translate_button = Qt.QPushButton(self)
		self.__translate_button.setEnabled(False)
		self.__control_buttons_layout.addWidget(self.__translate_button)

		self.__abort_button = Qt.QToolButton(self)
		self.__abort_button.setIcon(IconsLoader.icon("dialog-cancel"))
		self.__abort_button.setIconSize(Qt.QSize(16, 16))
		self.__abort_button.setEnabled(False)
		self.__control_buttons_layout.addWidget(self.__abort_button)

		#####

		self.connect(self, Qt.SIGNAL("visibilityChanged(bool)"), self.activateDockWidget)

		self.connect(self.__google_translate, Qt.SIGNAL("processStarted()"), self.processStarted)
		self.connect(self.__google_translate, Qt.SIGNAL("processFinished()"), self.processFinished)
		self.connect(self.__google_translate, Qt.SIGNAL("clearRequest()"), self.clearRequestSignal)
		self.connect(self.__google_translate, Qt.SIGNAL("wordChanged(const QString &)"), self.wordChangedSignal)
		self.connect(self.__google_translate, Qt.SIGNAL("textChanged(const QString &)"), self.textChangedSignal)
		self.connect(self.__google_translate, Qt.SIGNAL("statusChanged(const QString &)"), self.statusChangedSignal)

		self.connect(self.__invert_langs_button, Qt.SIGNAL("clicked()"), self.invertLangs)

		self.connect(self.__text_edit, Qt.SIGNAL("textChanged()"), self.setStatusFromTextEdit)
		self.connect(self.__text_edit, Qt.SIGNAL("textApplied()"), self.__translate_button.animateClick)

		self.connect(self.__translate_button, Qt.SIGNAL("clicked()"), self.translate)
		self.connect(self.__translate_button, Qt.SIGNAL("clicked()"), self.setFocus)
		self.connect(self.__abort_button, Qt.SIGNAL("clicked()"), self.abort)

		#####

		self.translateUi()
Пример #17
0
	def __init__(self, parent = None) :
		Qt.QFrame.__init__(self, parent)

		self.setFrameShape(Qt.QFrame.Box)

		#####

		self.__main_layout = Qt.QHBoxLayout()
		self.__main_layout.setContentsMargins(3, 0, 3, 0)
		self.setLayout(self.__main_layout)

		#####

		self.__close_button = Qt.QToolButton(self)
		self.__close_button.setIcon(IconsLoader.icon("dialog-cancel"))
		self.__close_button.setIconSize(Qt.QSize(16, 16))
		self.__main_layout.addWidget(self.__close_button)

		self.__vertical_frame1 = Qt.QFrame(self)
		self.__vertical_frame1.setFrameStyle(Qt.QFrame.VLine|Qt.QFrame.Sunken)
		self.__vertical_frame1.setMinimumSize(22, 22)
		self.__main_layout.addWidget(self.__vertical_frame1)

		self.__line_edit_label = Qt.QLabel(tr("Search:"), self)
		self.__main_layout.addWidget(self.__line_edit_label)

		self.__line_edit = LineEdit.LineEdit(self)
		self.__main_layout.addWidget(self.__line_edit)

		self.__vertical_frame2 = Qt.QFrame(self)
		self.__vertical_frame2.setFrameStyle(Qt.QFrame.VLine|Qt.QFrame.Sunken)
		self.__main_layout.addWidget(self.__vertical_frame2)

		self.__next_button = Qt.QToolButton(self)
		self.__next_button.setIcon(IconsLoader.icon("go-down"))
		self.__next_button.setIconSize(Qt.QSize(16, 16))
		self.__next_button.setEnabled(False)
		self.__main_layout.addWidget(self.__next_button)

		self.__previous_button = Qt.QToolButton(self)
		self.__previous_button.setIcon(IconsLoader.icon("go-up"))
		self.__previous_button.setIconSize(Qt.QSize(16, 16))
		self.__previous_button.setEnabled(False)
		self.__main_layout.addWidget(self.__previous_button)

		#####

		self.__found_flag = True

		self.__css_collection = CssCollection.CssCollection()

		self.__line_edit_default_palette = Qt.QPalette()
		self.__line_edit_red_alert_palette = Qt.QPalette()

		self.initDrawInstruments()

		#####

		self.connect(self.__close_button, Qt.SIGNAL("clicked()"), self.hide)

		self.connect(self.__line_edit, Qt.SIGNAL("returnPressed()"), self.__next_button.animateClick)
		self.connect(self.__line_edit, Qt.SIGNAL("textChanged(const QString &)"), self.setStatusFromLineEdit)
		self.connect(self.__line_edit, Qt.SIGNAL("textChanged(const QString &)"), self.instantSearchRequest)

		self.connect(self.__next_button, Qt.SIGNAL("clicked()"), self.findNextRequest)

		self.connect(self.__previous_button, Qt.SIGNAL("clicked()"), self.findPreviousRequest)

		self.connect(self.__css_collection, Qt.SIGNAL("cssChanged()"), self.initDrawInstruments)
Пример #18
0
	def __init__(self, parent = None) :
		Qt.QMainWindow.__init__(self, parent)

		self.setObjectName("main_window")

		self.setDockOptions(self.dockOptions()|Qt.QMainWindow.VerticalTabs)

		self.setWindowTitle(Const.Package+" "+Const.MyName)
		self.setWindowIcon(IconsLoader.icon("xsl"))

		#####

		self.__main_widget = Qt.QWidget(self)
		self.setCentralWidget(self.__main_widget)

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.__main_widget.setLayout(self.__main_layout)

		#####

		self.__source_objects_list = []
		self.__panels_list = []
		self.__spy_methods_dict = {}

		###

		self.__settings = Settings.Settings(self)

		self.__status_bar = StatusBar.StatusBar(self)
		self.setStatusBar(self.__status_bar)

		self.__tabbed_translate_browser = TabbedTranslateBrowser.TabbedTranslateBrowser(self)
		self.__main_layout.addWidget(self.__tabbed_translate_browser)

		self.__translate_window = TranslateWindow.TranslateWindow(self)
		self.__translate_window.setObjectName("translate_window")

		self.__dicts_manager_window = DictsManagerWindow.DictsManagerWindow(self)
		self.__dicts_manager_window.setObjectName("dicts_manager_window")

		self.__settings_window = SettingsWindow.SettingsWindow(self)
		self.__settings_window.setObjectName("settings_window")

		self.__help_browser_window = HelpBrowserWindow.HelpBrowserWindow(self)
		self.__help_browser_window.setObjectName("help_browser_window")

		self.__about_window = AboutWindow.AboutWindow(self)

		self.__spy = Spy.Spy(self)

		self.__tray_icon = Qt.QSystemTrayIcon(self)
		self.__tray_icon.setIcon(IconsLoader.icon("xsl_22"))

		if sys.modules.has_key("KeysGrabber") :
			self.__keys_grabber = KeysGrabber.KeysGrabber()
			self.__main_window_hotkey = self.__keys_grabber.addHotkey(KeysGrabber.Key_L, KeysGrabber.WinModifier)

		#####

		self.__pages_menu = self.menuBar().addMenu(tr("&Pages"))
		self.__save_action = self.__pages_menu.addAction(IconsLoader.icon("document-save-as"),
			tr("Save current page"), self.saveCurrentPage)
		self.__print_action = self.__pages_menu.addAction(IconsLoader.icon("document-print"),
			tr("Print current page"), self.printCurrentPage)
		self.__pages_menu.addSeparator()
		self.__clear_action = self.__pages_menu.addAction(IconsLoader.icon("edit-clear"),
			tr("Clear current page"), self.clearCurrentPage, Qt.QKeySequence("Ctrl+E"))
		self.__clear_all_action = self.__pages_menu.addAction(IconsLoader.icon("edit-clear"),
			tr("Clear all"), self.clearAllPages, Qt.QKeySequence("Ctrl+K"))
		self.__pages_menu.addSeparator()
		self.__find_action = self.__pages_menu.addAction(IconsLoader.icon("edit-find"),
			tr("Search in translations"), self.__tabbed_translate_browser.showTextSearchFrame, Qt.QKeySequence("Ctrl+F"))
		self.__pages_menu.addSeparator()
		self.__new_tab_action = self.__pages_menu.addAction(IconsLoader.icon("tab-new"),
			tr("New tab"), self.addTab, Qt.QKeySequence("Ctrl+T"))
		self.__close_tab_action = self.__pages_menu.addAction(IconsLoader.icon("tab-close"),
			tr("Close tab"), self.removeTab, Qt.QKeySequence("Ctrl+W"))
		self.__pages_menu.addSeparator()
		self.__exit_action = self.__pages_menu.addAction(IconsLoader.icon("application-exit"),
			tr("Quit"), self.exit, Qt.QKeySequence("Ctrl+Q"))

		###

		self.__panels_menu = self.menuBar().addMenu(tr("Pane&ls"))

		###

		self.__spy_menu = self.menuBar().addMenu(tr("Sp&y"))
		self.__start_spy_action = self.__spy_menu.addAction(IconsLoader.icon("media-playback-start"),
			tr("Start Spy"), self.startSpy)
		self.__stop_spy_action = self.__spy_menu.addAction(IconsLoader.icon("media-playback-stop"),
			tr("Stop Spy"), self.stopSpy)
		self.__spy_menu.addSeparator()
		self.__spy_methods_menu = RadioButtonsMenu.RadioButtonsMenu(tr("Translate methods"), self.__spy_menu)
		self.__spy_methods_action = self.__spy_menu.addMenu(self.__spy_methods_menu)
		self.__stop_spy_action.setEnabled(False)

		###

		self.__view_menu = self.menuBar().addMenu(tr("&View"))
		self.__zoom_in_action = self.__view_menu.addAction(IconsLoader.icon("zoom-in"),
			tr("Zoom in"), self.__tabbed_translate_browser.zoomIn, Qt.QKeySequence("Ctrl++"))
		self.__zoom_out_action = self.__view_menu.addAction(IconsLoader.icon("zoom-out"),
			tr("Zoom out"), self.__tabbed_translate_browser.zoomOut, Qt.QKeySequence("Ctrl+-"))
		self.__zoom_normal_action = self.__view_menu.addAction(IconsLoader.icon("zoom-original"),
			tr("Zoom normal"), self.__tabbed_translate_browser.zoomNormal, Qt.QKeySequence("Ctrl+0"))

		###

		self.__tools_menu = self.menuBar().addMenu(tr("&Tools"))
		self.__dicts_manager_action = self.__tools_menu.addAction(IconsLoader.icon("configure"),
			tr("Dicts management"), self.__dicts_manager_window.show, Qt.QKeySequence("Ctrl+D"))
		self.__settings_action = self.__tools_menu.addAction(IconsLoader.icon("configure"),
			tr("Settings"), self.__settings_window.show)

		###

		self.__help_menu = self.menuBar().addMenu(tr("&Help"))
		self.__help_action = self.__help_menu.addAction(IconsLoader.icon("help-contents"),
			tr("%1 manual").arg(Const.Package), self.__help_browser_window.show, Qt.QKeySequence("F1"))
		self.__help_menu.addSeparator()
		internet_links_menu = InternetLinksMenu.InternetLinksMenu(tr("Internet links"), self.__help_menu)
		internet_links_menu.setIcon(IconsLoader.icon("applications-internet"))
		self.__links_action = self.__help_menu.addMenu(internet_links_menu)
		self.__help_menu.addSeparator()
		self.__about_action = self.__help_menu.addAction(IconsLoader.icon("xsl"),
			tr("About %1").arg(Const.MyName), self.__about_window.show)
		self.__about_qt_action = self.__help_menu.addAction(IconsLoader.icon("help-about"),
			tr("About Qt4"), lambda : Qt.QMessageBox.aboutQt(None))

		#####

		self.__sl_search_panel = SlSearchPanel.SlSearchPanel(self)
		self.__sl_search_panel.setObjectName("sl_search_panel")
		self.addPanel(self.__sl_search_panel)
		self.addSourceObject(self.__sl_search_panel)

		self.__history_panel = HistoryPanel.HistoryPanel(self)
		self.__history_panel.setObjectName("history_panel")
		self.addPanel(self.__history_panel)

		self.__google_translate_panel = GoogleTranslatePanel.GoogleTranslatePanel(self)
		self.__google_translate_panel.setObjectName("google_translate_panel")
		self.addPanel(self.__google_translate_panel)
		self.addSourceObject(self.__google_translate_panel)

		#####

		self.connect(self.__settings, Qt.SIGNAL("settingsChanged(const QString &)"), self.applySettingsTrayIcon)

		self.connect(self.__sl_search_panel, Qt.SIGNAL("wordChanged(const QString &)"), self.__history_panel.addWord)

		self.connect(self.__history_panel, Qt.SIGNAL("wordChanged(const QString &)"), self.__sl_search_panel.setWord)
		self.connect(self.__history_panel, Qt.SIGNAL("wordChanged(const QString &)"), self.__sl_search_panel.show)
		self.connect(self.__history_panel, Qt.SIGNAL("statusChanged(const QString &)"), self.__status_bar.showStatusMessage)

		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("uFindRequest(const QString &)"), self.__sl_search_panel.setWord)
		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("uFindRequest(const QString &)"), self.__sl_search_panel.uFind)
		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("uFindRequest(const QString &)"), self.__sl_search_panel.show)
		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("cFindRequest(const QString &)"), self.__sl_search_panel.setWord)
		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("cFindRequest(const QString &)"), self.__sl_search_panel.cFind)
		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("cFindRequest(const QString &)"), self.__sl_search_panel.show)
		self.connect(self.__tabbed_translate_browser, Qt.SIGNAL("statusChanged(const QString &)"), self.__status_bar.showStatusMessage)

		self.connect(self.__translate_window, Qt.SIGNAL("newTabRequest()"), self.addTab)
		self.connect(self.__translate_window, Qt.SIGNAL("uFindRequest(const QString &)"), self.__sl_search_panel.setWord)
		self.connect(self.__translate_window, Qt.SIGNAL("uFindRequest(const QString &)"), self.__sl_search_panel.uFind)
		self.connect(self.__translate_window, Qt.SIGNAL("uFindRequest(const QString &)"), self.__sl_search_panel.show)
		self.connect(self.__translate_window, Qt.SIGNAL("uFindRequest(const QString &)"), self.showUp)
		self.connect(self.__translate_window, Qt.SIGNAL("cFindRequest(const QString &)"), self.__sl_search_panel.setWord)
		self.connect(self.__translate_window, Qt.SIGNAL("cFindRequest(const QString &)"), self.__sl_search_panel.cFind)
		self.connect(self.__translate_window, Qt.SIGNAL("cFindRequest(const QString &)"), self.__sl_search_panel.show)
		self.connect(self.__translate_window, Qt.SIGNAL("cFindRequest(const QString &)"), self.showUp)

		self.connect(self.__dicts_manager_window, Qt.SIGNAL("dictsListChanged(const QStringList &)"), self.__sl_search_panel.setDictsList)
		self.connect(self.__dicts_manager_window, Qt.SIGNAL("dictsListChanged(const QStringList &)"), lambda : self.__sl_search_panel.lFind())

		self.connect(self.__spy, Qt.SIGNAL("selectionChanged(const QString &)"), self.spySelectionChanged)
		self.connect(self.__spy, Qt.SIGNAL("showTranslateWindowRequest()"), self.__translate_window.show)
		self.connect(self.__spy, Qt.SIGNAL("showTranslateWindowRequest()"), self.__translate_window.setFocus)

		self.connect(self.__tray_icon, Qt.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.controlAct)

		if sys.modules.has_key("KeysGrabber") :
			self.connect(self.__keys_grabber, Qt.SIGNAL("keyPressed(const QString &)"), self.controlAct)
Пример #19
0
	def __init__(self, dict_state_flag, dict_name, parent = None) :
		Qt.QWidget.__init__(self, parent)

		if self.font().pixelSize() > 0 :
			self.setFixedHeight((self.font().pixelSize()) * 4)
		elif self.font().pointSize() > 0 :
			self.setFixedHeight((self.font().pointSize()) * 4)
		else :
			self.setFixedHeight(40)

		#####

		self.__main_layout = Qt.QHBoxLayout()
		self.__main_layout.setContentsMargins(2, 0, 0, 0)
		self.__main_layout.setSpacing(0)
		self.setLayout(self.__main_layout)

		self.__vertical_grab_widget = VerticalGrabWidget.VerticalGrabWidget(self)
		self.__main_layout.addWidget(self.__vertical_grab_widget)

		self.__enable_dict_checkbox_layout = Qt.QVBoxLayout()
		self.__enable_dict_checkbox_layout.setContentsMargins(5, 5, 5, 5)
		self.__enable_dict_checkbox_layout.setSpacing(3)
		self.__main_layout.addLayout(self.__enable_dict_checkbox_layout)

		self.__vertical_frame1 = Qt.QFrame(self)
		self.__vertical_frame1.setFrameStyle(Qt.QFrame.VLine|Qt.QFrame.Sunken)
		self.__main_layout.addWidget(self.__vertical_frame1)

		self.__dict_info_layout = Qt.QVBoxLayout()
		self.__dict_info_layout.setContentsMargins(10, 1, 10, 1)
		self.__dict_info_layout.setSpacing(1)
		self.__main_layout.addLayout(self.__dict_info_layout)

		self.__dict_name_layout = Qt.QHBoxLayout()
		self.__dict_info_layout.addLayout(self.__dict_name_layout)

		self.__dict_details_layout = Qt.QHBoxLayout()
		self.__dict_info_layout.addLayout(self.__dict_details_layout)

		#####

		self.__dict_name = Qt.QString(dict_name)

		self.__css = Css.Css(self)
		self.__dict_info_window = None

		#####

		self.__enable_dict_checkbox = Qt.QCheckBox(self)
		self.__enable_dict_checkbox.setChecked(dict_state_flag)
		self.__enable_dict_checkbox_layout.addWidget(self.__enable_dict_checkbox)

		###

		self.__dict_caption_label = Qt.QLabel(self)
		self.__dict_caption_label.setTextFormat(Qt.Qt.RichText)
		self.__dict_name_layout.addWidget(self.__dict_caption_label)

		self.__dict_name_layout.addStretch()

		self.__dict_direction_label = Qt.QLabel(self)
		self.__dict_direction_label.setTextFormat(Qt.Qt.RichText)
		self.__dict_name_layout.addWidget(self.__dict_direction_label)

		self.__dict_details_layout.addItem(Qt.QSpacerItem(40, 0))

		self.__dict_full_direction_label = Qt.QLabel(self)
		self.__dict_full_direction_label.setTextFormat(Qt.Qt.RichText)
		self.__dict_details_layout.addWidget(self.__dict_full_direction_label)

		self.__dict_details_layout.insertSpacing(0, 10)
		self.__dict_details_layout.addStretch()

		###

		self.__show_info_button = Qt.QToolButton(self)
		self.__show_info_button.setIcon(IconsLoader.icon("help-about"))
		self.__show_info_button.setIconSize(Qt.QSize(16, 16))
		self.__show_info_button.setCursor(Qt.Qt.ArrowCursor)
		self.__show_info_button.setAutoRaise(True)
		self.__dict_details_layout.addWidget(self.__show_info_button)

		#####

		self.connect(self.__css, Qt.SIGNAL("cssChanged()"), self.setCaptions)

		self.connect(self.__enable_dict_checkbox, Qt.SIGNAL("stateChanged(int)"), self.stateChangedSignal)
		self.connect(self.__show_info_button, Qt.SIGNAL("clicked()"), self.showDictInfo)

		#####

		self.translateUi()
Пример #20
0
	def __init__(self, parent = None) :
		Qt.QDialog.__init__(self, parent)

		self.setWindowIcon(IconsLoader.icon("configure"))

		#####

		left_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutLeftMargin)
		top_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutTopMargin)
		right_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutRightMargin)
		bottom_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutBottomMargin)
		vertical_spacing = self.style().pixelMetric(Qt.QStyle.PM_LayoutVerticalSpacing)

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.setLayout(self.__main_layout)

		self.__tabs_layout = Qt.QHBoxLayout()
		self.__tabs_layout.setContentsMargins(0, 0, right_margin, 0)
		self.__main_layout.addLayout(self.__tabs_layout)

		self.__control_buttons_layout = Qt.QHBoxLayout()
		self.__control_buttons_layout.setContentsMargins(left_margin, vertical_spacing, right_margin, bottom_margin)
		self.__main_layout.addLayout(self.__control_buttons_layout)

		#####

		self.__settings = Settings.Settings(self)

		self.__tab_items_dict = {}

		#####

		self.__tabs_list_browser = Qt.QListWidget(self)
		self.__tabs_list_browser.setAlternatingRowColors(True)
		self.__tabs_list_browser.setViewMode(Qt.QListWidget.IconMode)
		self.__tabs_list_browser.setIconSize(Qt.QSize(48, 48))
		self.__tabs_list_browser.setHorizontalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOff)
		self.__tabs_list_browser.setDragDropMode(Qt.QAbstractItemView.NoDragDrop)
		self.__tabs_layout.addWidget(self.__tabs_list_browser)

		self.__stacked_layout = Qt.QStackedLayout()
		self.__stacked_layout.setContentsMargins(left_margin, vertical_spacing, right_margin, bottom_margin)
		self.__tabs_layout.addLayout(self.__stacked_layout)

		###

		self.__control_buttons_layout.addStretch()

		self.__ok_button = Qt.QPushButton(self)
		self.__ok_button.setIcon(IconsLoader.icon("dialog-ok"))
		self.__ok_button.setAutoDefault(False)
		self.__ok_button.setDefault(False)
		self.__control_buttons_layout.addWidget(self.__ok_button)

		self.__apply_button = Qt.QPushButton(self)
		self.__apply_button.setIcon(IconsLoader.icon("dialog-ok-apply"))
		self.__apply_button.setAutoDefault(False)
		self.__apply_button.setDefault(False)
		self.__control_buttons_layout.addWidget(self.__apply_button)

		self.__cancel_button = Qt.QPushButton(self)
		self.__cancel_button.setIcon(IconsLoader.icon("dialog-cancel"))
		self.__cancel_button.setAutoDefault(False)
		self.__cancel_button.setDefault(False)
		self.__control_buttons_layout.addWidget(self.__cancel_button)

		#####

		self.addSettingsTab(MiscSettingsTab.MiscSettingsTab(self))
		self.addSettingsTab(NetworkSettingsTab.NetworkSettingsTab(self))
		self.addSettingsTab(SpySettingsTab.SpySettingsTab(self))
		self.addSettingsTab(CssSettingsTab.CssSettingsTab(self))

		#####

		self.connect(self.__tabs_list_browser, Qt.SIGNAL("currentRowChanged(int)"), self.__stacked_layout.setCurrentIndex)

		self.connect(self.__ok_button, Qt.SIGNAL("clicked()"), self.accept)
		self.connect(self.__apply_button, Qt.SIGNAL("clicked()"), self.saveSettingsSignal)
		self.connect(self.__cancel_button, Qt.SIGNAL("clicked()"), self.reject)

		#####

		self.__tabs_list_browser.setCurrentRow(0)
		self.__stacked_layout.setCurrentIndex(0)

		self.translateUi()
Пример #21
0
	def __init__(self, dict_name, parent = None) :
		Qt.QDialog.__init__(self, parent)

		self.setWindowIcon(IconsLoader.icon("xsl"))

		self.setMinimumSize(550, 400)
		self.resize(550, 400)

		#####

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.__main_layout.setSpacing(0)
		self.setLayout(self.__main_layout)

		self.__dict_info_browser_layout = Qt.QVBoxLayout()
		self.__dict_info_browser_layout.setContentsMargins(0, 0, 0, 0)
		self.__dict_info_browser_layout.setSpacing(0)
		self.__main_layout.addLayout(self.__dict_info_browser_layout)

		self.__control_buttons_layout = Qt.QHBoxLayout()
		self.__control_buttons_layout.setContentsMargins(6, 6, 6, 6)
		self.__control_buttons_layout.setSpacing(6)
		self.__main_layout.addLayout(self.__control_buttons_layout)

		#####

		self.__dict_name = Qt.QString(dict_name)
		self.__info_loaded_flag = False

		self.__sl_dicts_info = SlDictsInfo.SlDictsInfo(self)

		#####

		self.__dict_info_browser = TextBrowser.TextBrowser(self)
		self.__dict_info_browser_layout.addWidget(self.__dict_info_browser)

		self.__wait_picture_movie = IconsLoader.gifMovie("circular")
		icon_width = icon_height = self.style().pixelMetric(Qt.QStyle.PM_SmallIconSize)
		self.__wait_picture_movie.setScaledSize(Qt.QSize(icon_width, icon_height))
		self.__wait_picture_movie.jumpToFrame(0)
		self.__wait_picture_movie_label = Qt.QLabel(self)
		self.__wait_picture_movie_label.setMovie(self.__wait_picture_movie)
		self.__wait_picture_movie_label.hide()
		self.__control_buttons_layout.addWidget(self.__wait_picture_movie_label)

		self.__wait_message_label = Qt.QLabel(self)
		self.__wait_message_label.hide()
		self.__control_buttons_layout.addWidget(self.__wait_message_label)

		self.__control_buttons_layout.addStretch()

		self.__update_info_button = Qt.QPushButton(self)
		self.__update_info_button.setIcon(IconsLoader.icon("view-refresh"))
		self.__control_buttons_layout.addWidget(self.__update_info_button)

		self.__ok_button = Qt.QPushButton(self)
		self.__ok_button.setIcon(IconsLoader.icon("dialog-ok-apply"))
		self.__ok_button.setDefault(True)
		self.__control_buttons_layout.addWidget(self.__ok_button)

		#####

		self.connect(self.__update_info_button, Qt.SIGNAL("clicked()"), self.updateInfo)
		self.connect(self.__ok_button, Qt.SIGNAL("clicked()"), self.accept)

		#####

		self.translateUi()
Пример #22
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("xsl_48"),
			"title" : Qt.QT_TR_NOOP("Spy"),
		}
Пример #23
0
	def __init__(self, parent = None) :
		Qt.QDialog.__init__(self, parent)

		self.setWindowIcon(IconsLoader.icon("xsl"))

		#####

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.__main_layout.setSpacing(0)
		self.setLayout(self.__main_layout)

		#####

		self.__index_file_url = Qt.QUrl()

		self.__settings = Settings.Settings(self)
		self.__locale = Locale.Locale()

		#####

		self.__text_browser = TextBrowser.TextBrowser(self)
		self.__text_browser_layout = Qt.QHBoxLayout()
		self.__text_browser_layout.setAlignment(Qt.Qt.AlignLeft|Qt.Qt.AlignTop)
		self.__text_browser.setLayout(self.__text_browser_layout)
		self.__main_layout.addWidget(self.__text_browser)

		###

		self.__control_buttons_frame = TransparentFrame.TransparentFrame(self)
		self.__control_buttons_frame_layout = Qt.QHBoxLayout()
		self.__control_buttons_frame_layout.setContentsMargins(0, 0, 0, 0)
		self.__control_buttons_frame.setLayout(self.__control_buttons_frame_layout)
		self.__text_browser_layout.addWidget(self.__control_buttons_frame)

		self.__backward_button = Qt.QToolButton(self)
		self.__backward_button.setIcon(IconsLoader.icon("go-previous"))
		self.__backward_button.setIconSize(Qt.QSize(22, 22))
		self.__backward_button.setCursor(Qt.Qt.ArrowCursor)
		self.__backward_button.setAutoRaise(True)
		self.__backward_button.setEnabled(False)
		self.__control_buttons_frame_layout.addWidget(self.__backward_button)

		self.__forward_button = Qt.QToolButton(self)
		self.__forward_button.setIcon(IconsLoader.icon("go-next"))
		self.__forward_button.setIconSize(Qt.QSize(22, 22))
		self.__forward_button.setCursor(Qt.Qt.ArrowCursor)
		self.__forward_button.setAutoRaise(True)
		self.__forward_button.setEnabled(False)
		self.__control_buttons_frame_layout.addWidget(self.__forward_button)

		self.__vertical_frame1 = Qt.QFrame(self)
		self.__vertical_frame1.setFrameStyle(Qt.QFrame.VLine|Qt.QFrame.Sunken)
		self.__control_buttons_frame_layout.addWidget(self.__vertical_frame1)

		self.__home_button = Qt.QToolButton(self)
		self.__home_button.setIcon(IconsLoader.icon("go-home"))
		self.__home_button.setIconSize(Qt.QSize(22, 22))
		self.__home_button.setCursor(Qt.Qt.ArrowCursor)
		self.__home_button.setAutoRaise(True)
		self.__control_buttons_frame_layout.addWidget(self.__home_button)

		self.__control_buttons_frame.setFixedSize(self.__control_buttons_frame_layout.minimumSize())

		###

		self.__tools_buttons_frame = TransparentFrame.TransparentFrame(self)
		self.__tools_buttons_frame_layout = Qt.QHBoxLayout()
		self.__tools_buttons_frame_layout.setContentsMargins(0, 0, 0, 0)
		self.__tools_buttons_frame.setLayout(self.__tools_buttons_frame_layout)
		self.__text_browser_layout.addWidget(self.__tools_buttons_frame)

		self.__show_text_search_frame_button = Qt.QToolButton(self)
		self.__show_text_search_frame_button.setIcon(IconsLoader.icon("edit-find"))
		self.__show_text_search_frame_button.setIconSize(Qt.QSize(22, 22))
		self.__show_text_search_frame_button.setCursor(Qt.Qt.ArrowCursor)
		self.__show_text_search_frame_button.setAutoRaise(True)
		self.__tools_buttons_frame_layout.addWidget(self.__show_text_search_frame_button)

		self.__tools_buttons_frame.setFixedSize(self.__tools_buttons_frame_layout.minimumSize())

		###

		self.__text_search_frame = TextSearchFrame.TextSearchFrame(self)
		self.__text_search_frame.hide()
		self.__main_layout.addWidget(self.__text_search_frame)

		#####

		self.connect(self.__text_search_frame, Qt.SIGNAL("findNextRequest(const QString &)"), self.__text_browser.findNext)
		self.connect(self.__text_search_frame, Qt.SIGNAL("findPreviousRequest(const QString &)"), self.__text_browser.findPrevious)
		self.connect(self.__text_search_frame, Qt.SIGNAL("instantSearchRequest(const QString &)"), self.__text_browser.instantSearch)

		self.connect(self.__text_browser, Qt.SIGNAL("backwardRequest()"), self.__backward_button.animateClick)

		self.connect(self.__backward_button, Qt.SIGNAL("clicked()"), self.__text_browser.backward)
		self.connect(self.__forward_button, Qt.SIGNAL("clicked()"), self.__text_browser.forward)
		self.connect(self.__home_button, Qt.SIGNAL("clicked()"), self.home)

		self.connect(self.__show_text_search_frame_button, Qt.SIGNAL("clicked()"), self.__text_search_frame.show)

		self.connect(self.__text_browser, Qt.SIGNAL("showTextSearchFrameRequest()"), self.__text_search_frame.show)
		self.connect(self.__text_browser, Qt.SIGNAL("hideTextSearchFrameRequest()"), self.__text_search_frame.hide)
		self.connect(self.__text_browser, Qt.SIGNAL("setFoundRequest(bool)"), self.__text_search_frame.setFound)
		self.connect(self.__text_browser, Qt.SIGNAL("sourceChanged(const QUrl &)"), self.updateTitle)
		self.connect(self.__text_browser, Qt.SIGNAL("backwardAvailable(bool)"), self.__backward_button.setEnabled)
		self.connect(self.__text_browser, Qt.SIGNAL("forwardAvailable(bool)"), self.__forward_button.setEnabled)

		#####

		Qt.QDesktopServices.setUrlHandler("xslhelp", self.showInternalHelp)

		self.translateUi()
Пример #24
0
	def __init__(self, parent = None) :
		PopupWindow.PopupWindow.__init__(self, parent)

		#####

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.__main_layout.setSpacing(0)
		self.setLayout(self.__main_layout)

		self.__caption_frame = Qt.QFrame(self)
		self.__caption_frame.setMouseTracking(True)
		self.__caption_frame.setFrameShape(Qt.QFrame.Box)
		self.__caption_frame.setFrameShadow(Qt.QFrame.Raised)
		if self.font().pixelSize() > 0 :
			self.__caption_frame.setMaximumHeight((self.font().pixelSize()) * 4)
		elif self.font().pointSize() > 0 :
			self.__caption_frame.setMaximumHeight((self.font().pointSize()) * 4)
		else :
			self.__caption_frame.setMaximumHeight(40)
		self.__main_layout.addWidget(self.__caption_frame)

		self.__caption_frame_layout = Qt.QHBoxLayout()
		self.__caption_frame_layout.setContentsMargins(20, 1, 2, 1)
		self.__caption_frame_layout.setSpacing(1)
		self.__caption_frame.setLayout(self.__caption_frame_layout)

		#####

		self.__settings = Settings.Settings(self)

		self.__css = Css.Css()

		#####

		self.__caption_label = Qt.QLabel(self)
		self.__caption_label.setTextFormat(Qt.Qt.RichText)
		self.__caption_label.setWordWrap(True)
		self.__caption_frame_layout.addWidget(self.__caption_label)

		self.__close_button = Qt.QToolButton(self)
		self.__close_button.setIcon(IconsLoader.icon("dialog-cancel"))
		self.__close_button.setIconSize(Qt.QSize(16, 16))
		self.__close_button.setFixedSize(Qt.QSize(16, 16))
		self.__close_button.setCursor(Qt.Qt.ArrowCursor)
		self.__close_button.setAutoRaise(True)
		self.__caption_frame_layout.addWidget(self.__close_button)

		self.__translate_browser = TranslateBrowser.TranslateBrowser(self)
		self.__main_layout.addWidget(self.__translate_browser)

		self.__text_search_frame = TextSearchFrame.TextSearchFrame(self)
		self.__text_search_frame.hide()
		self.__main_layout.addWidget(self.__text_search_frame)

		#####

		self.connect(self.__close_button, Qt.SIGNAL("clicked()"), self.close)

		self.connect(self.__translate_browser, Qt.SIGNAL("showTextSearchFrameRequest()"), self.__text_search_frame.show)
		self.connect(self.__translate_browser, Qt.SIGNAL("hideTextSearchFrameRequest()"), self.__text_search_frame.hide)
		self.connect(self.__translate_browser, Qt.SIGNAL("setFoundRequest(bool)"), self.__text_search_frame.setFound)
		self.connect(self.__translate_browser, Qt.SIGNAL("newTabRequest()"), self.newTabRequestSignal)
		self.connect(self.__translate_browser, Qt.SIGNAL("uFindRequest(const QString &)"), self.uFindRequestSignal)
		self.connect(self.__translate_browser, Qt.SIGNAL("cFindRequest(const QString &)"), self.cFindRequestSignal)

		self.connect(self.__text_search_frame, Qt.SIGNAL("findNextRequest(const QString &)"), self.__translate_browser.findNext)
		self.connect(self.__text_search_frame, Qt.SIGNAL("findPreviousRequest(const QString &)"), self.__translate_browser.findPrevious)
		self.connect(self.__text_search_frame, Qt.SIGNAL("instantSearchRequest(const QString &)"), self.__translate_browser.instantSearch)

		self.connect(self.__close_button, Qt.SIGNAL("clicked()"), self.close)
Пример #25
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("network-wired"),
			"title" : Qt.QT_TR_NOOP("Network"),
		}
Пример #26
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("text-css"),
			"title" : Qt.QT_TR_NOOP("Style Sheets"),
		}
Пример #27
0
	def requisites(self) :
		return {
			"icon" : IconsLoader.icon("configure"),
			"title" : Qt.QT_TR_NOOP("Misc"),
		}
Пример #28
0
	def __init__(self, parent = None) :
		Qt.QDialog.__init__(self, parent)

		self.setWindowIcon(IconsLoader.icon("xsl"))

		#####

		left_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutLeftMargin)
		top_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutTopMargin)
		right_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutRightMargin)
		bottom_margin = self.style().pixelMetric(Qt.QStyle.PM_LayoutBottomMargin)
		vertical_spacing = self.style().pixelMetric(Qt.QStyle.PM_LayoutVerticalSpacing)

		self.__main_layout = Qt.QVBoxLayout()
		self.__main_layout.setContentsMargins(0, 0, 0, 0)
		self.setLayout(self.__main_layout)

		self.__line_edit_layout = Qt.QHBoxLayout()
		self.__line_edit_layout.setContentsMargins(left_margin, top_margin, right_margin, vertical_spacing)
		self.__main_layout.addLayout(self.__line_edit_layout)

		self.__dicts_browser_stacked_layout = Qt.QStackedLayout()
		self.__main_layout.addLayout(self.__dicts_browser_stacked_layout)

		self.__control_buttons_layout = Qt.QHBoxLayout()
		self.__control_buttons_layout.setContentsMargins(left_margin, vertical_spacing, right_margin, bottom_margin)
		self.__main_layout.addLayout(self.__control_buttons_layout)

		self.__message_labels_stacked_widget = Qt.QStackedWidget()
		self.__control_buttons_layout.addWidget(self.__message_labels_stacked_widget)

		#####

		self.__settings = Settings.Settings(self)

		self.__all_dicts_dir_watcher = Qt.QFileSystemWatcher(Qt.QStringList() << Const.AllDictsDirPath, self)
		self.__all_dicts_dir_watcher_timer = Qt.QTimer(self)
		self.__all_dicts_dir_watcher_timer.setInterval(5000)
		self.__all_dicts_dir_watcher_timer.setSingleShot(True)

		#####

		self.__filter_label = Qt.QLabel(self)
		self.__line_edit_layout.addWidget(self.__filter_label)

		self.__line_edit = LineEdit.LineEdit(self)
		self.__filter_label.setBuddy(self.__line_edit)
		self.__line_edit_layout.addWidget(self.__line_edit)

		self.__dicts_browser = DictsListWidget.DictsListWidget(self)
		self.__dicts_browser_stacked_layout.addWidget(self.__dicts_browser)

		self.__wait_picture_movie = IconsLoader.gifMovie("circular")
		self.__wait_picture_movie.setScaledSize(Qt.QSize(32, 32))
		self.__wait_picture_movie.jumpToFrame(0)
		self.__wait_picture_movie_label = Qt.QLabel(self)
		self.__wait_picture_movie_label.setAlignment(Qt.Qt.AlignHCenter|Qt.Qt.AlignVCenter)
		self.__wait_picture_movie_label.setMovie(self.__wait_picture_movie)
		self.__dicts_browser_stacked_layout.addWidget(self.__wait_picture_movie_label)

		self.__install_dicts_label = Qt.QLabel(self)
		self.__install_dicts_label.setOpenExternalLinks(True)
		self.__install_dicts_label.setTextFormat(Qt.Qt.RichText)
		self.__message_labels_stacked_widget.addWidget(self.__install_dicts_label)

		self.__wait_message_label = Qt.QLabel(self)
		self.__message_labels_stacked_widget.addWidget(self.__wait_message_label)

		self.__control_buttons_layout.addStretch()

		self.__update_dicts_button = Qt.QPushButton(self)
		self.__update_dicts_button.setIcon(IconsLoader.icon("view-refresh"))
		self.__update_dicts_button.setAutoDefault(False)
		self.__update_dicts_button.setDefault(False)
		self.__control_buttons_layout.addWidget(self.__update_dicts_button)

		self.__ok_button = Qt.QPushButton(self)
		self.__ok_button.setIcon(IconsLoader.icon("dialog-ok-apply"))
		self.__ok_button.setAutoDefault(False)
		self.__ok_button.setDefault(False)
		self.__control_buttons_layout.addWidget(self.__ok_button)

		self.__message_labels_stacked_widget.setMaximumHeight(self.__control_buttons_layout.minimumSize().height())

		#####

		self.connect(self.__all_dicts_dir_watcher, Qt.SIGNAL("directoryChanged(const QString &)"), self.planToUpdateDicts)
		self.connect(self.__all_dicts_dir_watcher_timer, Qt.SIGNAL("timeout()"), self.updateDicts)

		self.connect(self.__line_edit, Qt.SIGNAL("textChanged(const QString &)"), self.__dicts_browser.setFilter)

		self.connect(self.__dicts_browser, Qt.SIGNAL("dictsListChanged(const QStringList &)"), self.dictsListChangedSignal)

		self.connect(self.__update_dicts_button, Qt.SIGNAL("clicked()"), self.updateDicts)
		self.connect(self.__ok_button, Qt.SIGNAL("clicked()"), self.accept)

		#####

		self.__dicts_browser_stacked_layout.setCurrentIndex(0)
		self.__message_labels_stacked_widget.setCurrentIndex(0)

		self.translateUi()