From 5b2d6b70dae30028ec3751cd98e485666e263326 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sun, 3 Mar 2024 01:13:41 +0330 Subject: [PATCH] cleanup: remove, rename or ignore unused codes and vars --- conf/defaults/en_US.UTF-8/hijri.json | 1 - conf/defaults/fa_IR.UTF-8/hijri.json | 1 - pyproject.toml | 20 ++- scal3/account/google.py | 7 +- scal3/bin_heap.py | 2 +- scal3/cal_types/__init__.py | 3 - scal3/cal_types/ethiopian.py | 4 - scal3/cal_types/gregorian.py | 6 +- scal3/cal_types/gregorian_proleptic.py | 4 - scal3/cal_types/hijri.py | 14 +- scal3/cal_types/indian_national.py | 6 +- scal3/cal_types/jalali.py | 4 - scal3/cal_types/julian.py | 3 - scal3/color_utils.py | 8 -- scal3/core.py | 68 ++------- scal3/date_utils.py | 4 +- scal3/event_lib.py | 14 +- scal3/locale_man.py | 4 +- scal3/plugin_man.py | 14 +- scal3/time_utils.py | 2 +- scal3/ui.py | 5 - scal3/ui_gtk/customize_dialog.py | 2 +- scal3/ui_gtk/day_cal_window.py | 2 +- scal3/ui_gtk/event/common.py | 10 +- scal3/ui_gtk/event/editor.py | 2 +- scal3/ui_gtk/event/event/allDayTask.py | 4 +- scal3/ui_gtk/event/event/custom.py | 8 +- scal3/ui_gtk/event/event/dailyNote.py | 2 +- scal3/ui_gtk/event/event/largeScale.py | 4 +- scal3/ui_gtk/event/event/lifetime.py | 2 +- scal3/ui_gtk/event/event/monthly.py | 2 +- scal3/ui_gtk/event/event/task.py | 4 +- scal3/ui_gtk/event/event/universityExam.py | 2 +- scal3/ui_gtk/event/event/weekly.py | 2 +- scal3/ui_gtk/event/event/yearly.py | 4 +- scal3/ui_gtk/event/export.py | 14 +- scal3/ui_gtk/event/group/editor.py | 4 +- scal3/ui_gtk/event/group/group.py | 2 +- scal3/ui_gtk/event/group/universityTerm.py | 30 ++-- scal3/ui_gtk/event/group_op.py | 4 +- scal3/ui_gtk/event/history.py | 12 +- scal3/ui_gtk/event/import_event.py | 8 +- scal3/ui_gtk/event/manager.py | 129 +++++++++--------- scal3/ui_gtk/event/notifier/alarm.py | 22 +-- scal3/ui_gtk/event/notifier/windowMsg.py | 4 +- scal3/ui_gtk/event/occurrence_view.py | 16 +-- scal3/ui_gtk/event/register_starcal.py | 8 +- scal3/ui_gtk/event/rule/ex_dates.py | 14 +- scal3/ui_gtk/event/search_events.py | 42 +++--- scal3/ui_gtk/event/tags.py | 6 +- scal3/ui_gtk/event/trash.py | 2 +- scal3/ui_gtk/export.py | 10 +- scal3/ui_gtk/gtk_ud.py | 4 +- scal3/ui_gtk/hijri.py | 20 +-- scal3/ui_gtk/layout.py | 2 +- scal3/ui_gtk/mainwin_items/labelBox.py | 30 ++-- scal3/ui_gtk/mainwin_items/monthCal.py | 10 +- scal3/ui_gtk/mainwin_items/toolbar.py | 2 +- scal3/ui_gtk/mainwin_items/weekCal.py | 28 ++-- scal3/ui_gtk/mywidgets/__init__.py | 21 ++- scal3/ui_gtk/mywidgets/button.py | 6 +- scal3/ui_gtk/mywidgets/cal_type_combo.py | 2 +- scal3/ui_gtk/mywidgets/clock.py | 4 +- scal3/ui_gtk/mywidgets/expander.py | 2 +- scal3/ui_gtk/mywidgets/floatingMsg.py | 12 +- scal3/ui_gtk/mywidgets/icon.py | 6 +- scal3/ui_gtk/mywidgets/label.py | 6 +- scal3/ui_gtk/mywidgets/multi_spin/__init__.py | 16 +-- .../multi_spin/option_box/__init__.py | 6 +- scal3/ui_gtk/mywidgets/num_ranges_entry.py | 2 +- scal3/ui_gtk/mywidgets/resize_button.py | 2 +- scal3/ui_gtk/mywidgets/source_editor.py | 2 +- scal3/ui_gtk/mywidgets/text_widgets.py | 22 +-- scal3/ui_gtk/mywidgets/tz_combo.py | 2 +- scal3/ui_gtk/mywidgets/ymd.py | 4 +- scal3/ui_gtk/player.py | 22 +-- scal3/ui_gtk/pluginsText.py | 26 ++-- scal3/ui_gtk/pref_utils.py | 28 ++-- scal3/ui_gtk/pref_utils_extra.py | 46 +++---- scal3/ui_gtk/preferences.py | 79 ++++++----- scal3/ui_gtk/right_panel.py | 10 +- scal3/ui_gtk/selectdate.py | 10 +- scal3/ui_gtk/stack.py | 4 +- scal3/ui_gtk/starcal.py | 84 ++++++------ scal3/ui_gtk/timeline.py | 46 +++---- scal3/ui_gtk/timeline_prefs.py | 8 +- scal3/ui_gtk/utils.py | 4 +- scal3/ui_gtk/winContronller.py | 16 +-- scal3/ui_gtk/windows.py | 2 +- scal3/ui_gtk/wizard.py | 4 +- scal3/ui_gtk/wizard_demo.py | 8 +- scal3/ui_gtk/year_wheel.py | 14 +- scal3/utils.py | 3 + 93 files changed, 567 insertions(+), 629 deletions(-) diff --git a/conf/defaults/en_US.UTF-8/hijri.json b/conf/defaults/en_US.UTF-8/hijri.json index c2521aed0..a2bcb8581 100644 --- a/conf/defaults/en_US.UTF-8/hijri.json +++ b/conf/defaults/en_US.UTF-8/hijri.json @@ -1,4 +1,3 @@ { - "hijriAlg": 0, "hijriUseDB": false } \ No newline at end of file diff --git a/conf/defaults/fa_IR.UTF-8/hijri.json b/conf/defaults/fa_IR.UTF-8/hijri.json index 805020aca..162da42ea 100644 --- a/conf/defaults/fa_IR.UTF-8/hijri.json +++ b/conf/defaults/fa_IR.UTF-8/hijri.json @@ -1,4 +1,3 @@ { - "hijriAlg": 0, "hijriUseDB": true } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9d52d9052..99323400a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ lint.select = [ "TID", # flake8-tidy-imports "TCH", # flake8-type-checking "INT", # flake8-gettext - # "ARG", # flake8-unused-arguments + "ARG", # flake8-unused-arguments # "PTH", # flake8-use-pathlib # "TD", # flake8-todos # "FIX", # flake8-fixme: just shows me FIXMEs and TODOs @@ -248,3 +248,21 @@ ignore = [ # refurb has no exclude param! #load = ["some_module"] #quiet = true + +[tool.vulture] +exclude = [ + "scal3/account/", + "*_test.py", + "scal3/ui_gtk/arch-enable-locale.py", +] +ignore_names = [ + "OPEN_START", + "validDate", + "prefVersion", + "getMonthWeekNth", + "rgbToInt", + "rgbToHsl", + "htmlColorToRgb", + "_*", + "test*", +] diff --git a/scal3/account/google.py b/scal3/account/google.py index fc6b625b5..5f7b97376 100644 --- a/scal3/account/google.py +++ b/scal3/account/google.py @@ -51,6 +51,11 @@ from scal3.locale_man import tr as _ from scal3.os_utils import openUrl from scal3.utils import toBytes, toStr +from scal3.os_utils import getUserDisplayName + + +userDisplayName = getUserDisplayName() + auth_local_webserver = True auth_host_name = "localhost" @@ -562,7 +567,7 @@ def addToDiff(key, here, status, *args): "calendarId": remoteGroupId, "sequence": group.index(event.id), "organizer": { - "displayName": core.userDisplayName, # FIXME + "displayName": userDisplayName, # FIXME "email": self.email, }, }) diff --git a/scal3/bin_heap.py b/scal3/bin_heap.py index dbdcce8f4..c688075e6 100644 --- a/scal3/bin_heap.py +++ b/scal3/bin_heap.py @@ -144,7 +144,7 @@ def deleteLessThan(self, key): """ -def getMinTest(N): +def testGetMin(N): from random import randint h = MaxHeap() diff --git a/scal3/cal_types/__init__.py b/scal3/cal_types/__init__.py index 249dafe88..446d17800 100644 --- a/scal3/cal_types/__init__.py +++ b/scal3/cal_types/__init__.py @@ -124,9 +124,6 @@ def iterIndexModuleInactive(self): for i in self.inactive: yield i, modules[i] - def allIndexes(self): - return self.active + self.inactive - def __contains__(self, key) -> bool: if isinstance(key, str): return key in self.byName diff --git a/scal3/cal_types/ethiopian.py b/scal3/cal_types/ethiopian.py index 69a89cb64..b00ca2ca8 100644 --- a/scal3/cal_types/ethiopian.py +++ b/scal3/cal_types/ethiopian.py @@ -56,10 +56,6 @@ def getMonthNameAb(tr, m, y=None): # noqa: ARG001 return monthNameAb[m - 1] -def getMonthsInYear(_y): - return 12 - - epoch = 1724235 minMonthLen = 30 maxMonthLen = 36 diff --git a/scal3/cal_types/gregorian.py b/scal3/cal_types/gregorian.py index 2a9b2741a..c6c111968 100644 --- a/scal3/cal_types/gregorian.py +++ b/scal3/cal_types/gregorian.py @@ -69,10 +69,6 @@ def getMonthNameAb(tr, m, y: "int | None" = None) -> str: # noqa: ARG001 return monthNameAb[m - 1] -def getMonthsInYear(_y: int) -> int: - return 12 - - epoch = 1721426 minMonthLen = 29 maxMonthLen = 31 @@ -147,7 +143,7 @@ def getMonthLen(y: int, m: int) -> int: return to_jd(y, m + 1, 1) - to_jd(y, m, 1) -J0001 = 1721426 # to_jd(1, 1, 1) +# J0001 = 1721426 # to_jd(1, 1, 1) J1970 = 2440588 # to_jd(1970, 1, 1) J0001_epoch = -62135621220 diff --git a/scal3/cal_types/gregorian_proleptic.py b/scal3/cal_types/gregorian_proleptic.py index fa842a66f..28253f156 100644 --- a/scal3/cal_types/gregorian_proleptic.py +++ b/scal3/cal_types/gregorian_proleptic.py @@ -65,10 +65,6 @@ def getMonthNameAb(tr, m, y=None): # noqa: ARG001 return monthNameAb[m - 1] -def getMonthsInYear(_y): - return 12 - - from math import floor diff --git a/scal3/cal_types/hijri.py b/scal3/cal_types/hijri.py index 6d671fd6a..373a32030 100644 --- a/scal3/cal_types/hijri.py +++ b/scal3/cal_types/hijri.py @@ -69,22 +69,14 @@ def getMonthNameAb(tr, m, y=None): # noqa: ARG001 return monthNameAb[m - 1] -def getMonthsInYear(_y): - return 12 - - epoch = 1948440 minMonthLen = 29 maxMonthLen = 30 avgYearLen = 354.3666 # FIXME - -hijriAlg = 0 hijriUseDB = True -# ("hijriAlg", list, "Hijri Calculation Algorithm", -# ("Internal", "ITL (idate command)", "ITL (idate command) Umm Alqura")), options = ( ( "hijriUseDB", @@ -144,7 +136,6 @@ def save(): __name__, confPath, ( - "hijriAlg", "hijriUseDB", ), ) @@ -302,7 +293,7 @@ def to_jd_c(year, month, day): def to_jd(year, month, day): - if hijriUseDB: # and hijriAlg == 0 + if hijriUseDB: jd = monthDb.getJdFromDate(year, month, day) if jd is not None: return jd @@ -310,7 +301,6 @@ def to_jd(year, month, day): def jd_to(jd): - # hijriAlg == 0 if hijriUseDB: # jd = ifloor(jd) date = monthDb.getDateFromJd(jd) @@ -328,7 +318,7 @@ def jd_to(jd): def getMonthLen(y, m): - # if hijriUseDB:## and hijriAlg==0 + # if hijriUseDB: # try: # return monthDb.monthLenByYm[y*12+m] # except KeyError: diff --git a/scal3/cal_types/indian_national.py b/scal3/cal_types/indian_national.py index 5d74865fd..15e03c8af 100644 --- a/scal3/cal_types/indian_national.py +++ b/scal3/cal_types/indian_national.py @@ -65,10 +65,6 @@ def getMonthNameAb(tr, m, y=None): # noqa: ARG001 return monthNameAb[m - 1] -def getMonthsInYear(_y): - return 12 - - # Monday Somavãra # Tuesday Mañgalvã # Wednesday Budhavãra @@ -157,7 +153,7 @@ def jd_to(jd): # the Indian year and subtracting off the required number of months and # days to get the final date - gregorianYear, gregorianMonth, gregorianDay = gregorian.jd_to(jd) + gregorianYear, _gregorianMonth, _gregorianDay = gregorian.jd_to(jd) jdGregorianFirstDayOfYear = gregorian.to_jd(gregorianYear, 1, 1) gregorianDayOfYear = jd - jdGregorianFirstDayOfYear + 1 diff --git a/scal3/cal_types/jalali.py b/scal3/cal_types/jalali.py index 3aff8fb3e..7d17a9532 100644 --- a/scal3/cal_types/jalali.py +++ b/scal3/cal_types/jalali.py @@ -152,10 +152,6 @@ def getMonthNameAb(tr, m, y=None): # noqa: ARG001 return tr(fullEn) -def getMonthsInYear(_y): - return 12 - - epoch = 1948321 minMonthLen = 29 maxMonthLen = 31 diff --git a/scal3/cal_types/julian.py b/scal3/cal_types/julian.py index ca1381acc..0e180f785 100644 --- a/scal3/cal_types/julian.py +++ b/scal3/cal_types/julian.py @@ -73,9 +73,6 @@ def getMonthNameAb(tr, m, y=None): # noqa: ARG001 return monthNameAb[m - 1] -def getMonthsInYear(_y): - return 12 - epoch = 1721058 minMonthLen = 28 diff --git a/scal3/color_utils.py b/scal3/color_utils.py index ed692448c..8712aa108 100644 --- a/scal3/color_utils.py +++ b/scal3/color_utils.py @@ -3,14 +3,6 @@ ColorType: "typing.TypeAlias" = "tuple[int,int,int] | tuple[int,int,int,int]" -def invertColor(r, g, b): - return ( - 255 - r, - 255 - g, - 255 - b, - ) - - def rgbToInt(r, g, b): """For example (170, 85, 52) or "#aa5534" becomes 0xaa5534.""" return b + g * 256 + r * 256**2 diff --git a/scal3/core.py b/scal3/core.py index e5c1ba53c..3364164d3 100644 --- a/scal3/core.py +++ b/scal3/core.py @@ -40,9 +40,6 @@ saveModuleJsonConf, ) from scal3.locale_man import tr as _ -from scal3.os_utils import ( - getUserDisplayName, -) from scal3.path import ( APP_NAME, confDir, @@ -51,9 +48,8 @@ sourceDir, sysConfDir, ) -from scal3.plugin_man import BasePlugin, loadPlugin -from scal3.time_utils import getEpochFromJd, getJhmsFromEpoch -from scal3.utils import versionLessThan +from scal3.plugin_man import loadPlugin +from scal3.time_utils import getJhmsFromEpoch try: __file__ @@ -71,12 +67,11 @@ APP_DESC = "StarCalendar" COMMAND = APP_NAME homePage = "http://ilius.github.io/starcal/" -userDisplayName = getUserDisplayName() # __plugin_api_get__ = [ # "VERSION", "APP_NAME", "APP_DESC", "COMMAND", -# "homePage", "osName", "userDisplayName" +# "homePage", "osName", # "jd_to_primary", "primary_to_jd", # ] # __plugin_api_set__ = [] @@ -155,7 +150,7 @@ def saveConf() -> None: log = logger.get() -fs = None # type: "s_object.FileSystem" +fs: s_object.FileSystem | None = None # ____________________________________________________________________ # # __________________ class and function defenitions __________________ # @@ -229,10 +224,10 @@ def getCurrentJd() -> int: return to_jd(y, m, d, GREGORIAN) -def getWeekDateHmsFromEpoch(epoch: int) -> tuple[int, int, int, int, int]: - jd, hms = getJhmsFromEpoch(epoch) - absWeekNumber, weekDay = getWeekDateFromJd(jd) - return (absWeekNumber, weekDay, hms.h, hms.m, hms.s) +# def getWeekDateHmsFromEpoch(epoch: int) -> tuple[int, int, int, int, int]: +# jd, hms = getJhmsFromEpoch(epoch) +# absWeekNumber, weekDay = getWeekDateFromJd(jd) +# return (absWeekNumber, weekDay, hms.h, hms.m, hms.s) def getMonthWeekNth(jd: int, calType: int) -> tuple[int, int, int]: @@ -241,7 +236,7 @@ def getMonthWeekNth(jd: int, calType: int) -> tuple[int, int, int]: year, month, day = jd_to(jd, calType) absWeekNumber, weekDay = getWeekDateFromJd(jd) ## - dayDiv, dayMode = divmod(day - 1, 7) + dayDiv = (day - 1) // 7 return month, dayDiv, weekDay @@ -312,12 +307,12 @@ def getWeekNumberByJd(jd: int) -> int: # return getWeekNumberByJd(primary_to_jd(year+1, 1, 1) - 7) -def getJdFromWeek(year: int, weekNumber: int) -> int: # FIXME - # weekDay == 0 - wd0 = getWeekDay(year, 1, 1) - 1 - wn0 = getWeekNumber(year, 1, 1, False) - jd0 = primary_to_jd(year, 1, 1) - return jd0 - wd0 + (weekNumber - wn0) * 7 +# def getJdFromWeek(year: int, weekNumber: int) -> int: # FIXME +# # weekDay == 0 +# wd0 = getWeekDay(year, 1, 1) - 1 +# wn0 = getWeekNumber(year, 1, 1, False) +# jd0 = primary_to_jd(year, 1, 1) +# return jd0 - wd0 + (weekNumber - wn0) * 7 def getWeekDateFromJd(jd: int) -> tuple[int, int]: @@ -411,15 +406,6 @@ def initPlugins(fs: "s_object.FileSystem") -> None: updatePlugins() -def getHolidayPlugins() -> list[BasePlugin]: - hPlugs = [] - for i in plugIndex: - plug = allPlugList[i] - if hasattr(plug, "holidays"): - hPlugs.append(plug) - return hPlugs - - def updatePlugins() -> None: for i in plugIndex: plug = allPlugList[i] @@ -479,19 +465,6 @@ def restart() -> typing.NoReturn: # _____________________________________________________ # -def mylocaltime( - sec: "int | None" = None, - calType: "int | None" = None, -) -> list[int]: - from scal3.cal_types import convert - - if calType is None: # GREGORIAN - return list(localtime(sec)) - t = list(localtime(sec)) - t[:3] = convert(t[0], t[1], t[2], GREGORIAN, calType) - return t - - def compressLongInt(num: int) -> str: """Num must be less than 2**64.""" from base64 import b64encode @@ -514,13 +487,6 @@ def getCompactTime(maxDays: int = 1000, minSec: float = 0.1) -> str: ) -def floatJdEncode(jd: int, calType: int) -> str: - jd, hms = getJhmsFromEpoch(getEpochFromJd(jd)) - if calType not in calTypes: - raise RuntimeError(f"cal type '{calType}' not found") - return dateEncode(jd_to(jd, calType)) + f" {hms:HMS}" - - def epochDateTimeEncode(epoch: int) -> str: jd, hms = getJhmsFromEpoch(epoch) return dateEncode(jd_to_primary(jd)) + f" {hms:HMS}" @@ -560,10 +526,6 @@ def init() -> None: initPlugins(fs) -def prefIsOlderThan(v: str) -> bool: - return versionLessThan(prefVersion, v) - - # ___________________________________________________________________________ # # __________________ End of class and function defenitions __________________ # diff --git a/scal3/date_utils.py b/scal3/date_utils.py index 1ef36a238..4e16164b0 100644 --- a/scal3/date_utils.py +++ b/scal3/date_utils.py @@ -15,8 +15,8 @@ def dateEncode(date: tuple[int, int, int]) -> str: return f"{date[0]:04d}/{date[1]:02d}/{date[2]:02d}" -def dateEncodeDash(date: tuple[int, int, int]) -> str: - return f"{date[0]:04d}-{date[1]:02d}-{date[2]:02d}" +# def dateEncodeDash(date: tuple[int, int, int]) -> str: +# return f"{date[0]:04d}-{date[1]:02d}-{date[2]:02d}" def checkDate(date: tuple[int, int, int]) -> None: diff --git a/scal3/event_lib.py b/scal3/event_lib.py index 68062980f..1bc5503d6 100644 --- a/scal3/event_lib.py +++ b/scal3/event_lib.py @@ -118,7 +118,7 @@ dayLen = 24 * 3600 icsMinStartYear = 1970 -icsMaxEndYear = 2050 +# icsMaxEndYear = 2050 eventsDir = join("event", "events") groupsDir = join("event", "groups") @@ -355,12 +355,10 @@ class classes: account = ClassGroup("account") -defaultEventTypeIndex = 0 # FIXME defaultGroupTypeIndex = 0 # FIXME __plugin_api_get__ = [ "classes", - "defaultEventTypeIndex", "defaultGroupTypeIndex", "EventRule", "EventNotifier", @@ -1045,8 +1043,8 @@ def calcOccurrence( event: "Event", # noqa: ARG002 ) -> OccurSet: calType = self.getCalType() - startYear, startMonth, startDay = jd_to(startJd, calType) - endYear, endMonth, endDay = jd_to(endJd, calType) + startYear, _startMonth, _startDay = jd_to(startJd, calType) + endYear, _endMonth, _endDay = jd_to(endJd, calType) jds = set() monthList = range(1, 13) if self.month == 0 else [self.month] for year in range(startYear, endYear): @@ -4022,7 +4020,7 @@ class EventGroup(EventContainer): desc = _("Event Group") canConvertTo = () actions = [] # [("Export to ICS", "exportToIcs")] - eventActions = [] # FIXME + # eventActions = [] # not implemented yet! eventCacheSizeMin = 0 # minimum cache size for events basicParams = EventContainer.basicParams + ( # "enable", # FIXME @@ -6271,10 +6269,10 @@ def stop(self): def fetchGroups(self): raise NotImplementedError - def fetchAllEventsInGroup(self, remoteGroupId): + def fetchAllEventsInGroup(self, _remoteGroupId): raise NotImplementedError - def sync(self, group, remoteGroupId): + def sync(self, _group, _remoteGroupId): raise NotImplementedError def getData(self): diff --git a/scal3/locale_man.py b/scal3/locale_man.py index a8018507e..97ef0ae9a 100644 --- a/scal3/locale_man.py +++ b/scal3/locale_man.py @@ -80,7 +80,7 @@ def saveConf() -> None: ########################################################## langDir = join(sourceDir, "conf", "lang") -localeDir = "/usr/share/locale" +# localeDir = "/usr/share/locale" # point FIXME digits = { @@ -115,7 +115,7 @@ def getLangDigits( # except for Zero that is named ARABIC-INDIC DIGIT ZERO in unicode database LRM = "\u200e" # left to right mark -RLM = "\u200f" # right to left mark +# RLM = "\u200f" # right to left mark ZWNJ = "\u200c" # zero width non-joiner ZWJ = "\u200d" # zero width joiner diff --git a/scal3/plugin_man.py b/scal3/plugin_man.py index e92ab3659..2b287fcf6 100644 --- a/scal3/plugin_man.py +++ b/scal3/plugin_man.py @@ -173,7 +173,7 @@ def updateCell(self, c): text += t if self.lastDayMerge and d >= module.minMonthLen: # and d <= module.maxMonthLen: - ny, nm, nd = jd_to(c.jd + 1, self.calType) + ny, nm, _nd = jd_to(c.jd + 1, self.calType) if nm > m or ny > y: nt = self.getText(y, m, d + 1) if nt: @@ -193,9 +193,6 @@ def exportToIcs(self, fileName, startJd, endJd): myear, mmonth, mday = jd_to(jd, calType) dayText = self.getText(myear, mmonth, mday) if dayText: - gyear, gmonth, gday = jd_to(jd, GREGORIAN) - gyear2, gmonth2, gday2 = jd_to(jd + 1, GREGORIAN) - ####### icsText += ( "\n".join( [ @@ -228,8 +225,6 @@ class DummyExternalPlugin(BasePlugin): show_date = False about = "" authors = [] - hasConfig = False - hasImage = False def __repr__(self): return f"loadPlugin({self.file!r}, enable=False, show_date=False)" @@ -237,6 +232,8 @@ def __repr__(self): def __init__(self, _file, title): self.file = _file self.title = title + self.hasConfig = False + self.hasImage = False # TODO: switch to fs @@ -386,7 +383,7 @@ def dateIsHoliday(self, calType, y, m, d, jd): and d == hd - 1 and hd >= module.minMonthLen ): - ny, nm, nd = jd_to(jd + 1, calType) + ny, nm, _nd = jd_to(jd + 1, calType) if (ny, nm) > (y, m): return True @@ -415,9 +412,6 @@ def exportToIcs(self, fileName, startJd, endJd): isHoliday = True break if isHoliday: - gyear, gmonth, gday = jd_to(jd, GREGORIAN) - gyear2, gmonth2, gday2 = jd_to(jd + 1, GREGORIAN) - ####### icsText += ( "\n".join( [ diff --git a/scal3/time_utils.py b/scal3/time_utils.py index 778ae3ef0..0b84a59f5 100644 --- a/scal3/time_utils.py +++ b/scal3/time_utils.py @@ -232,7 +232,7 @@ def getJdAndSecondsFromEpoch(epoch: int) -> tuple[int, int]: durationUnitValueToName: "dict[int, str]" = dict(durationUnitsAbs) durationUnitValues: "list[int]" = [item[0] for item in durationUnitsAbs] -durationUnitNames: "list[str]" = [item[1] for item in durationUnitsAbs] +# durationUnitNames: "list[str]" = [item[1] for item in durationUnitsAbs] def timeEncode( diff --git a/scal3/ui.py b/scal3/ui.py index c4500fb4c..3febaa5df 100644 --- a/scal3/ui.py +++ b/scal3/ui.py @@ -54,9 +54,6 @@ from scal3.s_object import SObj -uiName = "" - - ####################################################### sysConfPath = join(sysConfDir, "ui.json") # also includes LIVE config @@ -870,8 +867,6 @@ def withFS(obj: "SObj") -> "SObj": localTzHist = [] -shownCals = [] # FIXME - mcalTypeParams = [ { "pos": (0, -2), diff --git a/scal3/ui_gtk/customize_dialog.py b/scal3/ui_gtk/customize_dialog.py index ac4478a89..a011c80cb 100644 --- a/scal3/ui_gtk/customize_dialog.py +++ b/scal3/ui_gtk/customize_dialog.py @@ -326,7 +326,7 @@ def _addPageItemsTree(self, page): pagePath = page.pagePath item = page.pageItem - childrenTreev, childrenBox = self.newItemList( + _childrenTreev, childrenBox = self.newItemList( pagePath, item, scrolled=True, diff --git a/scal3/ui_gtk/day_cal_window.py b/scal3/ui_gtk/day_cal_window.py index 41b53ad95..e8ef1ab55 100644 --- a/scal3/ui_gtk/day_cal_window.py +++ b/scal3/ui_gtk/day_cal_window.py @@ -308,7 +308,7 @@ def menuCellPopup(self, widget, etime, x, y): f"failed to translate coordinates ({x}, {y}) from widget {widget}", ) dx, dy = coord - foo, wx, wy = self.get_window().get_origin() + _foo, wx, wy = self.get_window().get_origin() x = wx + dx y = wy + dy if rtl: diff --git a/scal3/ui_gtk/event/common.py b/scal3/ui_gtk/event/common.py index 7b8ca3a03..65c372a56 100644 --- a/scal3/ui_gtk/event/common.py +++ b/scal3/ui_gtk/event/common.py @@ -219,7 +219,7 @@ def showFile(self, fname): pack(self.vbox, hbox) hbox.show_all() - def onAddClick(self, button): + def onAddClick(self, _button): fcd = gtk.FileChooserDialog( title=_("Add File"), ) @@ -236,7 +236,7 @@ def onAddClick(self, button): res=gtk.ResponseType.CANCEL, ) fcd.set_local_only(True) - fcd.connect("response", lambda w, e: fcd.hide()) + fcd.connect("response", lambda _w, _e: fcd.hide()) if fcd.run() == gtk.ResponseType.OK: from shutil import copy @@ -410,14 +410,14 @@ def __init__(self, defaultValue=""): ####### pack(self, toolbar) - def onAddClick(self, button): + def onAddClick(self, _button): cur = self.treev.get_cursor() if cur: self.treeModel.insert(cur[0], [self.defaultValue]) else: self.treeModel.append([self.defaultValue]) - def onMoveUpClick(self, button): + def onMoveUpClick(self, _button): cur = self.treev.get_cursor() if not cur: return @@ -432,7 +432,7 @@ def onMoveUpClick(self, button): ) self.treev.set_cursor(i - 1) - def onMoveDownClick(self, button): + def onMoveDownClick(self, _button): cur = self.treev.get_cursor() if not cur: return diff --git a/scal3/ui_gtk/event/editor.py b/scal3/ui_gtk/event/editor.py index 1fc273528..5767735bb 100644 --- a/scal3/ui_gtk/event/editor.py +++ b/scal3/ui_gtk/event/editor.py @@ -35,7 +35,7 @@ def __init__( res=gtk.ResponseType.OK, ) ### - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) ### self.activeWidget = None self._group = event.parent diff --git a/scal3/ui_gtk/event/event/allDayTask.py b/scal3/ui_gtk/event/event/allDayTask.py index 869a85220..136c8b19a 100644 --- a/scal3/ui_gtk/event/event/allDayTask.py +++ b/scal3/ui_gtk/event/event/allDayTask.py @@ -65,7 +65,7 @@ def __init__(self, event): ## FIXME # self.filesBox = common.FilesBox(self.event) # pack(self, self.filesBox) - def endTypeComboChanged(self, combo=None): + def endTypeComboChanged(self, _combo=None): active = self.endTypeCombo.get_active() if active == 0: # duration self.durationBox.show() @@ -109,7 +109,7 @@ def updateVars(self): ## FIXME self.endDateInput.get_value(), ) - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.startDateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/custom.py b/scal3/ui_gtk/event/event/custom.py index 10b9455bf..570e51cac 100644 --- a/scal3/ui_gtk/event/event/custom.py +++ b/scal3/ui_gtk/event/event/custom.py @@ -150,7 +150,7 @@ def updateVars(self): self.updateRules() self.notificationBox.updateVars() - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() for hbox in self.rulesBox.get_children(): @@ -159,7 +159,7 @@ def calTypeComboChanged(self, obj=None): widget.changeCalType(newCalType) self.event.calType = newCalType - def onRemoveButtonClick(self, button, hbox): + def onRemoveButtonClick(self, _button, hbox): rule = hbox.inputWidget.rule ok, msg = self.event.checkRulesDependencies(disabledRule=rule) self.warnLabel.set_label(msg) @@ -173,7 +173,7 @@ def onRemoveButtonClick(self, button, hbox): # self.rulesBox.remove(hbox) self.onRuleAddComboChanged() - def onRuleAddComboChanged(self, combo=None): + def onRuleAddComboChanged(self, _combo=None): ci = self.ruleAddCombo.get_active() if ci is None or ci < 0: return @@ -182,7 +182,7 @@ def onRuleAddComboChanged(self, combo=None): ok, msg = self.event.checkRulesDependencies(newRule=newRule) self.warnLabel.set_label(msg) - def onRuleAddButtonClick(self, button): + def onRuleAddButtonClick(self, _button): ci = self.ruleAddCombo.get_active() if ci is None or ci < 0: return diff --git a/scal3/ui_gtk/event/event/dailyNote.py b/scal3/ui_gtk/event/event/dailyNote.py index 492ddbe10..3de63f7a0 100644 --- a/scal3/ui_gtk/event/event/dailyNote.py +++ b/scal3/ui_gtk/event/event/dailyNote.py @@ -27,7 +27,7 @@ def updateVars(self): common.WidgetClass.updateVars(self) self.event.setDate(*self.dateInput.get_value()) - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.dateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/largeScale.py b/scal3/ui_gtk/event/event/largeScale.py index 20585bba6..8a2e9da5d 100644 --- a/scal3/ui_gtk/event/event/largeScale.py +++ b/scal3/ui_gtk/event/event/largeScale.py @@ -51,7 +51,7 @@ def __init__(self, event): # FIXME #### self.endRelComboChanged() - def endRelComboChanged(self, combo=None): + def endRelComboChanged(self, _combo=None): rel = self.endRelCombo.get_active() start = self.startSpin.get_value() end = self.endSpin.get_value() @@ -62,7 +62,7 @@ def endRelComboChanged(self, combo=None): self.endSpin.set_range(start + 1, maxStart) self.endSpin.set_value(max(start + 1, start + end)) - def startSpinChanged(self, spin=None): + def startSpinChanged(self, _spin=None): if self.endRelCombo.get_active() == 1: # absolute(end) self.endSpin.set_range( self.startSpin.get_value() + 1, diff --git a/scal3/ui_gtk/event/event/lifetime.py b/scal3/ui_gtk/event/event/lifetime.py index 8b0409424..a1eebfeeb 100644 --- a/scal3/ui_gtk/event/event/lifetime.py +++ b/scal3/ui_gtk/event/event/lifetime.py @@ -80,7 +80,7 @@ def updateVars(self): ## FIXME start.setDate(self.startDateInput.get_value()) end.setDate(self.endDateInput.get_value()) - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.startDateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/monthly.py b/scal3/ui_gtk/event/event/monthly.py index 897d3ddcb..ecfbcb928 100644 --- a/scal3/ui_gtk/event/event/monthly.py +++ b/scal3/ui_gtk/event/event/monthly.py @@ -123,7 +123,7 @@ def updateVars(self): ## FIXME self.dayTimeEndInput.get_value(), ) - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.startDateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/task.py b/scal3/ui_gtk/event/event/task.py index c0757b5e4..e70811aba 100644 --- a/scal3/ui_gtk/event/event/task.py +++ b/scal3/ui_gtk/event/event/task.py @@ -72,7 +72,7 @@ def __init__(self, event): # FIXME # self.filesBox = common.FilesBox(self.event) # pack(self, self.filesBox) - def endTypeComboChanged(self, combo=None): + def endTypeComboChanged(self, _combo=None): active = self.endTypeCombo.get_active() if active == 0: # duration self.durationBox.show() @@ -121,7 +121,7 @@ def updateVars(self): # FIXME self.endTimeInput.get_value(), ) - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.startDateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/universityExam.py b/scal3/ui_gtk/event/event/universityExam.py index 45f47fa64..f8f0fde2f 100644 --- a/scal3/ui_gtk/event/event/universityExam.py +++ b/scal3/ui_gtk/event/event/universityExam.py @@ -180,7 +180,7 @@ def updateVars(self): ## FIXME self.notificationBox.updateVars() self.event.updateSummary() - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.dateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/weekly.py b/scal3/ui_gtk/event/event/weekly.py index 25cafd867..9070b3472 100644 --- a/scal3/ui_gtk/event/event/weekly.py +++ b/scal3/ui_gtk/event/event/weekly.py @@ -127,7 +127,7 @@ def updateVars(self): ## FIXME self.dayTimeEndInput.get_value(), ) - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() self.startDateInput.changeCalType(self.event.calType, newCalType) diff --git a/scal3/ui_gtk/event/event/yearly.py b/scal3/ui_gtk/event/event/yearly.py index 3752a58aa..36a1375cb 100644 --- a/scal3/ui_gtk/event/event/yearly.py +++ b/scal3/ui_gtk/event/event/yearly.py @@ -58,7 +58,7 @@ def __init__(self, event): ## FIXME # self.filesBox = common.FilesBox(self.event) # pack(self, self.filesBox) - def onStartYearCheckClick(self, obj=None): + def onStartYearCheckClick(self, _obj=None): return self.startYearSpin.set_sensitive( self.startYearCheck.get_active(), ) @@ -87,7 +87,7 @@ def updateVars(self): ## FIXME if "start" in self.event: del self.event["start"] - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): # overwrite method from common.WidgetClass newCalType = self.calTypeCombo.get_active() module, ok = calTypes[newCalType] diff --git a/scal3/ui_gtk/event/export.py b/scal3/ui_gtk/event/export.py index 84fb2bb40..280e6ca82 100644 --- a/scal3/ui_gtk/event/export.py +++ b/scal3/ui_gtk/event/export.py @@ -31,7 +31,7 @@ def __init__(self, group, **kwargs): label=_("_Export", ctx="window action"), res=gtk.ResponseType.OK, ) - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) #### hbox = HBox() frame = gtk.Frame() @@ -69,7 +69,7 @@ def __init__(self, group, **kwargs): self.vbox.show_all() self.formatRadioChanged() - def formatRadioChanged(self, widget=None): + def formatRadioChanged(self, _widget=None): from scal3.os_utils import fixStrForFileName fpath = self.fcw.get_filename() @@ -201,13 +201,13 @@ def __init__(self, **kwargs): self.formatRadioChanged() self.resize(600, 600) - def disableAllClicked(self, widget=None): + def disableAllClicked(self, _widget=None): self.groupSelect.disableAll() - def enableAllClicked(self, widget=None): + def enableAllClicked(self, _widget=None): self.groupSelect.enableAll() - def formatRadioChanged(self, widget=None): + def formatRadioChanged(self, _widget=None): # self.dateRangeBox.set_visible(self.radioIcs.get_active()) ### fpath = self.fpathEntry.get_text() @@ -265,7 +265,7 @@ def __init__(self, idsList, defaultFileName="", groupTitle="", **kwargs): label=_("_Export", ctx="window action"), res=gtk.ResponseType.OK, ) - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) #### hbox = HBox() frame = gtk.Frame() @@ -302,7 +302,7 @@ def __init__(self, idsList, defaultFileName="", groupTitle="", **kwargs): self.vbox.show_all() self.formatRadioChanged() - def formatRadioChanged(self, widget=None): + def formatRadioChanged(self, _widget=None): fpath = self.fcw.get_filename() if fpath: fname_nox, ext = splitext(split(fpath)[1]) diff --git a/scal3/ui_gtk/event/group/editor.py b/scal3/ui_gtk/event/group/editor.py index 923bf6141..7065c9ab0 100644 --- a/scal3/ui_gtk/event/group/editor.py +++ b/scal3/ui_gtk/event/group/editor.py @@ -31,7 +31,7 @@ def __init__(self, group=None, **kwargs): label=_("_Save"), res=gtk.ResponseType.OK, ) - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) ####### self.activeWidget = None ####### @@ -73,7 +73,7 @@ def makeTitle(n: int) -> str: num += 1 return makeTitle(num) - def typeChanged(self, combo=None): + def typeChanged(self, _combo=None): if self.activeWidget: self.activeWidget.updateVars() self.activeWidget.destroy() diff --git a/scal3/ui_gtk/event/group/group.py b/scal3/ui_gtk/event/group/group.py index 67684f743..f01431494 100644 --- a/scal3/ui_gtk/event/group/group.py +++ b/scal3/ui_gtk/event/group/group.py @@ -118,7 +118,7 @@ def updateVars(self): self.group.remoteSyncEnable = self.syncCheck.get_active() self.group.remoteSyncDuration = self.syncIntervalInput.getDuration() - def calTypeComboChanged(self, obj=None): + def calTypeComboChanged(self, _obj=None): newCalType = self.calTypeCombo.get_active() self.startDateInput.changeCalType(self.group.calType, newCalType) self.endDateInput.changeCalType(self.group.calType, newCalType) diff --git a/scal3/ui_gtk/event/group/universityTerm.py b/scal3/ui_gtk/event/group/universityTerm.py index 4c23596ff..189dd8a90 100644 --- a/scal3/ui_gtk/event/group/universityTerm.py +++ b/scal3/ui_gtk/event/group/universityTerm.py @@ -125,7 +125,7 @@ def getSelectedIndex(self): except (ValueError, IndexError): return None - def onAddClick(self, button): + def onAddClick(self, _button): index = self.getSelectedIndex() lastCourseId = max( [1] + [row[0] for row in self.treeModel], @@ -144,13 +144,13 @@ def onAddClick(self, button): # cell = col.get_cell_renderers()[0] # cell.start_editing(...) ## FIXME - def onDeleteClick(self, button): + def onDeleteClick(self, _button): index = self.getSelectedIndex() if index is None: return del self.treeModel[index] - def onMoveUpClick(self, button): + def onMoveUpClick(self, _button): index = self.getSelectedIndex() if index is None: return @@ -164,7 +164,7 @@ def onMoveUpClick(self, button): ) self.treev.set_cursor(index - 1) - def onMoveDownClick(self, button): + def onMoveDownClick(self, _button): index = self.getSelectedIndex() if index is None: return @@ -178,12 +178,12 @@ def onMoveDownClick(self, button): ) self.treev.set_cursor(index + 1) - def courseNameEdited(self, cell, path, newText): + def courseNameEdited(self, _cell, path, newText): # log.debug("courseNameEdited", newText) index = int(path) self.treeModel[index][1] = newText - def courseUnitsEdited(self, cell, path, newText): + def courseUnitsEdited(self, _cell, path, newText): index = int(path) units = numDecode(newText) self.treeModel[index][2] = units @@ -245,7 +245,7 @@ def getSelectedIndex(self): except (ValueError, IndexError): return None - def onAddClick(self, button): + def onAddClick(self, _button): index = self.getSelectedIndex() row = ["00:00"] if index is None: @@ -254,13 +254,13 @@ def onAddClick(self, button): newIter = self.treeModel.insert(index + 1, row) self.treev.set_cursor(self.treeModel.get_path(newIter)) - def onDeleteClick(self, button): + def onDeleteClick(self, _button): index = self.getSelectedIndex() if index is None: return del self.treeModel[index] - def onMoveUpClick(self, button): + def onMoveUpClick(self, _button): index = self.getSelectedIndex() if index is None: return @@ -274,7 +274,7 @@ def onMoveUpClick(self, button): ) self.treev.set_cursor(index - 1) - def onMoveDownClick(self, button): + def onMoveDownClick(self, _button): index = self.getSelectedIndex() if index is None: return @@ -288,7 +288,7 @@ def onMoveDownClick(self, button): ) self.treev.set_cursor(index + 1) - def timeEdited(self, cell, path, newText): + def timeEdited(self, _cell, path, newText): index = int(path) parts = newText.split(":") h = numDecode(parts[0]) @@ -359,7 +359,7 @@ def __init__(self, term): self.connect("draw", self.onExposeEvent) # self.connect("event", show_event) - def onExposeEvent(self, widget=None, event=None): + def onExposeEvent(self, _widget=None, _event=None): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. @@ -497,7 +497,7 @@ def __init__(self, term, **kwargs): ##### hbox = HBox() self.currentWOnlyCheck = gtk.CheckButton(label=_("Current Week Only")) - self.currentWOnlyCheck.connect("clicked", lambda obj: self.updateWidget()) + self.currentWOnlyCheck.connect("clicked", lambda _w: self.updateWidget()) pack(hbox, self.currentWOnlyCheck) ## pack(hbox, gtk.Label(), 1, 1) @@ -514,7 +514,7 @@ def __init__(self, term, **kwargs): self.vbox.show_all() self.updateWidget() - def onDeleteEvent(self, win, gevent): + def onDeleteEvent(self, _win, _gevent): self.destroy() return True @@ -534,7 +534,7 @@ def exportToSvg(self, fpath): surface.flush() surface.finish() - def onExportToSvgClick(self, obj=None): + def onExportToSvgClick(self, _obj=None): fcd = gtk.FileChooserDialog( transient_for=self, action=gtk.FileChooserAction.SAVE, diff --git a/scal3/ui_gtk/event/group_op.py b/scal3/ui_gtk/event/group_op.py index 13814bb81..1d294fe80 100644 --- a/scal3/ui_gtk/event/group_op.py +++ b/scal3/ui_gtk/event/group_op.py @@ -29,7 +29,7 @@ def __init__(self, group, **kwargs): res=gtk.ResponseType.OK, ) ## - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) #### hbox = HBox() pack( @@ -95,7 +95,7 @@ def __init__(self, group, **kwargs): res=gtk.ResponseType.OK, ) ## - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) #### label = gtk.Label( label=_( diff --git a/scal3/ui_gtk/event/history.py b/scal3/ui_gtk/event/history.py index 73337e726..eb64a210f 100644 --- a/scal3/ui_gtk/event/history.py +++ b/scal3/ui_gtk/event/history.py @@ -59,7 +59,7 @@ class EventHistoryDialog(gtk.Dialog): "Change (JSON Diff)", ] - def onResponse(self, w, e): + def onResponse(self, _w, _e): self.hide() ud.windowList.onConfigChange() @@ -225,14 +225,14 @@ def __init__( self.vbox.show_all() self.resize(ud.workAreaW, ud.workAreaH * 0.9) # FIXME - def setColumnWidth(self, col, widthParam, cell): + def setColumnWidth(self, col, _widthParam, cell): width = col.get_width() cell.set_property("wrap_width", width) - def treeviewCursorChanged(self, treev, e=None): + def treeviewCursorChanged(self, _treev, _gevent=None): self.updateViewType() - def viewTypeComboChanged(self, combo): + def viewTypeComboChanged(self, _combo): self.updateViewType() def setButtonsSensitive(self, sensitive: bool): @@ -333,7 +333,7 @@ def switchToRevision(self, revHash): self.load() ui.eventUpdateQueue.put("e", newEvent, self) - def onCheckoutAfterClick(self, button): + def onCheckoutAfterClick(self, _button): path = self.treev.get_cursor()[0] if not path: return @@ -343,7 +343,7 @@ def onCheckoutAfterClick(self, button): hashAfter = row[1] self.switchToRevision(hashAfter) - def onCheckoutBeforeClick(self, button): + def onCheckoutBeforeClick(self, _button): path = self.treev.get_cursor()[0] if not path: return diff --git a/scal3/ui_gtk/event/import_event.py b/scal3/ui_gtk/event/import_event.py index 3c439f4cd..7dde0bb8c 100644 --- a/scal3/ui_gtk/event/import_event.py +++ b/scal3/ui_gtk/event/import_event.py @@ -72,10 +72,10 @@ def __init__(self, win): def run(self): pass - def onCancelClick(self, obj): + def onCancelClick(self, _obj): self.win.destroy() - def onNextClick(self, obj): + def onNextClick(self, _obj): fpath = self.fcb.get_filename() if not fpath: return @@ -172,10 +172,10 @@ def _runJson(self, fpath): ), ) - def onBackClick(self, obj): + def onBackClick(self, _obj): self.win.showStep(0) - def onCloseClick(self, obj): + def onCloseClick(self, _obj): self.win.destroy() stepClasses = [ diff --git a/scal3/ui_gtk/event/manager.py b/scal3/ui_gtk/event/manager.py index 883316053..76aeadf1c 100644 --- a/scal3/ui_gtk/event/manager.py +++ b/scal3/ui_gtk/event/manager.py @@ -165,19 +165,19 @@ class EventManagerDialog(gtk.Dialog, MyDialog, ud.BaseCalObj): # FIXME objName = "eventMan" desc = _("Event Manager") - def onShow(self, widget: gtk.Widget) -> None: + def onShow(self, _widget: gtk.Widget) -> None: global eventManPos self.move(*eventManPos) self.onConfigChange() - def onDeleteEvent(self, dialog: gtk.Dialog, gevent: gdk.Event) -> bool: + def onDeleteEvent(self, _dialog: gtk.Dialog, _gevent: gdk.Event) -> bool: # onResponse is called before onDeleteEvent # just return True, no need to do anything else # without this signal handler, the window will be distroyed # and can not be opened again return True - def onResponse(self, dialog: gtk.Dialog, response_id: int) -> None: + def onResponse(self, _dialog: gtk.Dialog, _response_id: int) -> None: global eventManPos eventManPos = self.get_position() saveConf() @@ -623,11 +623,11 @@ def __init__(self, **kwargs) -> None: def multiSelectTreeviewToggleStatus( self, - column, + _column, cell, model, _iter, - userData, + _userData, ): if not self.multiSelect: return @@ -713,9 +713,6 @@ def multiSelectShiftUpDownPress(self, isDown: bool): def multiSelectShiftButtonPress( self, path: "list[int]", - col: "gtk.TreeViewColumn", - group, - event, ) -> None: groupIndex, eventIndex = path # s_iter = self.treev.get_selection().get_selected()[1] @@ -756,7 +753,7 @@ def multiSelectTreeviewToggleSelected(self): def multiSelectTreeviewToggle( self, - cell: "gtk.CellRendererToggle", + _cell: "gtk.CellRendererToggle", pathStr: str, ): path = gtk.TreePath.new_from_string(pathStr).get_indices() @@ -829,17 +826,17 @@ def multiSelectTreeviewTogglePath(self, path: "list[int]"): self.multiSelectCBSetEvent(pathTuple[0], pathTuple[1], active) - def multiSelectCopy(self, obj=None): + def multiSelectCopy(self, _obj=None): iterList = list(self.multiSelectIters()) self.multiSelectToPaste = (False, iterList) self.multiSelectPasteButton.set_sensitive(True) - def multiSelectCut(self, obj=None): + def multiSelectCut(self, _obj=None): iterList = list(self.multiSelectIters()) self.multiSelectToPaste = (True, iterList) self.multiSelectPasteButton.set_sensitive(True) - def multiSelectPaste(self, obj=None): + def multiSelectPaste(self, _obj=None): toPaste = self.multiSelectToPaste if toPaste is None: log.error("nothing to paste") @@ -920,7 +917,7 @@ def multiSelectOperationFinished(self): self.multiSelectLabelUpdate() self.multiSelectPasteButton.set_sensitive(False) - def multiSelectDelete(self, obj=None): + def multiSelectDelete(self, _obj=None): model = self.treeModel if not self.multiSelectPathDict: return @@ -964,7 +961,7 @@ def multiSelectIters(self): for eventIndex in eventIndexes: yield model.get_iter((groupIndex, eventIndex)) - def multiSelectCancel(self, obj=None): + def multiSelectCancel(self, _obj=None): model = self.treeModel self.multiSelectSetEnable(False) self.multiSelectItem.set_active(False) @@ -997,7 +994,7 @@ def multiSelectEventIdsList(self) -> "list[tuple[int, int]]": ] return idsList - def multiSelectBulkEdit(self, widget=None): + def multiSelectBulkEdit(self, _widget=None): from scal3.event_container import DummyEventContainer from scal3.ui_gtk.event.bulk_edit import EventsBulkEditDialog @@ -1021,7 +1018,7 @@ def _do_multiSelectBulkEdit( self.multiSelectOperationFinished() - def multiSelectExport(self, widget=None): + def multiSelectExport(self, _widget=None): from scal3.ui_gtk.event.export import EventListExportDialog idsList = self.multiSelectEventIdsList() @@ -1212,7 +1209,7 @@ def getObjsByPath(self, path: list[int]) -> list[EventOrGroup]: obj_list.append(obj_list[i - 1][obj_id]) return obj_list - def historyOfEventFromMenu(self, menu: gtk.Menu, path: list[int]) -> None: + def historyOfEventFromMenu(self, _menu: gtk.Menu, path: list[int]) -> None: group, event = self.getObjsByPath(path) EventHistoryDialog(event, transient_for=self).run() @@ -1582,7 +1579,7 @@ def rowActivated( self, treev: gtk.TreeView, path: list[int], - col: gtk.TreeViewColumn, + _col: gtk.TreeViewColumn, ) -> None: if self.multiSelect: return @@ -1595,7 +1592,7 @@ def rowActivated( elif len(path) == 2: self.editEventByPath(path) - def onKeyPress(self, dialog, gevent: gdk.EventKey) -> bool: + def onKeyPress(self, _dialog, gevent: gdk.EventKey) -> bool: kname = gdk.keyval_name(gevent.keyval).lower() if kname == "escape": return self.onEscape() @@ -1624,7 +1621,7 @@ def menuKeyPressOnPath(self, path: "list[str]", gevent: "gdk.EventKey"): menu.popup( None, None, - lambda *args: ( + lambda *_args: ( wx + dx, wy + dy, True, @@ -1636,7 +1633,7 @@ def menuKeyPressOnPath(self, path: "list[str]", gevent: "gdk.EventKey"): def onTreeviewKeyPress( self, - treev: "gtk.TreeView", + _treev: "gtk.TreeView", gevent: "gdk.EventKey", ) -> bool: # from scal3.time_utils import getGtkTimeFromEpoch @@ -1681,13 +1678,13 @@ def onEscape(self): self.hide() return True - def onMenuBarExportClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarExportClick(self, _menuItem: gtk.MenuItem) -> None: MultiGroupExportDialog(transient_for=self).run() - def onMenuBarImportClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarImportClick(self, _menuItem: gtk.MenuItem) -> None: EventsImportWindow(self).present() - def onMenuBarSearchClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarSearchClick(self, _menuItem: gtk.MenuItem) -> None: ui.mainWin.eventSearchShow() def _do_checkForOrphans(self) -> None: @@ -1695,7 +1692,7 @@ def _do_checkForOrphans(self) -> None: if newGroup is not None: self.appendGroupTree(newGroup) - def onMenuBarOrphanClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarOrphanClick(self, _menuItem: gtk.MenuItem) -> None: self.waitingDo(self._do_checkForOrphans) def getSelectedPath(self) -> "list[int] | None": @@ -1704,7 +1701,7 @@ def getSelectedPath(self) -> "list[int] | None": return return self.treeModel.get_path(_iter).get_indices() - def mbarEditMenuPopup(self, menuItem: gtk.MenuItem) -> None: + def mbarEditMenuPopup(self, _menuItem: gtk.MenuItem) -> None: path = self.getSelectedPath() selected = bool(path) eventSelected = selected and len(path) == 2 @@ -1718,7 +1715,7 @@ def mbarEditMenuPopup(self, menuItem: gtk.MenuItem) -> None: selected and self.canPasteToGroup(self.getObjsByPath(path)[0]), ) - def onMenuBarEditClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarEditClick(self, _menuItem: gtk.MenuItem) -> None: path = self.getSelectedPath() if not path: return @@ -1727,30 +1724,30 @@ def onMenuBarEditClick(self, menuItem: gtk.MenuItem) -> None: elif len(path) == 2: self.editEventByPath(path) - def onMenuBarCutClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarCutClick(self, _menuItem: gtk.MenuItem) -> None: path = self.getSelectedPath() if not path: return if len(path) == 2: self.toPasteEvent = (self.treeModel.get_iter(path), True) - def onMenuBarCopyClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarCopyClick(self, _menuItem: gtk.MenuItem) -> None: path = self.getSelectedPath() if not path: return if len(path) == 2: self.toPasteEvent = (self.treeModel.get_iter(path), False) - def onMenuBarPasteClick(self, menuItem: gtk.MenuItem) -> None: + def onMenuBarPasteClick(self, _menuItem: gtk.MenuItem) -> None: path = self.getSelectedPath() if not path: return self.pasteEventToPath(path) - def onCollapseAllClick(self, menuItem: gtk.MenuItem) -> None: + def onCollapseAllClick(self, _menuItem: gtk.MenuItem) -> None: return self.treev.collapse_all() - def onExpandAllAllClick(self, menuItem: gtk.MenuItem) -> None: + def onExpandAllAllClick(self, _menuItem: gtk.MenuItem) -> None: return self.treev.expand_all() def _do_showDescItemToggled(self) -> None: @@ -1763,7 +1760,7 @@ def _do_showDescItemToggled(self) -> None: else: self.treev.remove_column(self.colDesc) - def showDescItemToggled(self, menuItem: gtk.MenuItem) -> None: + def showDescItemToggled(self, _menuItem: gtk.MenuItem) -> None: self.waitingDo(self._do_showDescItemToggled) def treeviewCursorChangedPath(self, path: "list[int]") -> None: @@ -1810,7 +1807,7 @@ def treeviewCursorChangedPath(self, path: "list[int]") -> None: if hasattr(self, "sbar"): self.sbar.push(0, text) - def treeviewCursorChanged(self, selection: Any = None) -> None: + def treeviewCursorChanged(self, _selection: Any = None) -> None: path = self.getSelectedPath() if not self.syncing: @@ -1871,11 +1868,11 @@ def setGroupEnable( self.loadedGroupIds.add(group.id) self.onGroupModify(group) - def onEnableAllClick(self, menuItem: gtk.MenuItem) -> None: + def onEnableAllClick(self, _menuItem: gtk.MenuItem) -> None: for group in ui.eventGroups: self.setGroupEnable(True, group, None) - def onDisableAllClick(self, menuItem: gtk.MenuItem) -> None: + def onDisableAllClick(self, _menuItem: gtk.MenuItem) -> None: for group in ui.eventGroups: self.setGroupEnable(False, group, None) @@ -1916,7 +1913,7 @@ def onTreeviewLeftButtonPress( return False if self.multiSelect and gevent.state & gdk.ModifierType.SHIFT_MASK > 0: - return self.multiSelectShiftButtonPress(path, col, objs[0], objs[1]) + return self.multiSelectShiftButtonPress(path) return False @@ -1968,10 +1965,10 @@ def insertNewGroup(self, groupIndex: int) -> None: self.onGroupModify(group) self.loadedGroupIds.add(group.id) - def addGroupBeforeGroup(self, menu: gtk.Menu, path: list[int]) -> None: + def addGroupBeforeGroup(self, _menu: gtk.Menu, path: list[int]) -> None: self.insertNewGroup(path[0]) - def addGroupBeforeSelection(self, w: "gtk.Widget | None" = None) -> None: + def addGroupBeforeSelection(self, _w: "gtk.Widget | None" = None) -> None: path = self.getSelectedPath() if path is None: groupIndex = len(self.treeModel) - 1 @@ -2019,7 +2016,7 @@ def duplicateGroupWithEvents(self, path: list[int]) -> None: def syncGroupFromMenu( self, - menu: gtk.Menu, + _menu: gtk.Menu, path: list[int], account: lib.Account, ) -> None: @@ -2054,17 +2051,17 @@ def syncGroupFromMenu( """ self.reloadGroupEvents(group.id) - def duplicateGroupFromMenu(self, menu: gtk.Menu, path: list[int]) -> None: + def duplicateGroupFromMenu(self, _menu: gtk.Menu, path: list[int]) -> None: self.duplicateGroup(path) def duplicateGroupWithEventsFromMenu( self, - menu: gtk.Menu, + _menu: gtk.Menu, path: list[int], ) -> None: self.duplicateGroupWithEvents(path) - def duplicateSelectedObj(self, w: "gtk.Widget | None" = None) -> None: + def duplicateSelectedObj(self, _w: "gtk.Widget | None" = None) -> None: path = self.getSelectedPath() if not path: return @@ -2099,7 +2096,7 @@ def editGroupByPath(self, path: list[int]) -> None: self.onGroupModify(group) ui.eventUpdateQueue.put("eg", group, self) - def editGroupFromMenu(self, menu: gtk.Menu, path: list[int]) -> None: + def editGroupFromMenu(self, _menu: gtk.Menu, path: list[int]) -> None: self.editGroupByPath(path) def _do_deleteGroup(self, path: list[int], group: lib.EventGroup) -> None: @@ -2135,12 +2132,12 @@ def deleteGroup(self, path: list[int]) -> None: return self.waitingDo(self._do_deleteGroup, path, group) - def deleteGroupFromMenu(self, menu: gtk.Menu, path: list[int]) -> None: + def deleteGroupFromMenu(self, _menu: gtk.Menu, path: list[int]) -> None: self.deleteGroup(path) def addEventToGroupFromMenu( self, - menu: gtk.Menu, + _menu: gtk.Menu, path: list[int], group: lib.EventGroup, eventType: str, @@ -2174,7 +2171,7 @@ def addNewEventRow( def addGenericEventToGroupFromMenu( self, - menu: gtk.Menu, + _menu: gtk.Menu, path: list[int], group: lib.EventGroup, ) -> None: @@ -2221,12 +2218,12 @@ def editEventByPath(self, path: list[int]) -> None: ui.eventUpdateQueue.put("e", event, self) self.updateEventRow(event) - def editEventFromMenu(self, menu: gtk.Menu, path: list[int]) -> None: + def editEventFromMenu(self, _menu: gtk.Menu, path: list[int]) -> None: self.editEventByPath(path) def moveEventToPathFromMenu( self, - menu: gtk.Menu, + _menu: gtk.Menu, path: list[int], targetPath: list[int], ) -> None: @@ -2247,7 +2244,7 @@ def addEventRowToTrash(self, event: "lib.Event") -> None: else: self.appendEventRow(self.trashIter, event) - def moveEventToTrashFromMenu(self, menu: gtk.Menu, path: list[int]) -> None: + def moveEventToTrashFromMenu(self, _menu: gtk.Menu, path: list[int]) -> None: self.moveEventToTrashByPath(path) def moveSelectionToTrash(self) -> None: @@ -2259,7 +2256,7 @@ def moveSelectionToTrash(self) -> None: elif len(path) == 2: self.moveEventToTrashByPath(path) - def deleteEventFromTrash(self, menu: gtk.Menu, path: list[int]) -> None: + def deleteEventFromTrash(self, _menu: gtk.Menu, path: list[int]) -> None: trash, event = self.getObjsByPath(path) trash.delete(event.id) # trash == ui.eventTrash trash.save() @@ -2272,12 +2269,12 @@ def removeIterChildren(self, _iter: gtk.TreeIter) -> None: while (childIter := self.treeModel.iter_children(_iter)) is not None: self.treeModel.remove(childIter) - def emptyTrash(self, menuItem: gtk.MenuItem) -> None: + def emptyTrash(self, _menuItem: gtk.MenuItem) -> None: ui.eventTrash.empty() self.removeIterChildren(self.trashIter) self.treeviewCursorChanged() - def editTrash(self, menuItem: "gtk.MenuItem | None" = None) -> None: + def editTrash(self, _menuItem: "gtk.MenuItem | None" = None) -> None: TrashEditorDialog(transient_for=self).run() self.treeModel.set_value( self.trashIter, @@ -2403,19 +2400,19 @@ def moveDown(self, path: list[int]) -> None: self.treev.set_cursor(newPath) self.treev.scroll_to_cell(newPath) - def moveUpFromMenu(self, menuItem: gtk.MenuItem, path: list[int]) -> None: + def moveUpFromMenu(self, _menuItem: gtk.MenuItem, path: list[int]) -> None: self.moveUp(path) - def moveDownFromMenu(self, menuItem: gtk.MenuItem, path: list[int]) -> None: + def moveDownFromMenu(self, _menuItem: gtk.MenuItem, path: list[int]) -> None: self.moveDown(path) - def moveUpByButton(self, tb: gtk.Button) -> None: + def moveUpByButton(self, _tb: gtk.Button) -> None: path = self.getSelectedPath() if not path: return self.moveUp(path) - def moveDownByButton(self, tb: gtk.Button) -> None: + def moveDownByButton(self, _tb: gtk.Button) -> None: path = self.getSelectedPath() if not path: return @@ -2423,14 +2420,14 @@ def moveDownByButton(self, tb: gtk.Button) -> None: def groupExportFromMenu( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, group: lib.EventGroup, ) -> None: SingleGroupExportDialog(group, transient_for=self).run() def groupSortFromMenu( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, path: list[int], ) -> None: if not (isinstance(path, list) and len(path) == 1): @@ -2451,7 +2448,7 @@ def groupSortFromMenu( def groupConvertCalTypeFromMenu( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, group: lib.EventGroup, ) -> None: if GroupConvertCalTypeDialog(group, transient_for=self).perform(): @@ -2474,7 +2471,7 @@ def _do_groupConvertTo( def groupConvertToFromMenu( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, group: lib.EventGroup, newGroupType: str, ) -> None: @@ -2499,7 +2496,7 @@ def _do_groupBulkEdit( def groupBulkEditFromMenu( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, group: lib.EventGroup, path: list[int], ) -> None: @@ -2511,7 +2508,7 @@ def groupBulkEditFromMenu( def onGroupActionClick( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, group: lib.EventGroup, actionFuncName: str, ) -> None: @@ -2521,15 +2518,15 @@ def onGroupActionClick( func = getattr(group, actionFuncName) self.waitingDo(func, parentWin=self) - def cutEvent(self, menuItem: gtk.MenuItem, path: list[int]) -> None: + def cutEvent(self, _menuItem: gtk.MenuItem, path: list[int]) -> None: self.toPasteEvent = (self.treeModel.get_iter(path), True) - def copyEvent(self, menuItem: gtk.MenuItem, path: list[int]) -> None: + def copyEvent(self, _menuItem: gtk.MenuItem, path: list[int]) -> None: self.toPasteEvent = (self.treeModel.get_iter(path), False) def pasteEventFromMenu( self, - menuItem: gtk.MenuItem, + _menuItem: gtk.MenuItem, targetPath: list[int], ) -> None: self.pasteEventToPath(targetPath) diff --git a/scal3/ui_gtk/event/notifier/alarm.py b/scal3/ui_gtk/event/notifier/alarm.py index 71c96c2f8..aaf4fe7d7 100644 --- a/scal3/ui_gtk/event/notifier/alarm.py +++ b/scal3/ui_gtk/event/notifier/alarm.py @@ -33,17 +33,17 @@ def updateVars(self): self.notifier.alarmSound = self.get_filename() -def notifyWait(notifier, finishFunc): - if notifier.alarmSound and notifier.playerCmd: - Popen( - [ - notifier.playerCmd, - notifier.alarmSound, - ], - stdout=PIPE, - stderr=PIPE, - ).communicate() - # finishFunc() +# def notifyWait(notifier, finishFunc): +# if notifier.alarmSound and notifier.playerCmd: +# Popen( +# [ +# notifier.playerCmd, +# notifier.alarmSound, +# ], +# stdout=PIPE, +# stderr=PIPE, +# ).communicate() +# # finishFunc() def notify(notifier, finishFunc): diff --git a/scal3/ui_gtk/event/notifier/windowMsg.py b/scal3/ui_gtk/event/notifier/windowMsg.py index e6931f7ab..828b111af 100644 --- a/scal3/ui_gtk/event/notifier/windowMsg.py +++ b/scal3/ui_gtk/event/notifier/windowMsg.py @@ -19,7 +19,7 @@ def updateVars(self): self.notifier.extraMessage = self.get_text() -def hideWindow(widget, dialog): +def hideWindow(_widget, dialog): dialog.hide() return True @@ -55,5 +55,5 @@ def notify(notifier, finishFunc): # FIXME okB.connect("clicked", hideWindow, dialog) #### dialog.vbox.show_all() - dialog.connect("response", lambda w, e: finishFunc()) + dialog.connect("response", lambda _w, _e: finishFunc()) dialog.present() diff --git a/scal3/ui_gtk/event/occurrence_view.py b/scal3/ui_gtk/event/occurrence_view.py index 516865bb3..a2324e056 100644 --- a/scal3/ui_gtk/event/occurrence_view.py +++ b/scal3/ui_gtk/event/occurrence_view.py @@ -194,12 +194,12 @@ def has_selection(self): def get_text(self): return buffer_get_text(self.get_buffer()) - def copy(self, item): + def copy(self, _item): buf = self.get_buffer() start_iter, end_iter = buf.get_selection_bounds() setClipboard(toStr(buf.get_text(start_iter, end_iter, True))) - def copyAll(self, item): + def copyAll(self, _item): return setClipboard(toStr(self.get_text())) def findEventByY(self, y: int): @@ -217,7 +217,7 @@ def trimEventMenuItemLabel(self, s: str): s = s[: maxLen - 3].rstrip(" ") + "..." return s - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, gevent): # log.debug(f"DayOccurrenceView: onButtonPress: {gevent.button=}") if gevent.button != 3: return False @@ -325,7 +325,7 @@ def onDateChange(self, *a, **kw): self.addText(line + "\n") self.occurOffsets = occurOffsets - def moveEventToGroupFromMenu(self, item, event, prev_group, newGroup): + def moveEventToGroupFromMenu(self, _item, event, prev_group, newGroup): prev_group.remove(event) prev_group.save() ui.eventUpdateQueue.put("r", prev_group, self) @@ -339,7 +339,7 @@ def moveEventToGroupFromMenu(self, item, event, prev_group, newGroup): def copyOccurToGroupFromMenu( self, - item, + _item, newGroup, newEventType, event, @@ -359,7 +359,7 @@ def copyOccurToGroupFromMenu( ### self.onConfigChange() - def copyEventText(self, item, event): + def copyEventText(self, _item, event): setClipboard(event.getText()) def addWriteEventMenuItems( @@ -479,7 +479,7 @@ def addEventMenuItems(self, menu, occurData: dict[str, Any]): self.addWriteEventMenuItems(menu, occurData, event, group) menu.add(gtk.SeparatorMenuItem()) - def onEditEventClick(self, item, winTitle, event, groupId): + def onEditEventClick(self, _item, winTitle, event, _groupId): from scal3.ui_gtk.event.editor import EventEditorDialog event = EventEditorDialog( @@ -492,7 +492,7 @@ def onEditEventClick(self, item, winTitle, event, groupId): ui.eventUpdateQueue.put("e", event, self) self.onConfigChange() - def moveEventToTrash(self, item, event, groupId): + def moveEventToTrash(self, _item, event, groupId): from scal3.ui_gtk.event.utils import confirmEventTrash if not confirmEventTrash(event, transient_for=ui.mainWin): diff --git a/scal3/ui_gtk/event/register_starcal.py b/scal3/ui_gtk/event/register_starcal.py index 3ceed8ccd..080b37f97 100755 --- a/scal3/ui_gtk/event/register_starcal.py +++ b/scal3/ui_gtk/event/register_starcal.py @@ -123,7 +123,7 @@ def canSubmit(self): return True - def updateOkSensitive(self, *args): + def updateOkSensitive(self, *_args): ok = self.canSubmit() self.okButton.set_sensitive(ok) if ok: @@ -185,17 +185,17 @@ def doRegister(self): account.save() return None - def onOkClick(self, widget): + def onOkClick(self, _widget): error = self.waitingDo(self.doRegister) if not error: self.destroy() return True - def onCancelClick(self, widget): + def onCancelClick(self, _widget): self.destroy() return True - def onDeleteEvent(self, obj, event): + def onDeleteEvent(self, _widget, _event): self.destroy() return True diff --git a/scal3/ui_gtk/event/rule/ex_dates.py b/scal3/ui_gtk/event/rule/ex_dates.py index 6bf49f2c7..4c54e89c7 100644 --- a/scal3/ui_gtk/event/rule/ex_dates.py +++ b/scal3/ui_gtk/event/rule/ex_dates.py @@ -130,7 +130,7 @@ def createDialog(self): pack(self.dialog.vbox, dialogHbox, 1, 1) self.dialog.vbox.show_all() self.dialog.resize(200, 300) - self.dialog.connect("response", lambda w, e: self.dialog.hide()) + self.dialog.connect("response", lambda _w, _e: self.dialog.hide()) ## _okButton = dialog_add_button( self.dialog, @@ -139,12 +139,12 @@ def createDialog(self): res=gtk.ResponseType.OK, ) - def showDialog(self, w=None): + def showDialog(self, _w=None): self.createDialog() self.dialog.run() self.updateCountLabel() - def dateCellEdited(self, cell, path, newText): + def dateCellEdited(self, _cell, path, newText): index = int(path) self.treeModel[index][0] = validate(newText) @@ -156,7 +156,7 @@ def getSelectedIndex(self): return None return path[0] - def onAddClick(self, button): + def onAddClick(self, _button): index = self.getSelectedIndex() calType = self.rule.getCalType() ## FIXME row = [encode(cal_types.getSysDate(calType))] @@ -169,13 +169,13 @@ def onAddClick(self, button): # cell = col.get_cell_renderers()[0] # cell.start_editing(...) ## FIXME - def onDeleteClick(self, button): + def onDeleteClick(self, _button): index = self.getSelectedIndex() if index is None: return del self.treeModel[index] - def onMoveUpClick(self, button): + def onMoveUpClick(self, _button): index = self.getSelectedIndex() if index is None: return @@ -189,7 +189,7 @@ def onMoveUpClick(self, button): ) self.treev.set_cursor(index - 1) - def onMoveDownClick(self, button): + def onMoveDownClick(self, _button): index = self.getSelectedIndex() if index is None: return diff --git a/scal3/ui_gtk/event/search_events.py b/scal3/ui_gtk/event/search_events.py index b659c615b..bdba16893 100644 --- a/scal3/ui_gtk/event/search_events.py +++ b/scal3/ui_gtk/event/search_events.py @@ -392,28 +392,28 @@ def onConfigChange(self, *a, **kw) -> None: dateTimeInput.changeCalType(self.currentCalType, calTypes.primary) self.currentCalType = calTypes.primary - def sort_func_group(self, model, iter1, iter2, user_data=None): + def sort_func_group(self, model, iter1, iter2, _user_data=None): return cmp( ui.eventGroups.index(model.get(iter1, 0)[0]), ui.eventGroups.index(model.get(iter2, 0)[0]), ) - def updateTimeFromSensitive(self, obj=None): + def updateTimeFromSensitive(self, _obj=None): self.timeFromInput.set_sensitive(self.timeFromCheck.get_active()) - def updateTimeToSensitive(self, obj=None): + def updateTimeToSensitive(self, _obj=None): self.timeToInput.set_sensitive(self.timeToCheck.get_active()) - def updateModifiedFromSensitive(self, obj=None): + def updateModifiedFromSensitive(self, _obj=None): self.modifiedFromInput.set_sensitive(self.modifiedFromCheck.get_active()) - def updateTypeSensitive(self, obj=None): + def updateTypeSensitive(self, _obj=None): self.typeCombo.set_sensitive(self.typeCheck.get_active()) - def updateGroupSensitive(self, obj=None): + def updateGroupSensitive(self, _obj=None): self.groupCombo.set_sensitive(self.groupCheck.get_active()) - def updateTimezoneSensitive(self, obj=None): + def updateTimezoneSensitive(self, _obj=None): self.timezoneCombo.set_sensitive(self.timezoneCheck.get_active()) def _collectConds(self): @@ -506,10 +506,10 @@ def searchAndExportToJSON( eventCount += 1 _file.write("]}]}") - def onSearchClick(self, obj=None): + def onSearchClick(self, _obj=None): self.waitingDo(self._do_search) - def onExportClick(self, obj=None): + def onExportClick(self, _obj=None): idsList = [] for row in self.treeModel: gid = row[0] @@ -547,10 +547,10 @@ def _do_directExport(self): selectable=True, ) - def onDirectExportClick(self, obj=None): + def onDirectExportClick(self, _obj=None): self.waitingDo(self._do_directExport) - def onHideShowFiltersClick(self, obj=None): + def onHideShowFiltersClick(self, _obj=None): visible = not self.vboxFilters.get_visible() self.vboxFilters.set_visible(visible) self.hideShowFiltersButton.set_label( @@ -584,15 +584,15 @@ def editEventByPath(self, path): self.treeModel.set_value(eventIter, 4, event.summary) self.treeModel.set_value(eventIter, 5, event.getShownDescription()) - def rowActivated(self, treev, path, col): + def rowActivated(self, _treev, path, _col): self.editEventByPath(path) - def editEventFromMenu(self, menu, path): + def editEventFromMenu(self, _menu, path): self.editEventByPath(path) def moveEventToGroupFromMenu( self, - menu, + _menu, eventPath, event, old_group, @@ -610,7 +610,7 @@ def moveEventToGroupFromMenu( self.treeModel.set_value(eventIter, 0, new_group.id) self.treeModel.set_value(eventIter, 2, new_group.title) - def copyEventToGroupFromMenu(self, menu, eventPath, event, new_group): + def copyEventToGroupFromMenu(self, _menu, _eventPath, event, new_group): new_event = event.copy() new_event.save() new_group.append(new_event) @@ -634,7 +634,7 @@ def moveEventToTrash(self, path): ui.moveEventToTrash(group, event, self) self.treeModel.remove(self.treeModel.get_iter(path)) - def moveEventToTrashFromMenu(self, menu, path): + def moveEventToTrashFromMenu(self, _menu, path): return self.moveEventToTrash(path) def moveSelectionToTrash(self): @@ -700,7 +700,7 @@ def getCopyToGroupSubMenu(self, path, event): item.set_submenu(subMenu) return item - def historyOfEventFromMenu(self, menu, path): + def historyOfEventFromMenu(self, _menu, path): from scal3.ui_gtk.event.history import EventHistoryDialog gid = self.treeModel[path][0] @@ -761,7 +761,7 @@ def openRightClickMenu(self, path, etime=None): self.tmpMenu = menu menu.popup(None, None, None, None, 3, etime) - def onTreeviewButtonPress(self, widget, gevent): + def onTreeviewButtonPress(self, _widget, gevent): pos_t = self.treev.get_path_at_pos(int(gevent.x), int(gevent.y)) if not pos_t: return @@ -803,7 +803,7 @@ def onTreeviewKeyPress(self, treev, gevent): menu.popup( None, None, - lambda *args: ( + lambda *_args: ( wx + dx, wy + dy + 20, True, @@ -823,7 +823,7 @@ def clearResults(self): self.treeModel.clear() self.resultLabel.set_label("") - def closed(self, obj=None, gevent=None): + def closed(self, _obj=None, _gevent=None): self.hide() self.clearResults() self.onConfigChange() @@ -833,7 +833,7 @@ def present(self): self.groupCombo.updateItems() gtk.Window.present(self) - def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _arg: gtk.Widget, gevent: gdk.EventKey): kname = gdk.keyval_name(gevent.keyval).lower() if kname == "escape": self.closed() diff --git a/scal3/ui_gtk/event/tags.py b/scal3/ui_gtk/event/tags.py index 423d660a5..096867d51 100644 --- a/scal3/ui_gtk/event/tags.py +++ b/scal3/ui_gtk/event/tags.py @@ -101,7 +101,7 @@ def __init__(self): self.show_all() hideList(self.customTypeWidgets) - def scrollEvent(self, widget, gevent): + def scrollEvent(self, _widget, gevent): self.swin.get_hscrollbar().emit("scroll-event", gevent) def typeComboChanged(self, combo): @@ -216,7 +216,7 @@ def __init__(self, eventType=""): ## "" == "custom" self.optionsChanged() self.show_all() - def optionsChanged(self, widget=None, tags=None): + def optionsChanged(self, _widget=None, tags=None): if not tags: tags = self.getData() tagObjList = ui.eventTags @@ -295,7 +295,7 @@ def __init__(self, eventType=""): pack(self, self.editButton) self.show_all() - def onEditButtonClick(self, widget): + def onEditButtonClick(self, _widget): openWindow(self.dialog) def dialogResponse(self, dialog, resp): diff --git a/scal3/ui_gtk/event/trash.py b/scal3/ui_gtk/event/trash.py index 029d71edc..0c02929bb 100644 --- a/scal3/ui_gtk/event/trash.py +++ b/scal3/ui_gtk/event/trash.py @@ -30,7 +30,7 @@ def __init__(self, **kwargs): res=gtk.ResponseType.OK, ) ## - self.connect("response", lambda w, e: self.hide()) + self.connect("response", lambda _w, _e: self.hide()) ####### self.trash = ui.eventTrash ## diff --git a/scal3/ui_gtk/export.py b/scal3/ui_gtk/export.py index a3266d6cd..014e19b69 100644 --- a/scal3/ui_gtk/export.py +++ b/scal3/ui_gtk/export.py @@ -86,7 +86,7 @@ def __init__(self, **kwargs): self.connect("delete-event", self.onDelete) self.fcw.set_current_folder(deskDir) - def comboChanged(self, widget=None, ym=None): + def comboChanged(self, _widget=None, ym=None): i = self.combo.get_active() if ym is None: ym = (ui.cell.year, ui.cell.month) @@ -101,7 +101,7 @@ def comboChanged(self, widget=None, ym=None): self.hbox2.show() # select_region(0, -4) # FIXME - def onDelete(self, widget=None, event=None): + def onDelete(self, _widget=None, _event=None): # hide(close) File Chooser Dialog self.hide() return True @@ -136,7 +136,7 @@ def _save(self, path): exportToHtml(path, months, title) self.hide() - def save(self, widget=None): + def save(self, _widget=None): while gtk.events_pending(): gtk.main_iteration_do(False) path = self.fcw.get_filename() @@ -231,7 +231,7 @@ def __init__(self, saveIcsFunc, defaultFileName, **kwargs): defaultFileName += ".ics" self.fcw.set_current_name(defaultFileName) - def onDelete(self, widget=None, event=None): ## hide(close) File Chooser Dialog + def onDelete(self, _widget=None, _event=None): ## hide(close) File Chooser Dialog self.destroy() return True @@ -239,7 +239,7 @@ def _save(self, path, startJd, endJd): self.saveIcsFunc(path, startJd, endJd) self.destroy() - def save(self, widget=None): + def save(self, _widget=None): while gtk.events_pending(): gtk.main_iteration_do(False) path = self.fcw.get_filename() diff --git a/scal3/ui_gtk/gtk_ud.py b/scal3/ui_gtk/gtk_ud.py index ca9e2d130..822b4e000 100644 --- a/scal3/ui_gtk/gtk_ud.py +++ b/scal3/ui_gtk/gtk_ud.py @@ -230,7 +230,7 @@ def updateIconSizes(self): pixcache.clear() self.lastAlphabetHeight = height - def onEventUpdate(self, record: "EventUpdateRecord") -> None: + def onEventUpdate(self, _record: "EventUpdateRecord") -> None: # ui.cellCache.clear() # causes crash, no idea why! ui.cellCache.clearEventsData() self.onDateChange() @@ -603,7 +603,7 @@ def getWorkAreaSize() -> "tuple[int, int] | None": # rootWindow.set_cursor(cursor=gdk.Cursor.new(gdk.CursorType.WATCH)) # FIXME -def screenSizeChanged(screen): +def screenSizeChanged(_screen): global screenW, screenH, workAreaW, workAreaH if ui.mainWin is None: return diff --git a/scal3/ui_gtk/hijri.py b/scal3/ui_gtk/hijri.py index b7a469f04..427c8e46c 100644 --- a/scal3/ui_gtk/hijri.py +++ b/scal3/ui_gtk/hijri.py @@ -60,7 +60,7 @@ def __init__(self, **kwargs): pack(hbox, self.topLabel) self.startDateInput = DateButton() self.startDateInput.set_editable(False) ## FIXME - self.startDateInput.connect("changed", lambda widget: self.updateEndDates()) + self.startDateInput.connect("changed", lambda _widget: self.updateEndDates()) pack(hbox, self.startDateInput) pack(self.vbox, hbox) ############################ @@ -160,14 +160,14 @@ def __init__(self, **kwargs): ###### self.vbox.show_all() - def resetToDefaults(self, widget): + def resetToDefaults(self, _widget): if isfile(hijri.monthDb.userDbPath): os.remove(hijri.monthDb.userDbPath) hijri.monthDb.load() self.updateWidget() return True - def onAddClick(self, obj=None): + def onAddClick(self, _widget=None): last = self.treeModel[-1] # 0 ym # 1 yearLocale @@ -194,7 +194,7 @@ def selectLastRow(self): self.treev.scroll_to_cell(lastPath) self.treev.set_cursor(lastPath) - def onDeleteClick(self, obj=None): + def onDeleteClick(self, _widget=None): if len(self.treeModel) > 1: del self.treeModel[-1] self.selectLastRow() @@ -252,7 +252,7 @@ def updateEndDates(self): jd0 += mLen row[4] = dateLocale(*jd_to(jd0, self.altMode)) - def monthLenCellEdited(self, combo, path_string, new_text): + def monthLenCellEdited(self, _combo, path_string, new_text): editIndex = int(path_string) mLen = int(new_text) if mLen not in (29, 30): @@ -294,7 +294,7 @@ def run(self): self.treev.grab_focus() gtk.Dialog.run(self) - def onResponse(self, dialog, response_id): + def onResponse(self, _dialog, response_id): if response_id == gtk.ResponseType.OK: self.updateVars() self.destroy() @@ -302,12 +302,12 @@ def onResponse(self, dialog, response_id): self.destroy() return True - def onDeleteEvent(self, dialog, gevent): + def onDeleteEvent(self, _dialog, _gevent): self.destroy() return True -def tuneHijriMonthes(widget=None): +def tuneHijriMonthes(_widget=None): dialog = EditDbDialog(transient_for=ui.prefWindow) dialog.resize(400, 400) dialog.run() @@ -354,7 +354,7 @@ def __init__(self, **kwargs): ### self.vbox.show_all() - def onResponse(self, dialog, response_id): + def onResponse(self, _dialog, _response_id): if self.noShowCheckb.get_active(): with open(hijri.monthDbExpiredIgnoreFile, "w") as _file: _file.write("") @@ -374,7 +374,7 @@ def checkHijriMonthsExpiration(): class HijriMonthsExpirationListener: - def onCurrentDateChange(self, gdate): + def onCurrentDateChange(self, _gdate): checkHijriMonthsExpiration() diff --git a/scal3/ui_gtk/layout.py b/scal3/ui_gtk/layout.py index ce4fc50de..0c52cf990 100644 --- a/scal3/ui_gtk/layout.py +++ b/scal3/ui_gtk/layout.py @@ -289,7 +289,7 @@ def getOptionsButtonBox(self): def onItemMoveClick( self, - button: gtk.Button, + _button: gtk.Button, item: "WinLayoutBox | WinLayoutObj", ): index = self.items.index(item) diff --git a/scal3/ui_gtk/mainwin_items/labelBox.py b/scal3/ui_gtk/mainwin_items/labelBox.py index ca3321c5b..b3821995d 100644 --- a/scal3/ui_gtk/mainwin_items/labelBox.py +++ b/scal3/ui_gtk/mainwin_items/labelBox.py @@ -166,13 +166,13 @@ def changeCalType(self, calType): s = self.getActiveStr(s) self.menuLabels[i].set_label(s) - def itemActivate(self, item, index): + def itemActivate(self, _item, index): y, m, d = ui.cell.dates[self.calType] m = index + 1 ui.changeDate(y, m, d, self.calType) self.onDateChange() - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, gevent): if gevent.button == 3: self.createMenuLabels() foo, x, y = self.get_window().get_origin() @@ -185,7 +185,7 @@ def onButtonPress(self, widget, gevent): self.menu.popup( None, None, - lambda *args: (x, y, True), + lambda *_args: (x, y, True), None, gevent.button, gevent.time, @@ -257,7 +257,7 @@ def createMenu(self): self.menu.append(item) item.connect("select", self.arrowSelect, -1) item.connect("deselect", self.arrowDeselect) - item.connect("activate", lambda wid: False) + item.connect("activate", lambda _w: False) ########## for i in range(self.height): item = MenuItem() @@ -294,11 +294,11 @@ def updateMenu(self, start=None): else: self.menuLabels[i].set_label(_(start + i)) - def itemActivate(self, widget, item): + def itemActivate(self, _widget, item): self.setActive(self.start + item) self.emit("changed", self.start + item) - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, gevent): if gevent.button == 3: self.updateMenu() foo, x, y = self.get_window().get_origin() @@ -307,7 +307,7 @@ def onButtonPress(self, widget, gevent): self.menu.popup( None, None, - lambda *args: (x, y, True), + lambda *_args: (x, y, True), None, gevent.button, gevent.time, @@ -317,7 +317,7 @@ def onButtonPress(self, widget, gevent): return False - def arrowSelect(self, item, plus): + def arrowSelect(self, _item, plus): self.remain = plus timeout_add( int(ui.labelMenuDelay * 1000), @@ -325,7 +325,7 @@ def arrowSelect(self, item, plus): plus, ) - def arrowDeselect(self, item): + def arrowDeselect(self, _item): self.remain = 0 def arrowRemain(self, plus): @@ -346,7 +346,7 @@ def arrowRemain(self, plus): return False - def menuScroll(self, widget, gevent): + def menuScroll(self, _widget, gevent): d = getScrollValue(gevent) if d == "up": self.updateMenu(self.start - 1) @@ -392,7 +392,7 @@ def __init__(self, calType, **kwargs): ### self.connect("changed", self.onChanged) - def onChanged(self, label, item): + def onChanged(self, _label, item): calType = self.calType y, m, d = ui.cell.dates[calType] ui.changeDate(item, m, d, calType) @@ -456,11 +456,11 @@ def __init__(self, calType, **kwargs): ### pack(self, self.addButton) - def onPrevClick(self, button): + def onPrevClick(self, _button): ui.yearPlus(-1) self.label.onDateChange() - def onNextClick(self, button): + def onNextClick(self, _button): ui.yearPlus(1) self.label.onDateChange() @@ -494,11 +494,11 @@ def __init__(self, calType, **kwargs): ### pack(self, self.addButton) - def onPrevClick(self, button): + def onPrevClick(self, _button): ui.monthPlus(-1) self.label.onDateChange() - def onNextClick(self, button): + def onNextClick(self, _button): ui.monthPlus(1) self.label.onDateChange() diff --git a/scal3/ui_gtk/mainwin_items/monthCal.py b/scal3/ui_gtk/mainwin_items/monthCal.py index 0adaa1f2b..bffc2d55a 100644 --- a/scal3/ui_gtk/mainwin_items/monthCal.py +++ b/scal3/ui_gtk/mainwin_items/monthCal.py @@ -279,7 +279,7 @@ def getSubPages(self): self.getOptionsWidget() return self.subPages - def drawAll(self, widget=None, cursor=True): + def drawAll(self, _widget=None, cursor=True): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. @@ -513,7 +513,7 @@ def updateTextWidth(self): # self.wdaysWidth = wm * 7 * 0.7 + ui.mcalLeftMargin # log.debug("max =", wm, " wdaysWidth =", self.wdaysWidth) - def onButtonPress(self, obj, gevent): + def onButtonPress(self, _obj, gevent): # self.winActivate() #????????? b = gevent.button ( @@ -609,7 +609,7 @@ def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): return False return True - def scroll(self, widget, gevent): + def scroll(self, _widget, gevent): d = getScrollValue(gevent) if d == "up": self.jdPlus(-7) @@ -619,13 +619,13 @@ def scroll(self, widget, gevent): return None return False - def getCellPos(self, *args): + def getCellPos(self, *_args): return ( int(self.cx[ui.cell.monthPos[0]]), int(self.cy[ui.cell.monthPos[1]] + self.dy / 2), ) - def getMainMenuPos(self, *args): # FIXME + def getMainMenuPos(self, *_args): # FIXME if rtl: return ( int(self.get_allocation().width - ui.mcalLeftMargin / 2), diff --git a/scal3/ui_gtk/mainwin_items/toolbar.py b/scal3/ui_gtk/mainwin_items/toolbar.py index 045cd835c..1516e0b95 100644 --- a/scal3/ui_gtk/mainwin_items/toolbar.py +++ b/scal3/ui_gtk/mainwin_items/toolbar.py @@ -33,7 +33,7 @@ def getMenuPos(self): y0 + h // 2, ) - def onButtonPress(self, widget=None, gevent=None): + def onButtonPress(self, _widget=None, gevent=None): toolbar = self.get_parent() x, y = self.translate_coordinates( toolbar.get_parent(), diff --git a/scal3/ui_gtk/mainwin_items/weekCal.py b/scal3/ui_gtk/mainwin_items/weekCal.py index 359181af1..1b65f0871 100644 --- a/scal3/ui_gtk/mainwin_items/weekCal.py +++ b/scal3/ui_gtk/mainwin_items/weekCal.py @@ -204,7 +204,7 @@ def do_get_preferred_width(self): return 0, 0 return width, width - def onExposeEvent(self, widget=None, event=None): + def onExposeEvent(self, _widget=None, _event=None): if ui.disableRedraw: return if self.wcal.status is None: @@ -383,7 +383,7 @@ def drawTextList( show_layout(cr, layout) lineI += 1 - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, _gevent): return False def onDateChange(self, *a, **kw): @@ -448,7 +448,7 @@ def getMenuPos(self): y0 + h // 2, ) - def onButtonPress(self, widget=None, gevent=None): + def onButtonPress(self, _widget=None, _gevent=None): x, y = self.getMenuPos() self._wcal.emit( "popup-main-menu", @@ -479,7 +479,7 @@ def onDateChange(self, *a, **ka): LabelToolBoxItem.onDateChange(self, *a, **ka) self.updateLabel() - def onClick(self, *a): + def onClick(self, *_a): ui.wcal_toolbar_weekNum_negative = not ui.wcal_toolbar_weekNum_negative self.updateLabel() ui.saveLiveConf() @@ -840,7 +840,7 @@ def __init__(self, wcal): ##### Column.__init__(self, wcal) ##### - self.connect("realize", lambda w: self.updateData()) + self.connect("realize", lambda _w: self.updateData()) self.connect("draw", self.onExposeEvent) def updateData(self): @@ -968,7 +968,7 @@ def set(self, data): font = ui.getFont() self.fontb.set_font(font) - def onChange(self, obj=None, event=None): + def onChange(self, _obj=None, _event=None): ui.wcalTypeParams[self.index] = self.get() self.wcal.queue_draw() @@ -1482,16 +1482,16 @@ def onDateChange(self, *a, **kw): # for item in self.items: # item.queue_draw() - def goBackward4(self, obj=None): + def goBackward4(self, _obj=None): self.jdPlus(-28) - def goBackward(self, obj=None): + def goBackward(self, _obj=None): self.jdPlus(-7) - def goForward(self, obj=None): + def goForward(self, _obj=None): self.jdPlus(7) - def goForward4(self, obj=None): + def goForward4(self, _obj=None): self.jdPlus(28) def itemContainsGdkWindow(self, item, col_win): @@ -1515,7 +1515,7 @@ def findColumnWidgetByGdkWindow(self, col_win): return item return None - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, gevent): # gevent is Gdk.EventButton col = self.findColumnWidgetByGdkWindow(gevent.get_window()) if not col: @@ -1566,7 +1566,7 @@ def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): return False return True - def scroll(self, widget, gevent): + def scroll(self, _widget, gevent): d = getScrollValue(gevent) if d == "up": self.jdPlus(-1) @@ -1576,7 +1576,7 @@ def scroll(self, widget, gevent): return None return False - def getCellPos(self, *args): + def getCellPos(self, *_args): alloc = self.get_allocation() return ( int(alloc.width / 2), @@ -1589,7 +1589,7 @@ def getToolbar(self): return item return None - def getMainMenuPos(self, *args): + def getMainMenuPos(self, *_args): toolbar = self.getToolbar() if toolbar: for item in toolbar.items: diff --git a/scal3/ui_gtk/mywidgets/__init__.py b/scal3/ui_gtk/mywidgets/__init__.py index 5948b9aa0..ee1c79ff1 100644 --- a/scal3/ui_gtk/mywidgets/__init__.py +++ b/scal3/ui_gtk/mywidgets/__init__.py @@ -67,10 +67,10 @@ def setupDragAndDrop(self): def dragDataGet( self, fontb: gtk.FontButton, - context: gdk.DragContext, + _context: gdk.DragContext, selection: gtk.SelectionData, - info: int, - etime: int, + _info: int, + _etime: int, ): # log.debug("fontButtonDragDataGet") valueStr = gfontEncode(fontb.get_font()) @@ -78,7 +78,16 @@ def dragDataGet( selection.set_text(valueStr, len(valueBytes)) return True - def dragDataRec(self, fontb, context, x, y, selection, target_id, etime): + def dragDataRec( + self, + fontb, + _context, + _x, + _y, + selection, + _target_id, + _etime, + ): # dtype = selection.get_data_type() # log.debug(dtype ## UTF8_STRING) text = selection.get_text() @@ -90,7 +99,7 @@ def dragDataRec(self, fontb, context, x, y, selection, target_id, etime): self.emit("font-set") return True - def dragBegin(self, fontb, context): + def dragBegin(self, _fontb, context): # log.debug("fontBottonDragBegin"## caled before dragCalDataGet) fontName = gtk.FontButton.get_font(self) pbuf = newDndFontNamePixbuf(fontName) @@ -118,7 +127,7 @@ def __init__(self): gtk.ColorChooser.set_use_alpha(self, True) self.connect("color-set", self.update_tooltip) - def update_tooltip(self, colorb=None): + def update_tooltip(self, _colorb=None): r, g, b, a = self.get_rgba() if gtk.ColorChooser.get_use_alpha(self): text = ( diff --git a/scal3/ui_gtk/mywidgets/button.py b/scal3/ui_gtk/mywidgets/button.py index 97657fe02..0510506c8 100644 --- a/scal3/ui_gtk/mywidgets/button.py +++ b/scal3/ui_gtk/mywidgets/button.py @@ -21,7 +21,7 @@ def __init__(self, button: int | None = None): def doTrigger(self): return self.emit("con-clicked") - def onPress(self, widget, event): + def onPress(self, _widget, event): if self._button is not None and event.button != self._button: return self.pressTm = now() @@ -35,7 +35,7 @@ def onPress(self, widget, event): ) return True - def onRelease(self, widget, event): + def onRelease(self, _widget, _event): self.counter += 1 return True @@ -65,7 +65,7 @@ def __init__(self, *args, **kwargs): win = gtk.Dialog() button = ConButton("Press") - def con_clicked(arg): + def con_clicked(_arg): log.info(f"{now():.4f}\tcon-clicked") button.connect("con-clicked", con_clicked) diff --git a/scal3/ui_gtk/mywidgets/cal_type_combo.py b/scal3/ui_gtk/mywidgets/cal_type_combo.py index a94e997f3..18d9b861a 100644 --- a/scal3/ui_gtk/mywidgets/cal_type_combo.py +++ b/scal3/ui_gtk/mywidgets/cal_type_combo.py @@ -27,5 +27,5 @@ def __init__(self, hasDefault=False): ## , showInactive=True FIXME for i, mod in calTypes.iterIndexModuleInactive(): ls.append([i, _(mod.desc, ctx="calendar")]) - def _is_separator(self, model, rowIter, data): + def _is_separator(self, model, rowIter, _data): return model.get_value(rowIter, 1) is None diff --git a/scal3/ui_gtk/mywidgets/clock.py b/scal3/ui_gtk/mywidgets/clock.py index 740b1a58b..ca5924e3f 100644 --- a/scal3/ui_gtk/mywidgets/clock.py +++ b/scal3/ui_gtk/mywidgets/clock.py @@ -101,7 +101,7 @@ def stop(self): class FClockWidget(gtk.DrawingArea): ## Time is in Local - def __init__(self, clockFormat="%T", selectable=False): + def __init__(self, clockFormat="%T", _selectable=False): """ clockFormat is a string that used in strftime(), it can contains markup that apears in GtkLabel for example format can be "%T" @@ -133,7 +133,7 @@ def set_label(self, text): self.text = text self.queue_draw() - def onDraw(self, widget=None, event=None): + def onDraw(self, _widget=None, _event=None): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. diff --git a/scal3/ui_gtk/mywidgets/expander.py b/scal3/ui_gtk/mywidgets/expander.py index b67f05737..a3f45134e 100644 --- a/scal3/ui_gtk/mywidgets/expander.py +++ b/scal3/ui_gtk/mywidgets/expander.py @@ -98,7 +98,7 @@ def __init__( def add(self, child: gtk.Widget) -> None: pack(self._box, child, 1, 1) - def _onTitleClick(self, button): + def _onTitleClick(self, _button): self.set_expanded(not self.get_expanded()) self.emit("activate") diff --git a/scal3/ui_gtk/mywidgets/floatingMsg.py b/scal3/ui_gtk/mywidgets/floatingMsg.py index 8f21c9748..a99e69f3a 100644 --- a/scal3/ui_gtk/mywidgets/floatingMsg.py +++ b/scal3/ui_gtk/mywidgets/floatingMsg.py @@ -43,7 +43,7 @@ @registerType class FloatingMsg(gtk.DrawingArea): - def on_realize(self, widget): + def on_realize(self, _widget): self.animateStart() def __init__( @@ -116,14 +116,14 @@ def updateLine(self): self.startXpos = -self.textWidth if self.rtl else screenWidth self.xpos = self.startXpos - def finish(self, w=None, e=None): + def finish(self, _w=None, _e=None): self.isFinished = True self.win.destroy() self.destroy() if self.finishFunc: self.finishFunc() - def onExposeEvent(self, widget, gevent): + def onExposeEvent(self, _widget, _gevent): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. @@ -189,7 +189,7 @@ def set_label(self, text): self.rtl = self.isRtl() self.rtlSign = 1 if self.rtl else -1 - def onExposeEvent(self, widget, gevent): + def onExposeEvent(self, _widget, _gevent): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. @@ -261,14 +261,14 @@ def __init__( self.lines = lines self.index = 0 ######## - self.connect("realize", lambda widget: self.animateStart()) + self.connect("realize", lambda _w: self.animateStart()) def updateLine(self): self.label.set_label(self.lines[self.index]) self.startXpos = -self.label.width if self.label.rtl else screenWidth self.startTime = now() - def finish(self, w=None, e=None): + def finish(self, _w=None, _e=None): self.isFinished = True self.destroy() if self.finishFunc: diff --git a/scal3/ui_gtk/mywidgets/icon.py b/scal3/ui_gtk/mywidgets/icon.py index 25bb89806..b7aa68dd5 100644 --- a/scal3/ui_gtk/mywidgets/icon.py +++ b/scal3/ui_gtk/mywidgets/icon.py @@ -30,7 +30,7 @@ class IconSelectButton(gtk.Button): ("changed", [str]), ] - def __init__(self, filename="", transient_for=None): + def __init__(self, filename=""): gtk.Button.__init__(self) self.image = gtk.Image() self.add(self.image) @@ -98,7 +98,7 @@ def createDialog(self): return dialog - def onButtonPressEvent(self, widget, gevent): + def onButtonPressEvent(self, _widget, gevent): b = gevent.button if b == 1: dialog = self.createDialog() @@ -107,7 +107,7 @@ def onButtonPressEvent(self, widget, gevent): elif b == 3: self.menu.popup(None, None, None, None, b, gevent.time) - def menuItemActivate(self, widget, icon): + def menuItemActivate(self, _widget, icon): self.set_filename(icon) self.emit("changed", icon) diff --git a/scal3/ui_gtk/mywidgets/label.py b/scal3/ui_gtk/mywidgets/label.py index 5b44db902..c270334a7 100644 --- a/scal3/ui_gtk/mywidgets/label.py +++ b/scal3/ui_gtk/mywidgets/label.py @@ -25,7 +25,7 @@ def __init__(self, label=None): self.set_use_markup(True) self.connect("populate-popup", self.popupPopulate) - def popupPopulate(self, label, menu): + def popupPopulate(self, _label, menu): itemCopyAll = ImageMenuItem( _("Copy _All"), imageName="edit-copy.svg", @@ -50,10 +50,10 @@ def popupPopulate(self, label, menu): ## ui.updateFocusTime() - def copy(self, item): + def copy(self, _item): start = self.get_property("selection-bound") end = self.get_property("cursor-position") setClipboard(toStr(self.get_text())[start:end]) - def copyAll(self, label): + def copyAll(self, _label): setClipboard(self.get_text()) diff --git a/scal3/ui_gtk/mywidgets/multi_spin/__init__.py b/scal3/ui_gtk/mywidgets/multi_spin/__init__.py index ba84b5616..da1aeadbf 100644 --- a/scal3/ui_gtk/mywidgets/multi_spin/__init__.py +++ b/scal3/ui_gtk/mywidgets/multi_spin/__init__.py @@ -56,7 +56,7 @@ def do_get_preferred_width(self): self.maxPixelWidth = pixelWidth return pixelWidth, pixelWidth - def onChange(self, entry): + def onChange(self, _entry): self.queue_resize() @@ -186,10 +186,10 @@ def __init__( #### # self.select_region(0, 0) - def _entry_changed(self, widget): + def _entry_changed(self, _widget): self.emit("changed") - def _entry_activate(self, widget): + def _entry_activate(self, _widget): # log.debug("_entry_activate", self.entry.get_text()) self.update() # log.debug(self.entry.get_text()) @@ -235,7 +235,7 @@ def entry_plus(self, p): self.entry.set_text(self.field.getText()) self.entry.set_position(pos) - def onKeyPress(self, widget, gevent): + def onKeyPress(self, _widget, gevent): kval = gevent.keyval kname = gdk.keyval_name(kval).lower() step_inc = self.step_inc @@ -301,13 +301,13 @@ def onKeyPress(self, widget, gevent): # log.debug(kname, kval) return False - def onDownButtonPress(self, button, gevent): + def onDownButtonPress(self, _button, _gevent): self._arrow_press(-self.step_inc) - def onUpButtonPress(self, button, gevent): + def onUpButtonPress(self, _button, _gevent): self._arrow_press(self.step_inc) - def _scroll(self, widget, gevent): + def _scroll(self, _widget, gevent): d = getScrollValue(gevent) if d in ("up", "down"): if not self.entry.has_focus(): @@ -342,7 +342,7 @@ def _arrow_remain(self, plus): plus, ) - def onButtonRelease(self, widget, gevent): + def onButtonRelease(self, _widget, _gevent): self._remain = False """## ???????????????????????????????? diff --git a/scal3/ui_gtk/mywidgets/multi_spin/option_box/__init__.py b/scal3/ui_gtk/mywidgets/multi_spin/option_box/__init__.py index 8b88210c1..939f09034 100644 --- a/scal3/ui_gtk/mywidgets/multi_spin/option_box/__init__.py +++ b/scal3/ui_gtk/mywidgets/multi_spin/option_box/__init__.py @@ -10,7 +10,7 @@ class MultiSpinOptionBox(gtk.Box): ("activate", []), ] - def _entry_activate(self, widget): + def _entry_activate(self, _widget): # self.spin.update() #????? # self.add_history() self.emit("activate") @@ -50,7 +50,7 @@ def __init__( self.get_value = self.spin.get_value self.set_value = self.spin.set_value - def option_pressed(self, widget, gevent): + def option_pressed(self, _widget, gevent): # x, y, w, h = self.option. self.menu.popup(None, None, None, None, gevent.button, gevent.time) @@ -70,7 +70,7 @@ def add_history(self): self.menu.remove(self.menuItems.pop(index)) # m.prepend([text]) # self.combo.prepend_text(text) item = MenuItem(text) - item.connect("activate", lambda obj: self.spin.set_text(text)) + item.connect("activate", lambda _obj: self.spin.set_text(text)) item.text = text self.menu.add(item) self.menu.reorder_child(item, 0) diff --git a/scal3/ui_gtk/mywidgets/num_ranges_entry.py b/scal3/ui_gtk/mywidgets/num_ranges_entry.py index 3672c8ced..26c310000 100644 --- a/scal3/ui_gtk/mywidgets/num_ranges_entry.py +++ b/scal3/ui_gtk/mywidgets/num_ranges_entry.py @@ -110,7 +110,7 @@ def numPlus(self, plus): endI - len(thisNumStr) + len(newNumStr), ) - def onKeyPress(self, obj: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _obj: gtk.Widget, gevent: gdk.EventKey): kval = gevent.keyval kname = gdk.keyval_name(gevent.keyval).lower() # log.debug(kval, kname) diff --git a/scal3/ui_gtk/mywidgets/resize_button.py b/scal3/ui_gtk/mywidgets/resize_button.py index 63b48fba7..ce3c47e8d 100644 --- a/scal3/ui_gtk/mywidgets/resize_button.py +++ b/scal3/ui_gtk/mywidgets/resize_button.py @@ -12,7 +12,7 @@ def __init__(self, win, size=20, edge=gdk.WindowEdge.SOUTH_EAST): self.add(self.image) self.connect("button-press-event", self.onButtonPress) - def onButtonPress(self, obj, gevent): + def onButtonPress(self, _obj, gevent): self.win.begin_resize_drag( self.edge, gevent.button, diff --git a/scal3/ui_gtk/mywidgets/source_editor.py b/scal3/ui_gtk/mywidgets/source_editor.py index 1ed4359ca..f5bbdce7d 100644 --- a/scal3/ui_gtk/mywidgets/source_editor.py +++ b/scal3/ui_gtk/mywidgets/source_editor.py @@ -22,7 +22,7 @@ def __init__(self, onTextChange=None): if onTextChange is not None: self.textbuffer.connect("changed", onTextChange) - def _key_press_event(self, widget, event): + def _key_press_event(self, _widget, event): keyvalobjName = gdk.keyval_name(event.keyval) ctrl = event.state & gdk.ModifierType.CONTROL_MASK if ctrl and keyvalobjName == "y": # noqa: SIM102 diff --git a/scal3/ui_gtk/mywidgets/text_widgets.py b/scal3/ui_gtk/mywidgets/text_widgets.py index a50d3995a..d86e2ff93 100644 --- a/scal3/ui_gtk/mywidgets/text_widgets.py +++ b/scal3/ui_gtk/mywidgets/text_widgets.py @@ -10,7 +10,7 @@ class ReadOnlyTextWidget: - def copyAll(self, item): + def copyAll(self, _item): return setClipboard(toStr(self.get_text())) def has_selection(): @@ -30,14 +30,14 @@ def get_selection_bound(self): def has_selection(self): return self.get_cursor_position() != self.get_selection_bound() - def copy(self, item): + def copy(self, _item): bound = self.get_selection_bound() cursor = self.get_cursor_position() start = min(bound, cursor) end = max(bound, cursor) setClipboard(toStr(self.get_text())[start:end]) - def onPopup(self, widget, menu): + def onPopup(self, _widget, menu): # instead of creating a new menu, we should remove all the # current items from current menu for item in menu.get_children(): @@ -86,21 +86,21 @@ def has_selection(self): else: return True - def copy(self, item): + def copy(self, _item): buf = self.get_buffer() start_iter, end_iter = buf.get_selection_bounds() setClipboard(toStr(buf.get_text(start_iter, end_iter, True))) - def copyWordByIter(self, item, _iter): - text = self.get_text() - pos = _iter.get_offset() - word = findWordByPos(text, pos)[0] - setClipboard(word) + # def copyWordByIter(self, _item, _iter): + # text = self.get_text() + # pos = _iter.get_offset() + # word = findWordByPos(text, pos)[0] + # setClipboard(word) - def copyText(self, item, text): + def copyText(self, _item, text): setClipboard(text) - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, gevent): if gevent.button != 3: return False #### diff --git a/scal3/ui_gtk/mywidgets/tz_combo.py b/scal3/ui_gtk/mywidgets/tz_combo.py index 24c5e94b2..76de597fe 100644 --- a/scal3/ui_gtk/mywidgets/tz_combo.py +++ b/scal3/ui_gtk/mywidgets/tz_combo.py @@ -57,7 +57,7 @@ def appendOrderedDict(self, parentIter, dct): else: itr = model.append(parentIter, [key, True]) - def onChanged(self, widget): + def onChanged(self, _widget): model = self.c.get_model() itr = self.c.get_active_iter() if itr is None: diff --git a/scal3/ui_gtk/mywidgets/ymd.py b/scal3/ui_gtk/mywidgets/ymd.py index 989d350c9..b8571d58b 100644 --- a/scal3/ui_gtk/mywidgets/ymd.py +++ b/scal3/ui_gtk/mywidgets/ymd.py @@ -58,7 +58,7 @@ def setCalType(self, calType): self.comboMonthChanged, ) - def changeCalType(self, calType, newCalType): ## FIXME naming standard? + def changeCalType(self, _calType, newCalType): ## FIXME naming standard? self.setCalType(newCalType) def set_value(self, date): @@ -74,7 +74,7 @@ def get_value(self): self.spinD.get_value(), ) - def comboMonthChanged(self, widget=None): + def comboMonthChanged(self, _widget=None): monthIndex = self.comboMonth.get_active() if monthIndex == -1: return diff --git a/scal3/ui_gtk/player.py b/scal3/ui_gtk/player.py index 8ba79a4c1..fd7257166 100644 --- a/scal3/ui_gtk/player.py +++ b/scal3/ui_gtk/player.py @@ -207,7 +207,7 @@ def queryStatus(self): return True # Handle EOF in mplayerOut - def handleEof(self, source, condition): + def handleEof(self, _source, _condition): self.stopStatusQuery() self.mplayerIn, self.mplayerOut = None, None self.pbox.seekAdj.value = 0 @@ -268,7 +268,7 @@ def __init__(self, hasVol=False): self.connect("key-press-event", self.divert) self.connect( "destroy", - lambda *args: mplayer.close(), + lambda *_args: mplayer.close(), ) # FIXME ##self.toolbar.connect("key-press-event", self.toolbarKey)#?????????? ############## @@ -321,7 +321,7 @@ def __init__(self, hasVol=False): scale.connect("key-press-event", self.divert) pack(self, scale, False, False, 5) # noqa: FURB120 - def divert(self, widget, gevent): + def divert(self, _widget, gevent): key = gevent.hardware_keycode if key == self.key_seekback: # left arrow, seek self.mplayer.seek(-SEEK_TIME_SMALL) @@ -345,7 +345,7 @@ def divert(self, widget, gevent): return False - def displaySongString(self, seekBar, value): + def displaySongString(self, _seekBar, value): if self.mplayer.playTime: return str(int(value)) + "% of " + self.mplayer.playTime if self.mplayer.mplayerIn: @@ -353,7 +353,7 @@ def displaySongString(self, seekBar, value): # + self.playlist.getCurrentSongTime() # FIXME return str(int(value)) + "%" - def seek(self, widget, gevent): # Seek on changing the seekBar + def seek(self, _widget, _gevent): # Seek on changing the seekBar # log.debug("seek", self.seekAdj.value, self.mplayer.mplayerIn) if not self.mplayer.mplayerIn: log.info("abc") @@ -367,7 +367,7 @@ def seek(self, widget, gevent): # Seek on changing the seekBar self.mplayer.seek(int(self.seekAdj.value), 1) # Return formatted volume string - def displayVolString(self, scale, value): + def displayVolString(self, _scale, value): return "Volume: " + str(int(value)) + "%" def setVolume(self, adj): # Set volume when the volume range widget is changed @@ -379,7 +379,7 @@ def setVolume(self, adj): # Set volume when the volume range widget is changed self.vollevel0 = int(adj.value) self.mplayer.setVolume(self.vollevel0) - def playPause(self, button=None): + def playPause(self, _button=None): imageName = "media-playback-start.svg" if self.mplayer.mplayerIn: if not self.mplayer.paused: @@ -414,20 +414,20 @@ def stop(self, button): # Stop mplayer if it's running self.fcb.set_sensitive(self.mplayer.mplayerIn is None) self.seekBar.set_sensitive(self.mplayer.mplayerIn is not None) - def decVol(self, widget): + def decVol(self, _widget): self.mplayer.stepVolume(False) - def incVol(self, widget): + def incVol(self, _widget): self.mplayer.stepVolume(True) - def toolbarKey(self, widget, gevent): + def toolbarKey(self, _widget, gevent): # Prevent the down and up keys from taking control out of the toolbar keycode = gevent.hardware_keycode if keycode in (98, 104): return True return False - def quit(self, event=None): + def quit(self, _event=None): self.mplayer.close() gtk.main_quit() diff --git a/scal3/ui_gtk/pluginsText.py b/scal3/ui_gtk/pluginsText.py index f4ac79bdb..86ef8593c 100644 --- a/scal3/ui_gtk/pluginsText.py +++ b/scal3/ui_gtk/pluginsText.py @@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs): self.occurOffsets = [] self.initVars() - def copyAll(self, item): + def copyAll(self, _item): return setClipboard(toStr(self.get_text())) def cursorIsOnURL(self): @@ -50,18 +50,12 @@ def has_selection(self): else: return True - def copy(self, item): + def copy(self, _item): buf = self.get_buffer() start_iter, end_iter = buf.get_selection_bounds() setClipboard(toStr(buf.get_text(start_iter, end_iter, True))) - def copyWordByIter(self, item, _iter): - text = self.get_text() - pos = _iter.get_offset() - word = findWordByPos(text, pos)[0] - setClipboard(word) - - def copyText(self, item, text): + def copyText(self, _item, text): setClipboard(text) def onDateChange(self, *a, **kw): @@ -125,13 +119,13 @@ def addPluginMenuItems(self, menu, occurData): def addExtraMenuItems(self, menu): pass - def onPlugConfClick(self, item, plug): + def onPlugConfClick(self, _item, plug): if not plug.hasConfig: return plug.open_configure() ud.windowList.onConfigChange() - def onPlugAboutClick(self, item, plug): + def onPlugAboutClick(self, _item, plug): from scal3.ui_gtk.about import AboutDialog if hasattr(plug, "open_about"): @@ -145,14 +139,14 @@ def onPlugAboutClick(self, item, plug): comments=plug.about, ) about.set_transient_for(self.get_toplevel()) - about.connect("delete-event", lambda w, e: w.destroy()) - about.connect("response", lambda w, e: w.destroy()) + about.connect("delete-event", lambda w, _e: w.destroy()) + about.connect("response", lambda w, _e: w.destroy()) # about.set_resizable(True) # about.vbox.show_all() # OR about.vbox.show_all() ; about.run() openWindow(about) # FIXME return None - def copyTextFromMenu(self, item, text): + def copyTextFromMenu(self, _item, text): setClipboard(text) def addText(self, text): @@ -170,7 +164,7 @@ def addText(self, text): b_text = text.encode("utf-8") textbuff.insert_markup(endIter, text, len(b_text)) - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, gevent): if gevent.button != 3: return False #### @@ -316,7 +310,7 @@ def updateJustification(self): value = getattr(ui, self.justificationParam) self.textview.set_justification(ud.justificationByName[value]) - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, _gevent): # log.debug("PluginsText: onButtonPress") # without this, it will switch to begin_move_drag on button-press return True diff --git a/scal3/ui_gtk/pref_utils.py b/scal3/ui_gtk/pref_utils.py index e28c59f80..4df04ce3c 100644 --- a/scal3/ui_gtk/pref_utils.py +++ b/scal3/ui_gtk/pref_utils.py @@ -239,7 +239,7 @@ def __init__( elif onChangeFunc is not None: raise ValueError("onChangeFunc is given without live=True") - def onChange(self, w: gtk.Widget) -> None: + def onChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -292,7 +292,7 @@ def __init__( hbox.show_all() self._widget = hbox - def onFontButtonClick(self, w: gtk.Widget) -> None: + def onFontButtonClick(self, _w: gtk.Widget) -> None: if not self.hasAuto: return self.fontRadio.set_active(True) @@ -313,7 +313,7 @@ def set(self, value: "str | None") -> None: self.fontRadio.set_active(True) self.fontButton.set_font(gfontEncode(ui.Font(family=value, size=15))) - def onChange(self, w: gtk.Widget) -> None: + def onChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -483,7 +483,7 @@ def get(self) -> bool: def set(self, value: bool): self._widget.set_active(value) - def onClick(self, w: gtk.Widget) -> None: + def onClick(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -548,7 +548,7 @@ def set(self, color: "ColorType | None") -> None: return self._widget.set_rgba(color) - def onColorSet(self, w: gtk.Widget): + def onColorSet(self, _w: gtk.Widget): self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -599,7 +599,7 @@ def updateWidget(self) -> None: self._colorItem.updateWidget() self._colorItem.getWidget().set_sensitive(self._checkItem.get()) - def onChange(self, w: gtk.Widget) -> None: + def onChange(self, _w: gtk.Widget) -> None: self._colorItem.getWidget().set_sensitive(self._checkItem.get()) if self.live: self.updateVar() @@ -653,7 +653,7 @@ def updateWidget(self) -> None: self._fontItem.updateWidget() self._fontItem.getWidget().set_sensitive(self._checkItem.get()) - def onChange(self, w: gtk.Widget) -> None: + def onChange(self, _w: gtk.Widget) -> None: self._fontItem.getWidget().set_sensitive(self._checkItem.get()) if self.live: self.updateVar() @@ -713,7 +713,7 @@ def set(self, value: "int | float") -> None: self._spinb.set_value(value) # FIXME: updateWidget is triggering onChange func, can we avoid that? - def onChange(self, w: gtk.Widget) -> None: + def onChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -757,7 +757,7 @@ def get(self) -> str: def set(self, text: str) -> None: self.textInput.set_text(text) - def onTextChange(self, w: gtk.Widget) -> None: + def onTextChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -847,7 +847,7 @@ def get(self) -> str: def set(self, value: str) -> None: self._widget.set_filename(value) - def onRevertClick(self, button: gtk.Button) -> None: + def onRevertClick(self, _button: gtk.Button) -> None: defaultValue = getattr(self.obj, self.defaultVarName) setattr( self.obj, @@ -865,7 +865,7 @@ def __init__(self, *args, **kwargs) -> None: self._widget.set_preview_widget_active(True) self._widget.connect("update-preview", self._updatePreview) - def _updatePreview(self, w: gtk.Widget) -> None: + def _updatePreview(self, _w: gtk.Widget) -> None: fpath = self._widget.get_preview_filename() self._preview.set_from_file(fpath) @@ -913,7 +913,7 @@ def set(self, iconPath: str) -> None: iconPath = join(pixDir, iconPath) self.iconSelect.set_filename(iconPath) - def onIconChanged(self, widget: gtk.Widget, iconPath: str) -> None: + def onIconChanged(self, _widget: gtk.Widget, iconPath: str) -> None: if not iconPath: self.updateWidget() self.updateVar() @@ -1046,7 +1046,7 @@ def set(self, value: str) -> None: """Value must be one of "ltr", "rtl", "auto".""" self._combo.setValue(value) - def onComboChange(self, w: gtk.Widget) -> None: + def onComboChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -1086,7 +1086,7 @@ def set(self, value: str) -> None: """Value must be one of "left", "right", "center", "fill".""" self._combo.setValue(value) - def onComboChange(self, w: gtk.Widget) -> None: + def onComboChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() diff --git a/scal3/ui_gtk/pref_utils_extra.py b/scal3/ui_gtk/pref_utils_extra.py index fca800512..29585555b 100644 --- a/scal3/ui_gtk/pref_utils_extra.py +++ b/scal3/ui_gtk/pref_utils_extra.py @@ -130,7 +130,7 @@ def updateWidget(self) -> None: self.fixedItem.updateWidget() self.ratioItem.updateWidget() - def onChange(self, w: gtk.Widget) -> None: + def onChange(self, _w: gtk.Widget) -> None: self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -257,7 +257,7 @@ def get(self) -> int: def set(self, value: int) -> None: self._combo.set_active(value) - def onClick(self, w): + def onClick(self, _w): self.updateVar() if self._onChangeFunc: self._onChangeFunc() @@ -366,10 +366,10 @@ def __init__(self) -> None: def dragDataGet( self, treev: gtk.TreeView, - context: gdk.DragContext, - selection: gtk.SelectionData, - dragId: int, - etime: int, + _context: gdk.DragContext, + _selection: gtk.SelectionData, + _dragId: int, + _etime: int, ) -> bool: path, col = treev.get_cursor() if path is None: @@ -383,9 +383,9 @@ def dragDataReceived( context: gdk.DragContext, x: int, y: int, - selection: gtk.SelectionData, - dragId: int, - etime: int, + _selection: gtk.SelectionData, + _dragId: int, + _etime: int, ) -> None: srcTreev = gtk.drag_get_source_widget(context) if not isinstance(srcTreev, AICalsTreeview): @@ -566,21 +566,21 @@ def __init__(self) -> None: def activeTreevFocus( self, - treev: gtk.TreeView, - gevent: "gdk.EventFocus | None" = None, + _treev: gtk.TreeView, + _gevent: "gdk.EventFocus | None" = None, ) -> None: self.toolbar.setLeftRight(True) self.inactiveTreev.get_selection().unselect_all() def inactiveTreevFocus( self, - treev: gtk.TreeView, - gevent: "gdk.EventFocus | None" = None, + _treev: gtk.TreeView, + _gevent: "gdk.EventFocus | None" = None, ) -> None: self.toolbar.setLeftRight(False) self.activeTreev.get_selection().unselect_all() - def onLeftRightClick(self, obj: "gtk.Button | None" = None) -> None: + def onLeftRightClick(self, _obj: "gtk.Button | None" = None) -> None: action = self.toolbar.getLeftRightAction() if action == "activate": model, _iter = self.inactiveTreev.get_selection() @@ -600,7 +600,7 @@ def getCurrentTreeview(self) -> "gtk.TreeView | None": return self.inactiveTreev return None - def onUpClick(self, obj: "gtk.Button | None" = None) -> None: + def onUpClick(self, _obj: "gtk.Button | None" = None) -> None: treev = self.getCurrentTreeview() if not treev: return @@ -617,7 +617,7 @@ def onUpClick(self, obj: "gtk.Button | None" = None) -> None: ) selection.select_path(gtk.TreePath.new_from_indices((i - 1,))) - def onDownClick(self, obj: "gtk.Button | None" = None) -> None: + def onDownClick(self, _obj: "gtk.Button | None" = None) -> None: treev = self.getCurrentTreeview() if not treev: return @@ -680,17 +680,17 @@ def inactiveTreevSelectionChanged(self, selection: gtk.TreeSelection) -> None: def activeTreevRActivate( self, - treev: gtk.TreeView, + _treev: gtk.TreeView, path: list[int], - col: gtk.TreeViewColumn, + _col: gtk.TreeViewColumn, ) -> None: self.inactivateIndex(path[0]) def inactiveTreevRActivate( self, - treev: gtk.TreeView, + _treev: gtk.TreeView, path: list[int], - col: gtk.TreeViewColumn, + _col: gtk.TreeViewColumn, ): self.activateIndex(path[0]) @@ -767,7 +767,7 @@ def __init__( swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC) self._widget = swin - def onMenuModifyKeyClick(self, menu: gtk.Menu, rowI: int): + def onMenuModifyKeyClick(self, _menu: gtk.Menu, rowI: int): trees = self.treev.get_model() row = trees[rowI] print(f"Modify Key: {row=}") # noqa: T201 @@ -777,11 +777,11 @@ def onMenuModifyKeyClick(self, menu: gtk.Menu, rowI: int): # row = trees[rowI] # print(f"Default Key: {row=}") - def onMenuDeleteClick(self, menu: gtk.Menu, rowI: int): + def onMenuDeleteClick(self, _menu: gtk.Menu, rowI: int): trees = self.treev.get_model() trees.remove(trees.get_iter(rowI)) - def onTreeviewButtonPress(self, widget, gevent): + def onTreeviewButtonPress(self, _widget, gevent): from scal3.ui_gtk.menuitems import ImageMenuItem b = gevent.button diff --git a/scal3/ui_gtk/preferences.py b/scal3/ui_gtk/preferences.py index d20a28858..8539cc60b 100644 --- a/scal3/ui_gtk/preferences.py +++ b/scal3/ui_gtk/preferences.py @@ -1238,14 +1238,14 @@ def __init__(self, **kwargs): self.vbox.show_all() self.vbox.connect("realize", self.onMainVBoxRealize) - def onMainVBoxRealize(self, *args): + def onMainVBoxRealize(self, *_args): ud.windowList.updateCSS() - def onClearImageCacheClick(self, button): + def onClearImageCacheClick(self, _button): pixcache.clearFiles() pixcache.clear() - def onPageButtonClicked(self, button, page): + def onPageButtonClicked(self, _button, page): self.stack.gotoPage(page.pagePath) def newWideButton(self, page: StackPage): @@ -1268,7 +1268,7 @@ def newWideButton(self, page: StackPage): button.connect("clicked", self.onPageButtonClicked, page) return button - def comboFirstWDChanged(self, combo): + def comboFirstWDChanged(self, _combo): f = self.comboFirstWD.get_active() # 0 means Sunday if f == 7: # auto with suppress(Exception): @@ -1276,22 +1276,22 @@ def comboFirstWDChanged(self, combo): # core.firstWeekDay will be later = f self.holiWDItem.setStart(f) - def onDelete(self, obj=None, data=None): + def onDelete(self, _obj=None, _data=None): self.hide() return True - def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _arg: gtk.Widget, gevent: gdk.EventKey): if gdk.keyval_name(gevent.keyval) == "Escape": self.hide() return True return False - def ok(self, widget): + def ok(self, _widget): self.hide() self.apply() - def cancel(self, widget=None): + def cancel(self, _widget=None): self.hide() self.updatePrefGui() return True @@ -1315,7 +1315,7 @@ def loadPlugin(self, plug: "PluginType", plugI: int) -> "PluginType": core.allPlugList[plugI] = plug return plug - def apply(self, widget=None): + def apply(self, _widget=None): from scal3.ui_gtk.font_utils import gfontDecode # log.debug(f"{ui.fontDefault=}") @@ -1488,7 +1488,7 @@ def updatePrefGui(self): # Updating Pref Gui (NOT MAIN GUI) # self.plugTitleCol.get_width() + 2 # ) - def plugTreevCursorChanged(self, selection=None): + def plugTreevCursorChanged(self, _selection=None): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1499,7 +1499,7 @@ def plugTreevCursorChanged(self, selection=None): self.plugButtonAbout.set_sensitive(bool(plug.about)) self.plugButtonConf.set_sensitive(plug.hasConfig) - def onPlugAboutClick(self, obj=None): + def onPlugAboutClick(self, _obj=None): from scal3.ui_gtk.about import AboutDialog cur = self.plugTreeview.get_cursor()[0] @@ -1520,14 +1520,14 @@ def onPlugAboutClick(self, obj=None): comments=plug.about, ) about.set_transient_for(self) - about.connect("delete-event", lambda w, e: w.destroy()) - about.connect("response", lambda w, e: w.destroy()) + about.connect("delete-event", lambda w, _e: w.destroy()) + about.connect("response", lambda w, _e: w.destroy()) # about.set_resizable(True) # about.vbox.show_all() # OR about.vbox.show_all() ; about.run() openWindow(about) # FIXME return None - def onPlugConfClick(self, obj=None): + def onPlugConfClick(self, _obj=None): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1539,16 +1539,16 @@ def onPlugConfClick(self, obj=None): return plug.open_configure() - def onPlugExportToIcsClick(self, menu, plug): + def onPlugExportToIcsClick(self, _menu, plug): from scal3.ui_gtk.export import ExportToIcsDialog ExportToIcsDialog(plug.exportToIcs, plug.title).run() - def plugTreevRActivate(self, treev, path, col): + def plugTreevRActivate(self, _treev, _path, col): if col.get_title() == _("Title"): # FIXME self.onPlugAboutClick() - def plugTreevButtonPress(self, widget, gevent): + def plugTreevButtonPress(self, _widget, gevent): b = gevent.button if b == 3: cur = self.plugTreeview.get_cursor()[0] @@ -1589,7 +1589,7 @@ def plugTreevButtonPress(self, widget, gevent): return True return False - def onPlugAddClick(self, button): + def onPlugAddClick(self, _button): # FIXME # Reize window to show all texts # self.plugAddTreeview.columns_autosize() # FIXME @@ -1603,7 +1603,7 @@ def onPlugAddClick(self, button): self.plugAddDialog.run() self.pluginsToolbar.setCanAdd(len(self.plugAddItems) > 0) - def plugAddDialogClose(self, obj, gevent=None): + def plugAddDialogClose(self, _obj, _gevent=None): self.plugAddDialog.hide() return True @@ -1625,7 +1625,7 @@ def plugTreeviewCellToggled2(self, cell, path): itr = model.get_iter(path) model.set_value(itr, 2, active) - def plugTreeviewTop(self, button): + def plugTreeviewTop(self, _button): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1638,7 +1638,7 @@ def plugTreeviewTop(self, button): t.remove(t.get_iter(i + 1)) self.plugTreeview.set_cursor(0) - def plugTreeviewBottom(self, button): + def plugTreeviewBottom(self, _button): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1651,7 +1651,7 @@ def plugTreeviewBottom(self, button): t.remove(t.get_iter(i)) self.plugTreeview.set_cursor(len(t) - 1) - def plugTreeviewUp(self, button): + def plugTreeviewUp(self, _button): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1663,7 +1663,7 @@ def plugTreeviewUp(self, button): t.swap(t.get_iter(i - 1), t.get_iter(i)) self.plugTreeview.set_cursor(i - 1) - def plugTreeviewDown(self, button): + def plugTreeviewDown(self, _button): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1675,7 +1675,16 @@ def plugTreeviewDown(self, button): t.swap(t.get_iter(i), t.get_iter(i + 1)) self.plugTreeview.set_cursor(i + 1) - def plugTreevDragReceived(self, treev, context, x, y, selec, info, etime): + def plugTreevDragReceived( + self, + treev, + _context, + x, + y, + _selec, + _info, + _etime, + ): t = treev.get_model() # self.plugAddTreeModel cur = treev.get_cursor()[0] if cur is None: @@ -1701,7 +1710,7 @@ def plugTreevDragReceived(self, treev, context, x, y, selec, info, etime): t.get_iter(dest[0][0]), ) - def onPlugDeleteClick(self, button): + def onPlugDeleteClick(self, _button): cur = self.plugTreeview.get_cursor()[0] if cur is None: return @@ -1722,7 +1731,7 @@ def onPlugDeleteClick(self, button): if n > 1: self.plugTreeview.set_cursor(min(n - 2, i)) - def plugAddDialogOK(self, obj): + def plugAddDialogOK(self, _obj): cur = self.plugAddTreeview.get_cursor()[0] if cur is None: gdk.beep() @@ -1748,7 +1757,7 @@ def plugAddDialogOK(self, obj): self.plugAddDialog.hide() self.plugTreeview.set_cursor(pos) # pos == -1 ## FIXME - def plugAddTreevRActivate(self, treev, path, col): + def plugAddTreevRActivate(self, _treev, _path, _col): self.plugAddDialogOK(None) # FIXME def editAccount(self, index): @@ -1766,20 +1775,20 @@ def editAccount(self, index): ui.eventAccounts.save() self.accountsTreeModel[index][2] = account.title - def onAccountsEditClick(self, button): + def onAccountsEditClick(self, _button): cur = self.accountsTreeview.get_cursor()[0] if cur is None: return index = cur[0] self.editAccount(index) - def onAccountsRegisterClick(self, button): + def onAccountsRegisterClick(self, _button): from scal3.ui_gtk.event.register_starcal import StarCalendarRegisterDialog win = StarCalendarRegisterDialog(transient_for=self) win.run() - def onAccountsAddClick(self, button): + def onAccountsAddClick(self, _button): from scal3.ui_gtk.event.account_op import AccountEditorDialog account = AccountEditorDialog(transient_for=self).run() @@ -1804,7 +1813,7 @@ def onAccountsAddClick(self, button): return account.save() - def onAccountsDeleteClick(self, button): + def onAccountsDeleteClick(self, _button): cur = self.accountsTreeview.get_cursor()[0] if cur is None: return @@ -1822,7 +1831,7 @@ def onAccountsDeleteClick(self, button): ui.eventAccounts.save() del self.accountsTreeModel[index] - def onAccountsUpClick(self, button): + def onAccountsUpClick(self, _button): cur = self.accountsTreeview.get_cursor()[0] if cur is None: return @@ -1839,7 +1848,7 @@ def onAccountsUpClick(self, button): ) self.accountsTreeview.set_cursor(index - 1) - def onAccountsDownClick(self, button): + def onAccountsDownClick(self, _button): cur = self.accountsTreeview.get_cursor()[0] if cur is None: return @@ -1853,11 +1862,11 @@ def onAccountsDownClick(self, button): t.swap(t.get_iter(index), t.get_iter(index + 1)) self.accountsTreeview.set_cursor(index + 1) - def accountsTreevRActivate(self, treev, path, col): + def accountsTreevRActivate(self, _treev, path, _col): index = path[0] self.editAccount(index) - def accountsTreevButtonPress(self, widget, gevent): + def accountsTreevButtonPress(self, _widget, gevent): b = gevent.button if b == 3: # FIXME diff --git a/scal3/ui_gtk/right_panel.py b/scal3/ui_gtk/right_panel.py index 253b9bf54..1bb7b7928 100644 --- a/scal3/ui_gtk/right_panel.py +++ b/scal3/ui_gtk/right_panel.py @@ -33,7 +33,7 @@ def addExtraMenuItems(self, menu): ), ) - def onSwapClick(self, widget): + def onSwapClick(self, _widget): self.rightPanel.swapItems() @@ -55,7 +55,7 @@ def addExtraMenuItems(self, menu): ), ) - def onSwapClick(self, widget): + def onSwapClick(self, _widget): self.rightPanel.swapItems() @@ -171,10 +171,10 @@ def updatePosition(self, height: int): ui.mainWinRightPanelRatio = self.get_position() / height ui.saveLiveConf() - def onSizeAllocate(self, widget, requisition): + def onSizeAllocate(self, _widget, requisition): self.updatePosition(requisition.height) - def onWindowSizeChange(self, *a, **kw): + def onWindowSizeChange(self, *_a, **_kw): self.queue_resize() """ @@ -210,7 +210,7 @@ def do_get_preferred_width(self): width = ui.mainWinRightPanelWidth return width, width - def do_get_preferred_width_for_height(self, size: int) -> tuple[int, int]: + def do_get_preferred_width_for_height(self, _size: int) -> tuple[int, int]: return self.do_get_preferred_width() def getOptionsWidget(self): diff --git a/scal3/ui_gtk/selectdate.py b/scal3/ui_gtk/selectdate.py index 6a797f5b1..a172bb308 100644 --- a/scal3/ui_gtk/selectdate.py +++ b/scal3/ui_gtk/selectdate.py @@ -126,7 +126,7 @@ def __init__(self, **kwargs): self.vbox.show_all() self.resize(1, 1) - def dragRec(self, obj, context, x, y, selection, target_id, etime): + def dragRec(self, _obj, _context, _x, _y, selection, _target_id, _etime): text = selection.get_text() if text is None: return @@ -163,7 +163,7 @@ def onResponse(self): if parentWin is not None: parentWin.present() - def onCancel(self, widget, event=None): + def onCancel(self, _widget, _event=None): self.onResponse() return True @@ -181,7 +181,7 @@ def setCalType(self, calType): self.ymdBox.setCalType(calType) self.dateInput.setMaxDay(module.maxMonthLen) - def calTypeComboChanged(self, widget=None): + def calTypeComboChanged(self, _widget=None): prevCalType = self.calType prevDate = self.get() calType = self.calTypeCombo.get_active() @@ -209,7 +209,7 @@ def get(self): y0, m0, d0 = jd_to(jd, calType) return (y0, m0, d0) - def ok(self, widget): + def ok(self, _widget): calType = self.calTypeCombo.get_active() if calType is None: return @@ -229,7 +229,7 @@ def ok(self, widget): self.dateInput.set_value((y0, m0, d0)) self.dateInput.add_history() - def radioChanged(self, widget=None): + def radioChanged(self, _widget=None): if self.radio1.get_active(): self.ymdBox.set_sensitive(True) self.hbox2.set_sensitive(False) diff --git a/scal3/ui_gtk/stack.py b/scal3/ui_gtk/stack.py index 5710e1847..5d4e0e7c6 100644 --- a/scal3/ui_gtk/stack.py +++ b/scal3/ui_gtk/stack.py @@ -108,7 +108,7 @@ def setupWindowTitle( self._windowTitleMain = mainTitle self._windowTitleMainFirst = mainTitleFirst - def onKeyPress(self, arg, gevent): + def onKeyPress(self, _arg, gevent): if gdk.keyval_name(gevent.keyval) == "BackSpace": # noqa: SIM102 if self._currentPagePath: parentPath = self._parentPaths[self._currentPagePath] @@ -153,7 +153,7 @@ def _newHeaderBox(self, parentName: str, title: str = "", icon: str = ""): backButton.add(backHbox) backButton.connect( "clicked", - lambda w: self.gotoPage(parentName, backward=True), + lambda _w: self.gotoPage(parentName, backward=True), ) pack(hbox, backButton) pack(hbox, gtk.Label(), 1, 1) diff --git a/scal3/ui_gtk/starcal.py b/scal3/ui_gtk/starcal.py index 25cc54644..604b9fc6d 100755 --- a/scal3/ui_gtk/starcal.py +++ b/scal3/ui_gtk/starcal.py @@ -509,7 +509,7 @@ def _onToggleRightPanel(self): self.move(wx, wy) self.resize(ww, wh) - def onToggleRightPanel(self, widget): + def onToggleRightPanel(self, _widget): self.ignoreConfigureEvent = True ui.disableRedraw = True try: @@ -527,7 +527,7 @@ def createStatusBar(self): self.statusBar = StatusBar(self) return self.statusBar - def selectDateResponse(self, widget, y, m, d): + def selectDateResponse(self, _widget, y, m, d): ui.changeDate(y, m, d) self.onDateChange() @@ -550,13 +550,13 @@ def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): self.layout.onKeyPress(arg, gevent) return True # FIXME - def focusIn(self, widget=None, gevent=None, data=None): + def focusIn(self, _widget=None, _gevent=None, _data=None): log.debug("focusIn") self.focus = True if self.winCon and self.winCon.enable: self.winCon.windowFocusIn() - def focusOut(self, widegt, event, data=None): + def focusOut(self, _widegt, _event, _data=None): # called 0.0004 sec (max) after focusIn # (if switched between two windows) dt = now() - ui.focusTime @@ -578,7 +578,7 @@ def toggleMinimized(self, gevent): else: self.emit("delete-event", gdk.Event(gevent)) - def toggleMaximized(self, gevent): + def toggleMaximized(self, _gevent): if ui.winMaximized: self.unmaximize() else: @@ -587,7 +587,7 @@ def toggleMaximized(self, gevent): ui.winMaximized = not ui.winMaximized ui.saveLiveConf() - def toggleWidthMaximized(self, gevent): + def toggleWidthMaximized(self, _gevent): ww = ui.winWidth workAreaW = ud.workAreaW if ww < workAreaW: @@ -614,7 +614,7 @@ def screenSizeChanged(self, rect: "gdk.Rectangle"): if (winX, winY) != (ui.winX, ui.winY): self.move(winX, winY) - def onConfigureEvent(self, widget, gevent): + def onConfigureEvent(self, _widget, _gevent): if self.ignoreConfigureEvent: return wx, wy = self.get_position() @@ -637,7 +637,7 @@ def onWindowSizeChange(self): if self.rightPanel: self.rightPanel.onWindowSizeChange() - def onMainButtonPress(self, obj, gevent): + def onMainButtonPress(self, _obj, gevent): # only for mainVBox for now, not rightPanel # does not work for statusBar, don't know why # log.debug(f"MainWin: onMainButtonPress, {gevent.button=}") @@ -657,7 +657,7 @@ def onMainButtonPress(self, obj, gevent): ui.updateFocusTime() return False - def childButtonPress(self, widget, gevent): + def childButtonPress(self, _widget, gevent): b = gevent.button # log.debug(dir(gevent)) # foo, x, y, mask = gevent.get_window().get_pointer() @@ -674,7 +674,7 @@ def childButtonPress(self, widget, gevent): self.menuMain.popup( None, None, - lambda *args: (x, y, True), + lambda *_args: (x, y, True), None, 3, gevent.time, @@ -688,7 +688,7 @@ def begin_resize_drag(self, *args): ui.updateFocusTime() return gtk.Window.begin_resize_drag(self, *args) - def onResizeFromMenu(self, widget, gevent): + def onResizeFromMenu(self, _widget, gevent): if self.menuMain: self.menuMain.hide() self.begin_resize_drag( @@ -704,7 +704,7 @@ def changeDate(self, year, month, day): ui.changeDate(year, month, day) self.onDateChange() - def goToday(self, obj=None): + def goToday(self, _obj=None): return self.changeDate(*cal_types.getSysDate(calTypes.primary)) def onDateChange(self, *a, **kw): @@ -784,7 +784,7 @@ def getEventAddToMenuItem(self) -> "gtk.MenuItem | None": addToItem.set_submenu(menu2) return addToItem - def editEventFromMenu(self, item, groupId, eventId): + def editEventFromMenu(self, _item, groupId, eventId): from scal3.ui_gtk.event.editor import EventEditorDialog event = ui.getEvent(groupId, eventId) @@ -1000,7 +1000,7 @@ def menuCellPopup(self, widget, x, y): menu.popup( None, None, - lambda *args: (x, y, True), + lambda *_args: (x, y, True), None, 3, etime, @@ -1050,14 +1050,14 @@ def menuMainPopup( menu.popup( None, None, - lambda *args: (x, y, True), + lambda *_args: (x, y, True), None, 3, etime, ) ui.updateFocusTime() - def addToGroupFromMenu(self, menu, group, eventType): + def addToGroupFromMenu(self, _menu, group, eventType): from scal3.ui_gtk.event.editor import addNewEvent # log.debug("addToGroupFromMenu", group.title, eventType) @@ -1077,7 +1077,7 @@ def addToGroupFromMenu(self, menu, group, eventType): ui.eventUpdateQueue.put("+", event, self) self.onConfigChange() - def prefUpdateBgColor(self, cal): + def prefUpdateBgColor(self, _cal): if ui.prefWindow: ui.prefWindow.colorbBg.set_rgba(ui.bgColor) # else: # FIXME @@ -1102,17 +1102,17 @@ def copyDate(self, calType: int): setClipboard(ui.cell.format(ud.dateFormatBin, calType=calType)) def copyDateGetCallback(self, calType: int): - return lambda obj=None, event=None: setClipboard( + return lambda _obj=None, _event=None: setClipboard( ui.cell.format( ud.dateFormatBin, calType=calType, ), ) - def copyCurrentDate(self, obj=None, event=None): + def copyCurrentDate(self, _obj=None, _event=None): setClipboard(ui.todayCell.format(ud.dateFormatBin)) - def copyCurrentDateTime(self, obj=None, event=None): + def copyCurrentDateTime(self, _obj=None, _event=None): dateStr = ui.todayCell.format(ud.dateFormatBin) timeStr = ui.todayCell.format( ud.clockFormatBin, @@ -1262,7 +1262,7 @@ def getStatusIconPopupItems(self): ), ] - def statusIconPopup(self, sicon, button, etime): + def statusIconPopup(self, _sicon, button, etime): menu = Menu() if os.sep == "\\": from scal3.ui_gtk.windows import setupMenuHideOnLeave @@ -1413,14 +1413,14 @@ def statusIconUpdate(self, gdate=None, checkStatusIconMode=True): self.statusIconUpdateTooltip() return True - def onStatusIconPress(self, obj, gevent): + def onStatusIconPress(self, _obj, gevent): if gevent.button == 2: # middle button press self.copyDate(calTypes.primary) return True return None - def onStatusIconClick(self, obj=None): + def onStatusIconClick(self, _obj=None): if self.get_property("visible"): # ui.winX, ui.winY = self.get_position() # FIXME: ^ gives bad position sometimes @@ -1440,7 +1440,7 @@ def onStatusIconClick(self, obj=None): # in LXDE, the window was not focused without self.focusIn() # while worked in Xfce and GNOME. - def onDeleteEvent(self, widget=None, event=None): + def onDeleteEvent(self, _widget=None, _event=None): # ui.winX, ui.winY = self.get_position() # FIXME: ^ gives bad position sometimes # liveConfChanged() @@ -1465,7 +1465,7 @@ def onEscape(self): if self.sicon.is_embedded(): self.hide() - def quit(self, widget=None, event=None): + def quit(self, _widget=None, _event=None): try: ui.saveLiveConf() except Exception: @@ -1488,7 +1488,7 @@ def quit(self, widget=None, event=None): ###### return gtk.main_quit() - def adjustTime(self, widget=None, event=None): + def adjustTime(self, _widget=None, _event=None): from subprocess import Popen if not ud.adjustTimeCmd: @@ -1500,7 +1500,7 @@ def adjustTime(self, widget=None, event=None): return Popen(ud.adjustTimeCmd, env=ud.adjustTimeEnv) - def aboutShow(self, obj=None, data=None): + def aboutShow(self, _obj=None, _data=None): if not self.aboutDialog: from scal3.ui_gtk.about import AboutDialog @@ -1532,12 +1532,12 @@ def aboutShow(self, obj=None, data=None): self.aboutDialog = dialog openWindow(self.aboutDialog) - def aboutHide(self, widget, arg=None): + def aboutHide(self, _widget, _arg=None): # arg maybe an event, or response id self.aboutDialog.hide() return True - def prefShow(self, obj=None, data=None): + def prefShow(self, _obj=None, _data=None): if not ui.prefWindow: from scal3.ui_gtk.preferences import PreferencesWindow @@ -1554,7 +1554,7 @@ def eventManCreate(self): ui.eventManDialog = EventManagerDialog(transient_for=self) - def eventManShow(self, obj=None, data=None): + def eventManShow(self, _obj=None, _data=None): self.eventManCreate() openWindow(ui.eventManDialog) @@ -1564,29 +1564,29 @@ def eventSearchCreate(self): ui.eventSearchWin = EventSearchWindow() - def eventSearchShow(self, obj=None, data=None): + def eventSearchShow(self, _obj=None, _data=None): self.eventSearchCreate() openWindow(ui.eventSearchWin) - def addCustomEvent(self, obj=None): + def addCustomEvent(self, _obj=None): self.eventManCreate() ui.eventManDialog.addCustomEvent() - def dayCalWinShow(self, obj=None, data=None): + def dayCalWinShow(self, _obj=None, _data=None): if not ui.dayCalWin: from scal3.ui_gtk.day_cal_window import DayCalWindow ui.dayCalWin = DayCalWindow() ui.dayCalWin.present() - def timeLineShow(self, obj=None, data=None): + def timeLineShow(self, _obj=None, _data=None): if not ui.timeLineWin: from scal3.ui_gtk.timeline import TimeLineWindow ui.timeLineWin = TimeLineWindow() openWindow(ui.timeLineWin) - def timeLineShowSelectedDay(self, obj=None, data=None): + def timeLineShowSelectedDay(self, _obj=None, _data=None): if not ui.timeLineWin: from scal3.ui_gtk.timeline import TimeLineWindow @@ -1594,14 +1594,14 @@ def timeLineShowSelectedDay(self, obj=None, data=None): ui.timeLineWin.showDayInWeek(ui.cell.jd) openWindow(ui.timeLineWin) - def yearWheelShow(self, obj=None, data=None): + def yearWheelShow(self, _obj=None, _data=None): if not ui.yearWheelWin: from scal3.ui_gtk.year_wheel import YearWheelWindow ui.yearWheelWin = YearWheelWindow() openWindow(ui.yearWheelWin) - def selectDateShow(self, widget=None): + def selectDateShow(self, _widget=None): if not self.selectDateDialog: from scal3.ui_gtk.selectdate import SelectDateDialog @@ -1612,7 +1612,7 @@ def selectDateShow(self, widget=None): ) self.selectDateDialog.show() - def dayInfoShow(self, widget=None): + def dayInfoShow(self, _widget=None): if not self.dayInfoDialog: from scal3.ui_gtk.day_info import DayInfoDialog @@ -1626,13 +1626,13 @@ def customizeWindowCreate(self): self.customizeWindow = CustomizeWindow(self.layout, transient_for=self) - def switchWcalMcal(self, widget=None): + def switchWcalMcal(self, _widget=None): self.customizeWindowCreate() self.mainVBox.switchWcalMcal(self.customizeWindow) self.customizeWindow.updateMainPanelTreeEnableChecks() self.customizeWindow.save() - def customizeShow(self, obj=None, data=None): + def customizeShow(self, _obj=None, _data=None): self.customizeWindowCreate() openWindow(self.customizeWindow) @@ -1643,10 +1643,10 @@ def exportShow(self, year, month): self.exportDialog = ExportDialog(transient_for=self) self.exportDialog.showDialog(year, month) - def onExportClick(self, widget=None): + def onExportClick(self, _widget=None): self.exportShow(ui.cell.year, ui.cell.month) - def onExportClickStatusIcon(self, widget=None, event=None): + def onExportClickStatusIcon(self, _widget=None, _event=None): year, month, day = cal_types.getSysDate(calTypes.primary) self.exportShow(year, month) diff --git a/scal3/ui_gtk/timeline.py b/scal3/ui_gtk/timeline.py index 9dd882d18..54f583d17 100644 --- a/scal3/ui_gtk/timeline.py +++ b/scal3/ui_gtk/timeline.py @@ -98,7 +98,7 @@ def showDayInWeek(self, jd): self.timeWidth = timeWidth self.queue_draw() - def onCenterToNowClick(self, arg=None): + def onCenterToNowClick(self, _arg=None): self.centerToNow() self.queue_draw() @@ -266,15 +266,15 @@ def updateMovementButtons(self): def getButtons(self): return self.basicButtons + self.movementButtons - def onMoveLeftClick(self, button: gdk.EventButton): + def onMoveLeftClick(self, _button: gdk.EventButton): self.startAnimConstantAccel(-1, tl.movingHandForceButton) # FIXME: what if animation is disabled? - def onMoveRightClick(self, button: gdk.EventButton): + def onMoveRightClick(self, _button: gdk.EventButton): self.startAnimConstantAccel(1, tl.movingHandForceButton) # FIXME: what if animation is disabled? - def onMoveStopClick(self, button: gdk.EventButton): + def onMoveStopClick(self, _button: gdk.EventButton): self.stopMovingAnim() def arrowButtonReleased(self): @@ -283,13 +283,13 @@ def arrowButtonReleased(self): # if you want it to stop movement, set: self.movingV = 0 # just like self.stopMovingAnim - def onZoomMenuItemClick(self, item, timeWidth): + def onZoomMenuItemClick(self, _item, timeWidth): timeCenter = self.timeStart + self.timeWidth / 2 self.timeStart = timeCenter - timeWidth / 2 self.timeWidth = timeWidth self.queue_draw() - def zoomMenuOpen(self, button: gdk.EventButton): + def zoomMenuOpen(self, _button: gdk.EventButton): avgYearLen = dayLen * calTypes.primaryModule().avgYearLen etime = gtk.get_current_event_time() menu = Menu() @@ -319,7 +319,7 @@ def zoomMenuOpen(self, button: gdk.EventButton): etime, ) - def openPreferences(self, arg=None): + def openPreferences(self, _arg=None): from scal3.ui_gtk.timeline_prefs import TimeLinePreferencesWindow if self.prefWindow is None: @@ -505,7 +505,7 @@ def drawAll(self, cr): for button in self.getButtons(): button.draw(cr, width, height) - def onExposeEvent(self, widget=None, event=None): + def onExposeEvent(self, _widget=None, _event=None): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. @@ -541,7 +541,7 @@ def getLastScrollDir(self) -> "str | None": return "" return None - def onScroll(self, widget, gevent): + def onScroll(self, _widget, gevent): smallForce = False if gevent.is_scroll_stop_event(): # or gevent.is_stop == 1 smallForce = True @@ -568,7 +568,7 @@ def onScroll(self, widget, gevent): self.queue_draw() return True - def onButtonPress(self, obj, gevent): + def onButtonPress(self, _obj, gevent): if self.pressingButton is not None: self.pressingButton.onRelease() self.pressingButton = None @@ -679,7 +679,7 @@ def onButtonPress(self, obj, gevent): menu.popup(None, None, None, None, 3, gevent.time) return False - def motionNotify(self, obj, gevent): + def motionNotify(self, _obj, gevent): if self.boxEditing: editType, event, box, x0, t0 = self.boxEditing t1 = t0 + (gevent.x - x0) / self.pixelPerSec @@ -701,7 +701,7 @@ def motionNotify(self, obj, gevent): ) self.queue_draw() - def buttonRelease(self, obj, gevent): + def buttonRelease(self, _obj, _gevent): if self.boxEditing: editType, event, box, x0, t0 = self.boxEditing event.afterModify() @@ -717,7 +717,7 @@ def onConfigChange(self, *a, **kw): ud.BaseCalObj.onConfigChange(self, *a, **kw) self.queue_draw() - def onEditEventClick(self, menu, winTitle, event, gid): + def onEditEventClick(self, _menu, winTitle, event, _gid): from scal3.ui_gtk.event.editor import EventEditorDialog event = EventEditorDialog( @@ -730,7 +730,7 @@ def onEditEventClick(self, menu, winTitle, event, gid): ui.eventUpdateQueue.put("e", event, self) self.onConfigChange() - def onEditGroupClick(self, menu, winTitle, group): + def onEditGroupClick(self, _menu, _winTitle, group): from scal3.ui_gtk.event.group.editor import GroupEditorDialog group = GroupEditorDialog( @@ -744,7 +744,7 @@ def onEditGroupClick(self, menu, winTitle, group): self.onConfigChange() self.queue_draw() - def moveEventToTrash(self, menu, group, event): + def moveEventToTrash(self, _menu, group, event): from scal3.ui_gtk.event.utils import confirmEventTrash if not confirmEventTrash(event): @@ -769,7 +769,7 @@ def zoom(self, zoomIn, stepFact, posFact): def keyboardZoom(self, zoomIn): self.zoom(zoomIn, tl.keyboardZoomStep, 0.5) - def onKeyMoveToNow(self, gevent: gdk.EventKey): + def onKeyMoveToNow(self, _gevent: gdk.EventKey): self.centerToNow() def onKeyMoveRight(self, gevent: gdk.EventKey): @@ -786,19 +786,19 @@ def onKeyMoveLeft(self, gevent: gdk.EventKey): smallForce=(gevent.get_state() & gdk.ModifierType.SHIFT_MASK), ) - def onKeyMoveStop(self, gevent: gdk.EventKey): + def onKeyMoveStop(self, _gevent: gdk.EventKey): self.stopMovingAnim() - def onKeyClose(self, gevent: gdk.EventKey): + def onKeyClose(self, _gevent: gdk.EventKey): self.closeFunc() - def onKeyZoomIn(self, gevent: gdk.EventKey): + def onKeyZoomIn(self, _gevent: gdk.EventKey): self.keyboardZoom(True) - def onKeyZoomOut(self, gevent: gdk.EventKey): + def onKeyZoomOut(self, _gevent: gdk.EventKey): self.keyboardZoom(False) - def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _arg: gtk.Widget, gevent: gdk.EventKey): k = gdk.keyval_name(gevent.keyval).lower() # log.debug(f"{now():.3f}") action = tl.keys.get(k) @@ -991,14 +991,14 @@ def __init__(self): def showDayInWeek(self, jd): self.tline.showDayInWeek(jd) - def onCloseClick(self, arg=None, event=None): + def onCloseClick(self, _arg=None, _event=None): if ui.mainWin: self.hide() else: gtk.main_quit() # FIXME return True - def onButtonPress(self, obj, gevent): + def onButtonPress(self, _obj, gevent): if gevent.button == 1: self.begin_move_drag( gevent.button, diff --git a/scal3/ui_gtk/timeline_prefs.py b/scal3/ui_gtk/timeline_prefs.py index d2479e181..56e09b4f7 100644 --- a/scal3/ui_gtk/timeline_prefs.py +++ b/scal3/ui_gtk/timeline_prefs.py @@ -967,7 +967,7 @@ def enableAnimationChanged(): #### self.vbox.show_all() - def gotoPageClicked(self, button, page): + def gotoPageClicked(self, _button, page): self.stack.gotoPage(page.pagePath) def newWideButton(self, page: StackPage): @@ -985,16 +985,16 @@ def newWideButton(self, page: StackPage): button.connect("clicked", self.gotoPageClicked, page) return button - def onDelete(self, obj=None, data=None): + def onDelete(self, _obj=None, _data=None): self.hide() return True - def onSaveClick(self, obj=None): + def onSaveClick(self, _obj=None): self.hide() tl.saveConf() return True - def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _arg: gtk.Widget, gevent: gdk.EventKey): if gdk.keyval_name(gevent.keyval) == "Escape": self.hide() return True diff --git a/scal3/ui_gtk/utils.py b/scal3/ui_gtk/utils.py index 3e31a9ca0..bdf91e784 100644 --- a/scal3/ui_gtk/utils.py +++ b/scal3/ui_gtk/utils.py @@ -572,7 +572,7 @@ def get_pixbuf_hash(pbuf): md5 = hashlib.md5() - def save_func(chunkBytes, size, unknown): + def save_func(chunkBytes, _size, _unknown): # len(chunkBytes) == size md5.update(chunkBytes) return True @@ -639,7 +639,7 @@ def __init__(self, label): self.set_label(label) self.connect("activate", self.on_activate) - def on_activate(self, item): + def on_activate(self, _item): setClipboard(self.get_property("label")) diff --git a/scal3/ui_gtk/winContronller.py b/scal3/ui_gtk/winContronller.py index 8edf56bbd..316212c3b 100644 --- a/scal3/ui_gtk/winContronller.py +++ b/scal3/ui_gtk/winContronller.py @@ -65,17 +65,17 @@ def build(self): self.connect("button-release-event", self.onButtonRelease) set_tooltip(self, self.desc) ## FIXME - def enterNotify(self, widget, gevent): + def enterNotify(self, _widget, _gevent): self.setFocus(True) - def leaveNotify(self, widget, gevent): + def leaveNotify(self, _widget, _gevent): if self.controller.winFocused: self.setFocus(False) else: self.setInactive() return False - def onButtonPress(self, widget, gevent): + def onButtonPress(self, _widget, _gevent): self.setFocus(False) return True @@ -85,7 +85,7 @@ def onClick(self, gWin, gevent): def onRightClick(self, gWin, gevent): pass - def onButtonRelease(self, button, gevent): + def onButtonRelease(self, _button, gevent): if gevent.button == 1: self.onClick(self.controller.win, gevent) return True @@ -127,7 +127,7 @@ class WinConButtonClose(WinConButton): imageNameFocus = "close-focus" imageNameInactive = "close-inactive" - def onClick(self, gWin, gevent): + def onClick(self, gWin, _gevent): gWin.emit("delete-event", gdk.Event()) @@ -142,7 +142,7 @@ def __init__(self, controller): self.imageNameInactive = f"{direc}-inactive" WinConButton.__init__(self, controller) - def onClick(self, gWin, gevent): + def onClick(self, gWin, _gevent): gWin.emit("toggle-right-panel") @@ -206,13 +206,13 @@ def __init__(self, win): ##gWin.connect("focus-out-event", self.windowFocusOut) self.winFocused = True - def windowFocusIn(self, widget=None, event=None): + def windowFocusIn(self, _widget=None, _event=None): for b in self.items: b.setFocus(False) self.winFocused = True return False - def windowFocusOut(self, widget=None, event=None): + def windowFocusOut(self, _widget=None, _event=None): for b in self.items: b.setInactive() self.winFocused = False diff --git a/scal3/ui_gtk/windows.py b/scal3/ui_gtk/windows.py index ce984f6e1..2fc892e3d 100644 --- a/scal3/ui_gtk/windows.py +++ b/scal3/ui_gtk/windows.py @@ -4,7 +4,7 @@ def setupMenuHideOnLeave(menu): from time import time as now - def menuLeaveNotify(m, e): + def menuLeaveNotify(m, _e): t0 = now() if t0 - m.lastLeaveNotify < 0.001: timeout_add(500, m.hide) diff --git a/scal3/ui_gtk/wizard.py b/scal3/ui_gtk/wizard.py index 93a7bf336..813f1a18c 100644 --- a/scal3/ui_gtk/wizard.py +++ b/scal3/ui_gtk/wizard.py @@ -14,7 +14,7 @@ class WizardWindow(gtk.Window, MyDialog): def __init__(self, title): gtk.Window.__init__(self) self.set_title(title) - self.connect("delete-event", lambda obj, e: self.destroy()) + self.connect("delete-event", lambda _w, _e: self.destroy()) self.connect("key-press-event", self.onKeyPress) self.vbox = VBox() self.stack = MyStack( @@ -50,7 +50,7 @@ def __init__(self, title): self.show_all() # log.debug(id(self.get_action_area())) - def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _widget: gtk.Widget, gevent: gdk.EventKey): kname = gdk.keyval_name(gevent.keyval).lower() if kname == "escape": self.destroy() diff --git a/scal3/ui_gtk/wizard_demo.py b/scal3/ui_gtk/wizard_demo.py index dfdbab216..ea6f46ac7 100644 --- a/scal3/ui_gtk/wizard_demo.py +++ b/scal3/ui_gtk/wizard_demo.py @@ -66,10 +66,10 @@ def __init__(self, win): def run(self): pass - def onCancelClick(self, obj): + def onCancelClick(self, _obj): self.win.destroy() - def onNextClick(self, obj): + def onNextClick(self, _obj): fpath = self.fcb.get_filename() format_ = None if self.radioJson.get_active(): @@ -105,10 +105,10 @@ def _runAndCleanup(self, format_, fpath): def _runJson(self, fpath): print(f"_runAndCleanup: {fpath=}") # noqa: T201 - def onBackClick(self, obj): + def onBackClick(self, _obj): self.win.showStep(0) - def onCloseClick(self, obj): + def onCloseClick(self, _obj): self.win.destroy() stepClasses = [ diff --git a/scal3/ui_gtk/year_wheel.py b/scal3/ui_gtk/year_wheel.py index fa9167700..c4e1ffea9 100644 --- a/scal3/ui_gtk/year_wheel.py +++ b/scal3/ui_gtk/year_wheel.py @@ -128,7 +128,7 @@ def __init__(self, closeFunc): ), ] - def onHomeClick(self, arg=None): + def onHomeClick(self, _arg=None): self.angleOffset = 0.0 self.queue_draw() @@ -141,7 +141,7 @@ def startResize(self, gevent): gevent.time, ) - def onDraw(self, widget=None, event=None): + def onDraw(self, _widget=None, _event=None): win = self.get_window() region = win.get_visible_region() # FIXME: This must be freed with cairo_region_destroy() when you are done. @@ -382,14 +382,14 @@ def drawYearStartLine( show_layout(cr, layout) cr.rotate(-rotateAngle) - def onScroll(self, widget, gevent): + def onScroll(self, _widget, gevent): d = getScrollValue(gevent) # log.debug("onScroll", d) self.angleOffset += (-1 if d == "up" else 1) * self.scrollRotateDegree self.queue_draw() return True - def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): + def onKeyPress(self, _arg: gtk.Widget, gevent: gdk.EventKey): k = gdk.keyval_name(gevent.keyval).lower() # log.debug("%.3f"%now()) if k in ("space", "home"): @@ -412,7 +412,7 @@ def onKeyPress(self, arg: gtk.Widget, gevent: gdk.EventKey): self.queue_draw() return True - def onButtonPress(self, obj, gevent): + def onButtonPress(self, _obj, gevent): x = gevent.x y = gevent.y w = self.get_allocation().width @@ -461,7 +461,7 @@ def __init__(self): self._widget.show() self.appendItem(self._widget) - def onCloseClick(self, arg=None, event=None): + def onCloseClick(self, _arg=None, _event=None): if ui.mainWin: self.hide() else: @@ -470,7 +470,7 @@ def onCloseClick(self, arg=None, event=None): gtk.main_quit() return True - def onButtonPress(self, obj, gevent): + def onButtonPress(self, _obj, gevent): if gevent.button == 1: self.begin_move_drag( gevent.button, diff --git a/scal3/utils.py b/scal3/utils.py index e4241331e..6bf5e101d 100644 --- a/scal3/utils.py +++ b/scal3/utils.py @@ -68,6 +68,9 @@ def versionLessThan(v0: str, v1: str) -> bool: return version.parse(v0) < version.parse(v1) +# Note: to check if saved preferences are older than a version: +# versionLessThan(core.prefVersion, v) + class FallbackLogger: def __init__(self):