예제 #1
0
 def textEdit(self):
     ret = QtWidgets.QPlainTextEdit()
     ret.setToolTip(my.tr("Messages"))
     #ret.setAcceptRichText(True)
     ret.setReadOnly(True)
     skqss.class_(ret, 'texture')
     return ret
예제 #2
0
 def _refresh(self):
     """
 @param  text  unicode
 @return  unicode
 """
     text = self.textEdit.toPlainText()
     pattern = self.patternEdit.text().strip()
     repl = self.replaceEdit.text().strip()
     r = self.regexCheckBox.isChecked()
     i = self.icaseCheckBox.isChecked()
     result = text
     try:
         if r and i:
             rx = re.compile(pattern, re.IGNORECASE | re.DOTALL)
             result = rx.sub(repl, text)
         elif r:
             result = re.sub(pattern, repl, text)
         elif i:
             pattern = re.escape(pattern)
             rx = re.compile(pattern, re.IGNORECASE | re.DOTALL)
             result = rx.sub(repl, text)
         else:
             result = text.replace(pattern, repl)
         matched = result != text
         message = tr_("Found") if matched else tr_("Not found")
         skqss.class_(self.messageEdit, 'default')
         self.messageEdit.setText(message)
     except Exception, e:
         skqss.class_(self.messageEdit, 'error')
         message = e.message or "%s" % e
         self.messageEdit.setText(message)
예제 #3
0
 def __init__(self, parent=None):
     WINDOW_FLAGS = Qt.Dialog | Qt.WindowMinMaxButtonsHint
     super(GameEditor, self).__init__(parent, WINDOW_FLAGS)
     skqss.class_(self, 'texture')
     #self.setWindowTitle(self.tr("Edit Game Properties"))
     self.__d = _GameEditor(self)
     self.setMinimumWidth(350)
예제 #4
0
 def titleEdit(self):
     ret = QtWidgets.QLineEdit()
     skqss.class_(ret, 'editable')
     ret.setPlaceholderText(tr_("Title"))
     ret.setToolTip(tr_("Title"))
     ret.textChanged.connect(self._refreshSaveButton)
     return ret
예제 #5
0
 def helpButton(self):
     ret = QtWidgets.QPushButton(tr_("Help"))
     skqss.class_(ret, 'btn btn-default')
     ret.setToolTip(tr_("Help"))
     #ret.setStatusTip(ret.toolTip())
     ret.clicked.connect(main.manager().showReferenceHelp)
     return ret
예제 #6
0
 def newPostButton(self):
     ret = QtWidgets.QPushButton("+ " + tr_("Reply"))
     skqss.class_(ret, 'btn btn-primary')
     ret.setToolTip(tr_("New"))
     #ret.setStatusTip(ret.toolTip())
     ret.clicked.connect(self._newPost)
     return ret
예제 #7
0
    def navigationToolBar(self):
        ret = QtWidgets.QToolBar()
        ret.setGraphicsEffect(ui.createGlowEffect(ret))
        skqss.class_(ret, 'webkit toolbar toolbar-nav')

        a = ret.addAction(u"\u25c0")  # left triangle
        a.triggered.connect(self.back)
        a.setToolTip(u"%s (Ctrl+[, Alt+←, %s: ←)" %
                     (tr_("Back"), i18n.tr("Gesture")))

        a = ret.addAction(u"\u25B6")  # right triangle
        a.triggered.connect(self.forward)
        a.setToolTip(u"%s (Ctrl+], Alt+→, %s: →)" %
                     (tr_("Forward"), i18n.tr("Gesture")))

        #a = ret.addAction(u'\u27f3') # circle
        a = ret.addAction(u"◯")  # まる
        a.triggered.connect(self.refresh)
        a.setToolTip(u"%s (Ctrl+R, %s: ↑↓)" %
                     (tr_("Refresh"), i18n.tr("Gesture")))

        #a = ret.addAction(u"\u238c")
        a = ret.addAction(u"←")  # ひだり
        a.triggered.connect(self.undoCloseTab)
        a.setToolTip(u"%s (Ctrl+Shift+T, %s: ←→)" %
                     (i18n.tr("Undo close tab"), i18n.tr("Gesture")))

        a = ret.addAction(u"+")  # fullwidth +
        a.triggered.connect(self.zoomIn)
        a.setToolTip(u"%s (Ctrl+=)" % tr_("Zoom In"))

        a = ret.addAction(u"ー")  # fullwidth -
        a.triggered.connect(self.zoomIn)
        a.setToolTip(u"%s (Ctrl+-)" % tr_("Zoom Out"))
        return ret
예제 #8
0
 def __init__(self, parent=None):
   WINDOW_FLAGS = Qt.Dialog|Qt.WindowMinMaxButtonsHint
   super(VirtualKeyInputDialog, self).__init__(parent, WINDOW_FLAGS)
   skqss.class_(self, 'texture')
   self.setWindowTitle(mytr_("Shortcuts"))
   self.setWindowIcon(rc.icon('window-shortcuts'))
   self.__d = _VirtualKeyInputDialog(self)
예제 #9
0
 def previousContextEdit(self):
   ret = QtWidgets.QPlainTextEdit()
   skqss.class_(ret, 'readonly texture')
   ret.setReadOnly(True)
   ret.setToolTip(mytr_("Game text"))
   ret.setMinimumHeight(TEXTEDIT_MINIMUM_HEIGHT)
   return ret
예제 #10
0
 def newTopicButton(self):
   ret = QtWidgets.QPushButton("+ " + tr_("Topic"))
   skqss.class_(ret, 'btn btn-success')
   ret.setToolTip(tr_("New"))
   #ret.setStatusTip(ret.toolTip())
   ret.clicked.connect(self._newTopic)
   return ret
예제 #11
0
 def saveButton(self):
   ret = QtWidgets.QPushButton(tr_("Save"))
   ret.setToolTip("Ctrl+S")
   skqss.class_(ret, 'btn btn-primary')
   ret.clicked.connect(self.save)
   ret.setDefault(True)
   return ret
예제 #12
0
 def gameButton(self):
   ret = QtWidgets.QPushButton(tr_("Game"))
   skqss.class_(ret, 'btn btn-info')
   ret.setToolTip(tr_("Game"))
   #ret.setStatusTip(ret.toolTip())
   ret.clicked.connect(self._showGame)
   return ret
예제 #13
0
    def _createUi(self, q):
        textEdit = QtWidgets.QPlainTextEdit()
        textEdit.setToolTip("BBCode")
        #textEdit.setAcceptRichText(False)
        skqss.class_(textEdit, 'normal')

        textView = QtWidgets.QTextBrowser()
        skqss.class_(textView, 'texture')
        textView.setToolTip("HTML")
        textView.setReadOnly(True)
        textView.setOpenExternalLinks(True)

        textEdit.textChanged.connect(
            lambda: textView.setHtml(self.toHtml(textEdit.toPlainText())))

        textEdit.setPlainText(
            """You can use this [u]tester[/u] to play with [url=http://en.wikipedia.org/wiki/BBCode][color=blue]BBCode[/color][/url]
that you could use to format [color=red]subtitles[/color].""")

        #textEdit.resize(300, 200)

        center = QtWidgets.QSplitter(Qt.Vertical)
        center.setChildrenCollapsible(False)
        center.addWidget(textEdit)
        center.addWidget(textView)
        q.setCentralWidget(center)
예제 #14
0
  def __init__(self, parent=None):
    super(SelectFilePage, self).__init__(parent)
    self.setTitle(my.tr("Select game executable"))

    introLabel = QtWidgets.QLabel(my.tr("Please select the game executable's location"))
    introLabel.setWordWrap(True)

    self._edit = QtWidgets.QLineEdit()
    self._edit.setPlaceholderText(tr_("Location"))
    self._edit.textChanged.connect(self._validateEdit)
    self._edit.textChanged.connect(self.completeChanged)

    self._browseButton = QtWidgets.QPushButton(tr_("Browse") + " ...")
    skqss.class_(self._browseButton, 'btn btn-info')
    self._browseButton.clicked.connect(self._browse)

    #self._applocButton = QtWidgets.QCheckBox(my.tr("Open in Japanese locale (0x0411) using AppLocale"))
    #self._applocButton.toggled.connect(settings.global_().setApplocEnabled)

    #self._tzButton = QtWidgets.QCheckBox(my.tr("Open in Japanese time zone (+9 Asia/Tokyo)"))
    #self._tzButton.toggled.connect(settings.global_().setTimeZoneEnabled)

    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(introLabel)

    row = QtWidgets.QHBoxLayout()
    row.addWidget(self._edit)
    row.addWidget(self._browseButton)
    layout.addLayout(row)
    #layout.addWidget(self._applocButton)
    #layout.addWidget(self._tzButton)
    self.setLayout(layout)
예제 #15
0
 def stopButton(self):
     ret = QtWidgets.QPushButton(tr_("Stop"))
     skqss.class_(ret, 'btn btn-danger')
     ret.setToolTip(my.tr("Stop recording audio"))
     ret.clicked.connect(self.stop)
     ret.setEnabled(False)
     return ret
예제 #16
0
 def __init__(self, parent=None):
   WINDOW_FLAGS = Qt.Dialog|Qt.WindowMinMaxButtonsHint
   super(SubtitleEditor, self).__init__(parent, WINDOW_FLAGS)
   skqss.class_(self, 'texture')
   self.setWindowTitle(mytr_("Subtitle Editor"))
   self.setWindowIcon(rc.icon('window-textedit'))
   self.__d = _SubtitleEditor(self)
예제 #17
0
 def submitButton(self):
     ret = QtWidgets.QPushButton(tr_("Lookup"))
     ret.setToolTip(tr_("Lookup"))
     ret.setDefault(True)
     skqss.class_(ret, 'btn btn-primary')
     ret.clicked.connect(self.submit)
     return ret
예제 #18
0
 def cancelButton(self):
     ret = QtWidgets.QPushButton(tr_("Cancel"))
     ret.setToolTip(tr_("Cancel"))
     skqss.class_(ret, 'btn btn-default')
     #ret.setDefault(True)
     ret.clicked.connect(self.q.hide)
     return ret
예제 #19
0
 def tabBar(self):
     ret = WbTabBar()
     skqss.class_(ret, 'webkit')
     # FIXME: Enable glowing effect will cause issue for Flash
     #ret.setGraphicsEffect(ui.createGlowEffect(ret))
     #ret.doubleClickedAt.connect(self.newTabAfter)
     return ret
예제 #20
0
 def rubyEdit(self):
     ret = QtWidgets.QLineEdit()
     skqss.class_(ret, 'normal')
     ret.setPlaceholderText(my.tr("Note above or after the translation"))
     ret.setToolTip(ret.placeholderText())
     ret.textChanged.connect(self.refresh)
     return ret
예제 #21
0
    def optionToolBar(self):
        ret = QtWidgets.QToolBar()
        ret.setGraphicsEffect(ui.createGlowEffect(ret))
        skqss.class_(ret, 'webkit toolbar toolbar-opt')

        a = self.siteAct = ret.addAction(u"遊")
        a.setCheckable(True)
        a.setEnabled(False)  # disable on startup
        a.setToolTip(i18n.tr("Display subtitles for the game site"))
        #a.setMenu(self.siteMenu)
        a.triggered.connect(self._injectSite)
        btn = ret.widgetForAction(a)
        btn.setPopupMode(QtWidgets.QToolButton.InstantPopup)

        a = self.annotAct = ret.addAction(u"訳")
        a.setCheckable(True)
        a.setToolTip(i18n.tr("Settings for all sites"))
        a.setMenu(self.annotMenu)
        btn = ret.widgetForAction(a)
        btn.setPopupMode(QtWidgets.QToolButton.InstantPopup)
        a.setChecked(self.isAnnotEnabled())

        a = ret.addAction(
            u"≡")  # U+226, three lines; alternative: "⌘", U+2318 コマンド記号
        a.setToolTip(i18n.tr("Global settings"))
        a.setMenu(self.optionMenu)
        #a.triggered.connect(a.menu().exec_)
        # https://bugreports.qt-project.org/browse/QTBUG-1453
        btn = ret.widgetForAction(a)
        btn.setPopupMode(QtWidgets.QToolButton.InstantPopup)
        return ret
예제 #22
0
 def _createTtsButton():
     ret = QtWidgets.QPushButton(u"♪")  # おんぷ
     skqss.class_(ret, 'btn btn-default btn-toggle')
     ret.setToolTip(mytr_("TTS"))
     ret.setMaximumWidth(18)
     ret.setMaximumHeight(18)
     return ret
예제 #23
0
 def __init__(self, parent=None):
     WINDOW_FLAGS = Qt.Dialog | Qt.WindowMinMaxButtonsHint
     super(TopicInput, self).__init__(parent, WINDOW_FLAGS)
     skqss.class_(self, 'texture')
     self.setWindowTitle(mytr_("New Topic"))
     self.setWindowIcon(rc.icon('window-textedit'))
     self.__d = _TopicInput(self)
예제 #24
0
 def textEdit(self):
     ret = QtWidgets.QLineEdit()
     skqss.class_(ret, 'normal')
     ret.setPlaceholderText(mytr_("Replaced text"))
     ret.setToolTip(ret.placeholderText())
     ret.textChanged.connect(self.refresh)
     return ret
예제 #25
0
 def textView(self):
     ret = QtWidgets.QTextBrowser()
     skqss.class_(ret, 'texture')
     ret.setToolTip(tr_("Target"))
     ret.setOpenExternalLinks(True)
     #ret.setAcceptRichText(False)
     return ret
예제 #26
0
 def searchButton(self):
     ret = QtWidgets.QPushButton(tr_("Search"))
     skqss.class_(ret, 'btn btn-success')
     ret.setToolTip(tr_("Search") + " (Enter)")
     #ret.setStatusTip(ret.toolTip())
     ret.clicked.connect(self._search)
     return ret
예제 #27
0
    def locationGroup(self):
        introLabel = QtWidgets.QLabel(
            my.
            tr("""You can specify a different executable to launch the game process.
By default it is the same as the executable of the game process."""))
        introLabel.setWordWrap(True)

        #launchLabel = QtWidgets.QLabel(mytr_("Launcher"))
        #launchLabel.setBuddy(self.launchEdit)

        browseLaunchButton = QtWidgets.QPushButton(tr_("Browse"))
        browseLaunchButton.clicked.connect(self._browseLaunchPath)
        skqss.class_(browseLaunchButton, 'btn btn-info')

        layout = QtWidgets.QVBoxLayout()
        launchRow = QtWidgets.QHBoxLayout()
        #launchRow.addWidget(launchLabel)
        launchRow.addWidget(self.launchEdit)
        launchRow.addWidget(browseLaunchButton)
        launchRow.addWidget(self.resetLaunchButton)
        layout.addLayout(launchRow)
        layout.addWidget(introLabel)

        ret = QtWidgets.QGroupBox(my.tr("Alternative launcher location"))
        ret.setLayout(layout)
        return ret
예제 #28
0
 def pasteButton(self):
     ret = QtWidgets.QPushButton(tr_("Paste"))
     skqss.class_(ret, 'btn btn-default')
     ret.setToolTip(tr_("Paste"))
     #ret.setStatusTip(ret.toolTip())
     ret.clicked.connect(self._paste)
     return ret
예제 #29
0
  def _refresh(self):
    ok = self.isComplete()
    self._saveButton.setEnabled(ok)
    skqss.class_(self._hookEdit, 'normal' if ok else 'error')

    hooked = bool(texthook.global_().currentHookCode())
    self._deleteButton.setEnabled(hooked)
예제 #30
0
 def nameEdit(self):
     ret = QtWidgets.QLineEdit()
     skqss.class_(ret, 'normal')
     ret.setPlaceholderText(tr_("Not specified"))
     ret.setToolTip(my.tr("The game name displayed on the Spring Board"))
     ret.setStatusTip(ret.toolTip())
     ret.textChanged.connect(self._saveName)
     return ret