Python set window title

35 Python code examples are found related to " set window title". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: mainwindow.py    From tellurium with Apache License 2.0 7 votes vote down vote up
def set_window_title(self):
        """Set window title."""
        if DEV is not None:
            title = u"Spyder %s (Python %s.%s)" % (__version__,
                                                   sys.version_info[0],
                                                   sys.version_info[1])
        else:
            title = u"Spyder (Python %s.%s)" % (sys.version_info[0],
                                                sys.version_info[1])

        if DEBUG:
            title += u" [DEBUG MODE %d]" % DEBUG

        if self.window_title is not None:
            title += u' -- ' + to_text_string(self.window_title)

        if self.projects is not None:
            path = self.projects.get_active_project_path()
            if path:
                path = path.replace(get_home_dir(), u'~')
                title = u'{0} - {1}'.format(path, title)

        self.base_title = title
        self.setWindowTitle(self.base_title) 
Example 2
Source File: FileSystemWidget.py    From pyrdp with GNU General Public License v3.0 7 votes vote down vote up
def setWindowTitle(self, title: str):
        """
        Set the window title. When the title is not blank, a title label and a separator is displayed.
        :param title: the new title.
        """

        previousTitle = self.windowTitle()

        super().setWindowTitle(title)

        self.titleLabel.setText(title)

        if previousTitle == "" and title != "":
            self.verticalLayout.insertWidget(0, self.titleLabel)
            self.verticalLayout.insertWidget(1, self.titleSeparator)
        elif title == "" and previousTitle != "":
            self.verticalLayout.removeWidget(self.titleLabel)
            self.verticalLayout.removeWidget(self.titleSeparator)

            # noinspection PyTypeChecker
            self.titleLabel.setParent(None)

            # noinspection PyTypeChecker
            self.titleSeparator.setParent(None) 
Example 3
Source File: mpv_opengl.py    From kawaii-player with GNU General Public License v3.0 6 votes vote down vote up
def set_window_title_and_epn(self, title=None, row=None):
        if title is None:
            if isinstance(row, int) and row < self.ui.list2.count():
                item = gui.list2.item(row)
            else:
                item = gui.list2.item(gui.cur_row)
            if item:
                epn = item.text()
            else:
                epn = "Unknown"
            if epn.startswith(gui.check_symbol):
                epn = epn[1:]
        else:
            epn = title
        MainWindow.windowTitleChanged.emit(epn)
        gui.epn_name_in_list = epn
        self.mpv.command("show-text", epn, 2000) 
Example 4
Source File: wizard.py    From stdm with GNU General Public License v2.0 5 votes vote down vote up
def set_window_title(self):
        if self.draft_config:
            self.setWindowTitle('')
            draft = self.tr(u' - [ DRAFT ]')
            self.setWindowTitle(u'{}{}'.format(self.tmp_title, draft))
        else:
            self.setWindowTitle(self.tmp_title) 
Example 5
Source File: backend_bases.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def set_window_title(self, title):
        """
        Set the title text of the window containing the figure.  Note that
        this has no effect if there is no window (e.g., a PS backend).
        """
        if hasattr(self, "manager"):
            self.manager.set_window_title(title) 
Example 6
Source File: CTitleBar.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def setWindowTitle(self, title):
        """设置标题
        :param title:
        """
        self.labelTitle.setText(title) 
Example 7
Source File: io.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def set_window_title_full_path(self) -> None:
        """Set the option 'window title will show the full path'."""
        file_name = self.project_widget.file_name()
        if self.prefer.title_full_path_option:
            title = file_name.absoluteFilePath()
        else:
            title = file_name.completeBaseName()
        self.setWindowTitle(
            f"Pyslvs - {title}{'*' if self.project_widget.changed() else ''}") 
Example 8
Source File: Base.py    From three.py with MIT License 5 votes vote down vote up
def setWindowTitle(self, text):
        pygame.display.set_caption(text)

    # WARNING: calling this method loses the original OpenGL context;
    #   only use before calling OpenGL functions 
Example 9
Source File: cmd2.py    From cmd2 with MIT License 5 votes vote down vote up
def set_window_title(self, title: str) -> None:  # pragma: no cover
        """Set the terminal window title.

        Raises a `RuntimeError` if called while another thread holds `terminal_lock`.

        IMPORTANT: This function will not set the title unless it can acquire self.terminal_lock to avoid writing
                   to stderr while a command is running. Therefore it is best to acquire the lock before calling
                   this function to guarantee the title changes and to avoid raising a RuntimeError.

        :param title: the new window title
        """
        if not vt100_support:
            return

        # Sanity check that can't fail if self.terminal_lock was acquired before calling this function
        if self.terminal_lock.acquire(blocking=False):
            try:
                sys.stderr.write(ansi.set_title_str(title))
                sys.stderr.flush()
            except AttributeError:
                # Debugging in Pycharm has issues with setting terminal title
                pass
            finally:
                self.terminal_lock.release()

        else:
            raise RuntimeError("another thread holds terminal_lock") 
Example 10
Source File: addonwindow.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def setWindowTitle(self, title=''):
        """
        Set window title.
        This method must be called AFTER (!!!) setGeometry(),
        otherwise there is some werid bug with all skin text labels set to the 'title' text.
        Example:
        self.setWindowTitle('My Cool Addon')
        """
        self.title_bar.setLabel(title) 
Example 11
Source File: wasm_backend.py    From pyodide with Mozilla Public License 2.0 5 votes vote down vote up
def set_window_title(self, title):
        top = self.get_element("top")
        self._title = title
        if top is not None:
            top.textContent = title

    # def resize_event(self):
    #     # TODO
    #     pass

    # def close_event(self):
    #     # TODO
    #     pass 
Example 12
Source File: mainwindow.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def set_window_title(self):
        """Set the title of the console window"""
        old_title = self.windowTitle()
        title, ok = QtGui.QInputDialog.getText(self,
                                               "Rename Window",
                                               "New title:",
                                               text=old_title)
        if ok:
            self.setWindowTitle(title) 
Example 13
Source File: Shared.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def setActiveWindowTitle(title):
    """Sets the title of the currently active MDI window, as long as it is a scripting window"""

    mw = FreeCADGui.getMainWindow()
    mdi = mw.findChild(QtGui.QMdiArea)

    # We cannot trust the current subwindow to be a script window, it may be the associated 3D view
    mdiWin = mdi.currentSubWindow()

    if mdiWin == 0 or ".py" not in mdiWin.windowTitle():
        subList = mdi.subWindowList()

        for sub in subList:
            if sub.windowTitle() == mdiWin.windowTitle() + ".py":
                mdiWin = sub

    # Change the window title if there is something there to change
    if (mdiWin != 0):
        mdiWin.setWindowTitle(title)

        cqCodePane = mdiWin.findChild(QtGui.QPlainTextEdit)
        cqCodePane.setObjectName("cqCodePane_" + title.split('.')[0]) 
Example 14
Source File: cli.py    From EvilOSX with GNU General Public License v3.0 5 votes vote down vote up
def set_window_title(self, text):
        """
        :type text: str
        """
        self._header.set_text(text)
        self._async_reload() 
Example 15
Source File: mainwindow.py    From qtconsole with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def set_window_title(self):
        """Set the title of the console window"""
        old_title = self.windowTitle()
        title, ok = QtWidgets.QInputDialog.getText(self,
                                                   "Rename Window",
                                                   "New title:",
                                                   text=old_title)
        if ok:
            self.setWindowTitle(title) 
Example 16
Source File: view.py    From RebirthItemTracker with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def set_window_title_info(self, watching=None, uploading=None, watching_player=None, update_notifier=None, updates_queued=None ):
        if watching is not None:
            self.window_title_info.watching = watching
        if uploading is not None:
            self.window_title_info.uploading = uploading
        if watching_player is not None:
            self.window_title_info.watching_player = watching_player
        if update_notifier is not None:
            self.window_title_info.update_notifier = update_notifier
        if updates_queued is not None:
            self.window_title_info.updates_queued = updates_queued

        self.update_window_title() 
Example 17
Source File: MainWindow.py    From PyEngine3D with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def set_window_title(self, title):
        self.root.title(title)

    # ------------------------- #
    # Menu
    # ------------------------- # 
Example 18
Source File: session.py    From eddy with GNU General Public License v3.0 5 votes vote down vote up
def setWindowTitle(self, project, diagram=None):
        """
        Set the main window title.
        :type project: Project
        :type diagram: Diagram
        """
        title = '{0} - [{1}]'.format(project.name, shortPath(project.path))
        if diagram:
            title = '{0} - {1}'.format(diagram.name, title)
        super().setWindowTitle(title) 
Example 19
Source File: windows.py    From qtmodern with MIT License 5 votes vote down vote up
def setWindowTitle(self, title):
        """ Set window title.

            Args:
                title (str): Title.
        """

        super(ModernWindow, self).setWindowTitle(title)
        self.lblTitle.setText(title) 
Example 20
Source File: host.py    From pypsrp with MIT License 5 votes vote down vote up
def SetWindowTitle(self, runspace, pipeline, title):
        """
        MI: 42
        SHOULD set the view window size based on the size specified.

        :param runspace: The runspace the host call relates to
        :param pipeline: The pipeline (if any) that the call relates to
        :param title: The string for the window title to set
        """
        self.window_title = title 
Example 21
Source File: glfw.py    From pg with MIT License 5 votes vote down vote up
def set_window_title(window, title):
    '''
    Sets the title of the specified window.

    Wrapper for:
        void glfwSetWindowTitle(GLFWwindow* window, const char* title);
    '''
    _glfw.glfwSetWindowTitle(window, _to_char_p(title)) 
Example 22
Source File: main.py    From MDT with GNU Lesser General Public License v3.0 5 votes vote down vote up
def set_window_title(self, title):
        if title is None:
            self.setWindowTitle('MDT Maps Visualizer')
        else:
            self.setWindowTitle('MDT Maps Visualizer - {}'.format(title)) 
Example 23
Source File: cmd2.py    From WebPocket with GNU General Public License v3.0 5 votes vote down vote up
def set_window_title(self, title: str) -> None:  # pragma: no cover
        """
        Set the terminal window title

        IMPORTANT: This function will not set the title unless it can acquire self.terminal_lock to avoid
                   writing to stderr while a command is running. Therefore it is best to acquire the lock
                   before calling this function to guarantee the title changes.

        :param title: the new window title
        :raises RuntimeError if called while another thread holds terminal_lock
        """
        if not vt100_support:
            return

        # Sanity check that can't fail if self.terminal_lock was acquired before calling this function
        if self.terminal_lock.acquire(blocking=False):
            try:
                import colorama.ansi as ansi
                sys.stderr.write(ansi.set_title(title))
            except AttributeError:
                # Debugging in Pycharm has issues with setting terminal title
                pass
            finally:
                self.terminal_lock.release()

        else:
            raise RuntimeError("another thread holds terminal_lock") 
Example 24
Source File: newgui.py    From ibeis with Apache License 2.0 5 votes vote down vote up
def setWindowTitle(ibswgt, title):
        parent_ = ibswgt.parent()
        if parent_ is not None:
            parent_.setWindowTitle(title)
        else:
            IBEIS_WIDGET_BASE.setWindowTitle(ibswgt, title) 
Example 25
Source File: backend_bases.py    From matplotlib-4-abaqus with MIT License 5 votes vote down vote up
def set_window_title(self, title):
        """
        Set the title text of the window containing the figure.  Note that
        this has no effect if there is no window (eg, a PS backend).
        """
        if hasattr(self, "manager"):
            self.manager.set_window_title(title) 
Example 26
Source File: window.py    From ImEditor with GNU General Public License v3.0 5 votes vote down vote up
def set_window_title(self, tab):
        title = '[{}] - {}'.format(path.basename(tab.editor.image.filename),
            'ImEditor')
        if tab.zoom_level != 100:
            title += ' - {}%'.format(tab.zoom_level)
        self.set_title(title)