代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/anaconda 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 303b072992542dfa9a7e2b2a9dc99120564a3f07 Mon Sep 17 00:00:00 2001
From: sun_hai_10 <sunhai10@huawei.com>
Date: Mon, 7 Nov 2022 14:23:04 +0800
Subject: [PATCH] modify timezone and delete datezone map
---
pyanaconda/modules/timezone/installation.py | 4 +-
pyanaconda/modules/timezone/timezone.py | 2 +-
pyanaconda/ui/gui/spokes/datetime_spoke.glade | 14 -------
pyanaconda/ui/gui/spokes/datetime_spoke.py | 38 +++----------------
4 files changed, 8 insertions(+), 50 deletions(-)
diff --git a/pyanaconda/modules/timezone/installation.py b/pyanaconda/modules/timezone/installation.py
index 08e24c0..f11874f 100644
--- a/pyanaconda/modules/timezone/installation.py
+++ b/pyanaconda/modules/timezone/installation.py
@@ -63,8 +63,8 @@ class ConfigureTimezoneTask(Task):
if not is_valid_timezone(self._timezone):
# this should never happen, but for pity's sake
log.warning("Timezone %s set in kickstart is not valid, "
- "falling back to default (America/New_York).", self._timezone)
- self._timezone = "America/New_York"
+ "falling back to default (Asia/Shanghai).", self._timezone)
+ self._timezone = "Asia/Shanghai"
def _make_timezone_symlink(self):
"""Create the symlink that actually defines timezone."""
diff --git a/pyanaconda/modules/timezone/timezone.py b/pyanaconda/modules/timezone/timezone.py
index b5d5f7b..2a328a3 100644
--- a/pyanaconda/modules/timezone/timezone.py
+++ b/pyanaconda/modules/timezone/timezone.py
@@ -44,7 +44,7 @@ class TimezoneService(KickstartService):
def __init__(self):
super().__init__()
self.timezone_changed = Signal()
- self._timezone = "America/New_York"
+ self._timezone = "Asia/Shanghai"
self.is_utc_changed = Signal()
self._is_utc = False
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
index 188f93b..aa468d9 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
@@ -3,7 +3,6 @@
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="AnacondaWidgets" version="1.0"/>
- <requires lib="TimezoneMap" version="0.4"/>
<object class="GtkListStore" id="cities">
<columns>
<!-- column-name name -->
@@ -314,19 +313,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="CcTimezoneMap" id="tzmap">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <signal name="location-changed" handler="on_location_changed" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="padding">6</property>
- <property name="position">1</property>
- </packing>
- </child>
<child>
<object class="GtkAlignment" id="footerAlignment">
<property name="visible">True</property>
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index b21bbc3..c8416b4 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -50,15 +50,14 @@ from pyanaconda.threading import threadMgr, AnacondaThread
import gi
gi.require_version("Gdk", "3.0")
gi.require_version("Gtk", "3.0")
-gi.require_version("TimezoneMap", "1.0")
-from gi.repository import Gdk, Gtk, TimezoneMap
+from gi.repository import Gdk, Gtk
log = get_module_logger(__name__)
__all__ = ["DatetimeSpoke"]
-DEFAULT_TZ = "America/New_York"
+DEFAULT_TZ = "Asia/Shanghai"
SPLIT_NUMBER_SUFFIX_RE = re.compile(r'([^0-9]*)([-+])([0-9]+)')
@@ -168,11 +167,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
icon = "preferences-system-time-symbolic"
title = CN_("GUI|Spoke", "_Time & Date")
- # Hack to get libtimezonemap loaded for GtkBuilder
- # see https://bugzilla.gnome.org/show_bug.cgi?id=712184
- _hack = TimezoneMap.TimezoneMap()
- del(_hack)
-
@staticmethod
def get_screen_id():
"""Return a unique id of this UI screen."""
@@ -211,7 +205,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
self._yearsStore = self.builder.get_object("years")
self._regionsStore = self.builder.get_object("regions")
self._citiesStore = self.builder.get_object("cities")
- self._tzmap = self.builder.get_object("tzmap")
self._dateBox = self.builder.get_object("dateBox")
# we need to know it the new value is the same as previous or not
@@ -334,10 +327,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
else:
return _("Invalid timezone")
else:
- location = self._tzmap.get_location()
- if location and location.get_property("zone"):
- return _("%s timezone") % get_xlated_timezone(location.get_property("zone"))
- else:
return _("Nothing selected")
def apply(self):
@@ -389,7 +378,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
kickstart_timezone = self._timezone_module.Timezone
if is_valid_timezone(kickstart_timezone):
- self._tzmap.set_timezone(kickstart_timezone)
time.tzset()
self._update_datetime()
@@ -766,7 +754,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
if region == "Etc":
# Etc timezones cannot be displayed on the map, so let's reset the
# location and manually set a highlight with no location pin.
- self._tzmap.clear_location()
# Some time zones are just the same default.
if city in ("GMT", "UTC", "UCT", "Greenwich", "Universal", "Zulu"):
offset = 0.0
@@ -780,13 +767,14 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
else:
log.warning("Unknown time zone selected in GUI: Etc/%s", city)
- self._tzmap.set_selected_offset(offset)
time.tzset()
else:
# we don't want the timezone-changed signal to be emitted
- self._tzmap.set_timezone(timezone)
time.tzset()
+ self._tz = get_timezone(timezone)
+ self._update_datetime()
+
# update "old" values
self._old_city = city
@@ -836,22 +824,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
self._stop_and_maybe_start_time_updating(interval=5)
self._daysFilter.refilter()
- def on_location_changed(self, tz_map, location):
- if not location:
- return
-
- timezone = location.get_property('zone')
-
- # Updating the timezone will update the region/city combo boxes to match.
- # The on_city_changed handler will attempt to convert the timezone back
- # to a location and set it in the map, which we don't want, since we
- # already have a location. That's why we're here.
- with blockedHandler(self._cityCombo, self.on_city_changed):
- if self._set_timezone(timezone):
- # timezone successfully set
- self._tz = get_timezone(timezone)
- self._update_datetime()
-
def on_timeformat_changed(self, button24h, *args):
hours = int(self._hoursLabel.get_text())
amPm = self._amPmLabel.get_text()
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。