mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 14:21:33 +03:00
Ignore all but one last Pyright error
(on pyright v1.1.314)
This commit is contained in:
parent
26cf8c3e64
commit
96b2d08789
@ -33,7 +33,7 @@ from textual.widgets import Button, Static, Input, Header, RadioSet, RadioButton
|
|||||||
from textual.binding import Binding
|
from textual.binding import Binding
|
||||||
from textual.color import Color, ColorParseError
|
from textual.color import Color, ColorParseError
|
||||||
from PIL import Image, UnidentifiedImageError
|
from PIL import Image, UnidentifiedImageError
|
||||||
from pyfiglet import Figlet, FigletFont
|
from pyfiglet import Figlet, FigletFont # type: ignore
|
||||||
|
|
||||||
from .menus import MenuBar, Menu, MenuItem, Separator
|
from .menus import MenuBar, Menu, MenuItem, Separator
|
||||||
from .windows import Window, DialogWindow, CharacterSelectorDialogWindow, MessageBox, get_warning_icon, get_question_icon, get_paint_icon
|
from .windows import Window, DialogWindow, CharacterSelectorDialogWindow, MessageBox, get_warning_icon, get_question_icon, get_paint_icon
|
||||||
@ -2194,9 +2194,9 @@ class Canvas(Widget):
|
|||||||
return min_index <= cell_index <= max_index
|
return min_index <= cell_index <= max_index
|
||||||
assert isinstance(self.app, PaintApp)
|
assert isinstance(self.app, PaintApp)
|
||||||
if (
|
if (
|
||||||
(self.magnifier_preview_region and magnifier_preview_region.contains(x, y) and (not inner_magnifier_preview_region.contains(x, y))) or
|
(self.magnifier_preview_region and magnifier_preview_region.contains(x, y) and (not inner_magnifier_preview_region.contains(x, y))) or # type: ignore
|
||||||
(self.select_preview_region and select_preview_region.contains(x, y) and (not inner_select_preview_region.contains(x, y))) or
|
(self.select_preview_region and select_preview_region.contains(x, y) and (not inner_select_preview_region.contains(x, y))) or # type: ignore
|
||||||
(sel and (not sel.textbox_mode) and (self.app.selection_drag_offset is None) and selection_region.contains(x, y) and (not inner_selection_region.contains(x, y))) or
|
(sel and (not sel.textbox_mode) and (self.app.selection_drag_offset is None) and selection_region.contains(x, y) and (not inner_selection_region.contains(x, y))) or # type: ignore
|
||||||
(sel and sel.textbox_mode and within_text_selection_highlight(sel))
|
(sel and sel.textbox_mode and within_text_selection_highlight(sel))
|
||||||
):
|
):
|
||||||
# invert the colors
|
# invert the colors
|
||||||
@ -3611,7 +3611,7 @@ Columns: {len(palette) // 2}
|
|||||||
# TODO: avoid redundant encoding/decoding, if it's not too much trouble to make things bytes|str.
|
# TODO: avoid redundant encoding/decoding, if it's not too much trouble to make things bytes|str.
|
||||||
text = content.decode("utf-8")
|
text = content.decode("utf-8")
|
||||||
# TODO: Copy as other formats. No Python libraries support this well yet.
|
# TODO: Copy as other formats. No Python libraries support this well yet.
|
||||||
import pyperclip
|
import pyperclip # type: ignore
|
||||||
pyperclip.copy(text)
|
pyperclip.copy(text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.message_box(_("Paint"), _("Failed to copy to the clipboard."), "ok", error=e)
|
self.message_box(_("Paint"), _("Failed to copy to the clipboard."), "ok", error=e)
|
||||||
@ -3622,7 +3622,7 @@ Columns: {len(palette) // 2}
|
|||||||
"""Paste the clipboard (ANSI art allowed), either as a selection, or into a textbox."""
|
"""Paste the clipboard (ANSI art allowed), either as a selection, or into a textbox."""
|
||||||
try:
|
try:
|
||||||
# TODO: paste other formats. No Python libraries support this well yet.
|
# TODO: paste other formats. No Python libraries support this well yet.
|
||||||
import pyperclip
|
import pyperclip # type: ignore
|
||||||
text: str = pyperclip.paste()
|
text: str = pyperclip.paste()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.message_box(_("Paint"), _("Error getting the Clipboard Data!"), "ok", error=e)
|
self.message_box(_("Paint"), _("Error getting the Clipboard Data!"), "ok", error=e)
|
||||||
|
@ -95,7 +95,7 @@ def set_wallpaper(file_loc: str, first_run: bool = True):
|
|||||||
from gi.repository import Gio # type: ignore
|
from gi.repository import Gio # type: ignore
|
||||||
SCHEMA = "org.gnome.desktop.background"
|
SCHEMA = "org.gnome.desktop.background"
|
||||||
KEY = "picture-uri"
|
KEY = "picture-uri"
|
||||||
gsettings = Gio.Settings.new(SCHEMA)
|
gsettings = Gio.Settings.new(SCHEMA) # type: ignore
|
||||||
gsettings.set_string(KEY, uri)
|
gsettings.set_string(KEY, uri)
|
||||||
except Exception:
|
except Exception:
|
||||||
args = ["gsettings", "set", "org.gnome.desktop.background", "picture-uri", uri]
|
args = ["gsettings", "set", "org.gnome.desktop.background", "picture-uri", uri]
|
||||||
@ -217,7 +217,7 @@ def get_config_dir(app_name: str):
|
|||||||
config_home = os.environ['APPDATA']
|
config_home = os.environ['APPDATA']
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
from xdg import BaseDirectory
|
from xdg import BaseDirectory # type: ignore
|
||||||
config_home = BaseDirectory.xdg_config_home
|
config_home = BaseDirectory.xdg_config_home
|
||||||
except ImportError: # Most likely a Linux/Unix system anyway
|
except ImportError: # Most likely a Linux/Unix system anyway
|
||||||
config_home = os.path.join(get_home_dir(), ".config")
|
config_home = os.path.join(get_home_dir(), ".config")
|
||||||
|
Loading…
Reference in New Issue
Block a user