Skip to content

Commit

Permalink
style: reduce grid spacing, make forecast items smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
amit9838 committed Aug 5, 2024
1 parent 40ba2c2 commit 5ce7581
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

.btn_sm{
font-size:1rem;
font-size:.95rem;
padding:0.2rem .9rem;
}

Expand Down
2 changes: 1 addition & 1 deletion src/frontendCardAirPollution.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _get_nearest_time_index(self):
def create_card(self):
idx = self._get_nearest_time_index()

card = Gtk.Grid(margin_top=10, margin_start=5)
card = Gtk.Grid(margin_top=6, margin_start=3)
self.card = card
card.halign = Gtk.Align.FILL
card.set_row_spacing(5)
Expand Down
2 changes: 1 addition & 1 deletion src/frontendCardDayNight.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_sunset_sunrise_degree(self):
return sunrise, sunset, angle

def create_card(self):
card = Gtk.Grid(margin_top=10, margin_start=5, margin_bottom=0)
card = Gtk.Grid(margin_top=6, margin_start=3, margin_bottom=0)
self.card = card
card.halign = Gtk.Align.FILL
# card.set_row_spacing(5)
Expand Down
8 changes: 4 additions & 4 deletions src/frontendCardSquare.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def __init__(

def create_card(self):
card = Gtk.Grid(
margin_top=10,
margin_start=5,
margin_end=5,
row_spacing=5,
margin_top=6,
margin_start=3,
margin_end=3,
row_spacing=3,
column_spacing=0,
)
card.halign = Gtk.Align.FILL
Expand Down
10 changes: 5 additions & 5 deletions src/frontendForecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.set_margin_top(10)
self.set_margin_bottom(5)
self.set_margin_start(10)
self.set_margin_end(5)
self.set_margin_start(6)
self.set_margin_end(3)
self.set_css_classes(["view", "card", "custom_card"])
if settings.is_using_dynamic_bg:
self.add_css_class("transparent_5")
Expand Down Expand Up @@ -84,7 +84,7 @@ def page_stacks(self, page_name):
# Create scrolled window , add it to stack-box
scrolled_window = Gtk.ScrolledWindow(margin_top=4, margin_bottom=4)
scrolled_window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scrolled_window.set_size_request(260, 500)
scrolled_window.set_size_request(260, 480)
scrolled_window.set_kinetic_scrolling(True)
box.append(scrolled_window)

Expand Down Expand Up @@ -142,7 +142,7 @@ def page_stacks(self, page_name):

# Add dt_label Label
label_box = Gtk.Box()
label_box.set_size_request(80, 68)
label_box.set_size_request(80, 60)
label_day_time = Gtk.Label(label=dt_label, halign=Gtk.Align.START)
label_day_time.set_css_classes(["text-5", "bold-2", "light-2"])
label_box.append(label_day_time)
Expand All @@ -156,7 +156,7 @@ def page_stacks(self, page_name):
condition_icon = Gtk.Image().new_from_file(icons[str(weather_code)])
condition_icon.set_halign(Gtk.Align.CENTER)
condition_icon.set_hexpand(True)
condition_icon.set_pixel_size(50)
condition_icon.set_pixel_size(43)
forecast_item_grid.attach(condition_icon, 1, 0, 1, 1)

forecast_cond_grid = Gtk.Grid(valign=Gtk.Align.CENTER, margin_end=20)
Expand Down
16 changes: 8 additions & 8 deletions src/frontendHourlyDetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, *args, **kwargs):
self.add_css_class("transparent_5")

self.set_margin_top(10)
self.set_margin_start(5)
self.set_margin_start(3)
self.paint_ui()
self.daily_forecast = None

Expand All @@ -43,7 +43,7 @@ def paint_ui(self):
style_buttons_box = Gtk.Box(
orientation=Gtk.Orientation.HORIZONTAL,
halign=Gtk.Align.START,
margin_start=2,
margin_start=0,
)
style_buttons_box.add_css_class("linked")
style_buttons_box.set_valign(Gtk.Align.CENTER)
Expand Down Expand Up @@ -91,7 +91,7 @@ def create_stack_page(self, page_name):
self.hourly_stack.set_visible_child_name(page_name)

info_grid = Gtk.Grid(
margin_start=10, margin_top=15, margin_bottom=5, column_spacing=5
margin_start=10, margin_top=22, margin_bottom=5, column_spacing=5
)
info_grid.set_css_classes(["card_infos"])
page_grid.attach(info_grid, 0, 1, 1, 1)
Expand Down Expand Up @@ -175,8 +175,8 @@ def create_stack_page(self, page_name):
)
no_prec_label.set_css_classes(["text-3a", "bold-3", "light-2"])
no_prec_label.set_halign(Gtk.Align.CENTER)
no_prec_label.set_margin_top(20)
no_prec_label.set_margin_bottom(20)
no_prec_label.set_margin_top(40)
no_prec_label.set_margin_bottom(40)
graphic_box.set_css_classes(["custom_card_hourly", "bg_light_grey"])
graphic_box.append(no_prec_label)
graphic_container.append(graphic_box)
Expand Down Expand Up @@ -223,8 +223,8 @@ def create_stack_page(self, page_name):
img = DrawImage(
icon_loc,
hourly_data.wind_direction_10m.get("data")[i] + 180,
30,
30,
26,
26,
)

icon_box.set_margin_top(10)
Expand All @@ -243,7 +243,7 @@ def create_stack_page(self, page_name):

icon_main = Gtk.Image().new_from_file(condition_icon)
icon_main.set_hexpand(True)
icon_main.set_pixel_size(50)
icon_main.set_pixel_size(46)
icon_box.set_margin_bottom(10)
icon_box.append(icon_main)

Expand Down
2 changes: 1 addition & 1 deletion src/frontendUiDrawbarLine.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class DrawBar:
def __init__(self,value, rgb_color=[0.38, 0.7, 1]):

self.ht = 45
self.ht = 40
self.dw = Gtk.DrawingArea()
self.dw.set_size_request(50, self.ht+20)
self.dw.set_draw_func(self.draw, None)
Expand Down
6 changes: 3 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import os
import sys
import gi

gi.require_version('Adw', '1')
gi.require_version('Gtk', '4.0')

from gi.repository import Gtk, Gio, Adw, Gdk
from .mousam import WeatherMainWindow
from .config import settings


class WeatherApplication(Adw.Application):
"""The main application singleton class."""

Expand All @@ -37,8 +37,8 @@ def __init__(self):
self.create_action('quit', lambda *_: self.quit(), ['<primary>q'])
self.main_window = None

self.set_accels_for_action(f"win.preferences", ['<primary>comma'])
self.set_accels_for_action(f"win.shortcuts", ['<primary>question'])
self.set_accels_for_action("win.preferences", ['<primary>comma'])
self.set_accels_for_action("win.shortcuts", ['<primary>question'])


def do_activate(self):
Expand Down
2 changes: 1 addition & 1 deletion src/mousam.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def show_loader(self):
return

container_loader = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
container_loader.set_margin_top(220)
container_loader.set_margin_top(200)
container_loader.set_margin_bottom(200)

# Create loader
Expand Down

0 comments on commit 5ce7581

Please sign in to comment.