Skip to content

Commit

Permalink
Merge pull request #10 from Tommy-Sandanasamy/Enchancement-_Hide_desc…
Browse files Browse the repository at this point in the history
…ription_field_if_empty

Enchancement: Hide description field in card if no description exists implemented
  • Loading branch information
Lyaaaaaaaaaaaaaaa authored Jul 9, 2022
2 parents 2cc512f + c6f5c8c commit 75772db
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@
#--
#-- 19/01/2021 Lyaaaaa
#-- - Updated some functions headers and removed outdated comments.
#--
#-- 27/06/2022 Tommy Sandanasamy
#-- -Updated On_Edit_Card_Dialog_Save_Clicked both Add and Edit Card section
#-- with a conditional to hide the textbox when there is no description and
#-- show a textbox if a description is added
#-- -Updated On_Kanban_Combo_Box_Changed so that cards without a description
#-- will not display a textbox after being loaded
#-- -set_no_show_all is also used in all cases to prevent new cards with no
#-- description from showing old the description of cards with no description
#---------------------------------------------------------------------------

from gi.repository import Gtk, Gdk, GdkPixbuf
Expand Down Expand Up @@ -577,9 +586,15 @@ def On_Edit_Card_Dialog_Save_Clicked(self, *args):
Card_List_Box = Viewport.get_child()
Column_Title = Column_Box.get_name()

Card_List_Box.add(self.Graphical_Kanban.Add_Card(title, description))
Card_Box = self.Graphical_Kanban.Add_Card(title, description)

Card_List_Box.add(Card_Box)
Card_List_Box.show_all()

if(description == ''):
Card_Box.get_children()[1].hide()
Card_Box.get_children()[1].set_no_show_all(True)

List_Box_Last_Row = Card_List_Box.get_children()[-1]
Card_Box = List_Box_Last_Row.get_child()

Expand All @@ -594,7 +609,11 @@ def On_Edit_Card_Dialog_Save_Clicked(self, *args):
Card_View_Text = Card_Box.get_children()[1]
Card_Buffer = Card_View_Text.get_buffer()
Old_Card_Title = Card_Box.get_name()

if(description == ''):
Card_Box.get_children()[1].hide()
Card_Box.get_children()[1].set_no_show_all(True)
elif (description != '' and not Card_View_Text.get_visible()):
Card_Box.get_children()[1].show()
Card_Label.set_markup("<b>" + title + "</b>")
Card_Buffer.set_text(description)
Card_Box.set_name(title)
Expand Down Expand Up @@ -937,6 +956,14 @@ def On_Kanban_Combo_Box_Changed(self, *args):
Card_Header = Card_Box.get_children()[0]
Edit_Button = Card_Header.get_children()[1]

Card_Text_View = Card_Box.get_children()[1]
Buffer = Card_Text_View.get_buffer()
start = Buffer.get_start_iter()
end = Buffer.get_end_iter()
description = Buffer.get_text(start, end, False)
if(description == ''):
Card_Box.get_children()[1].hide()
Card_Box.get_children()[1].set_no_show_all(True)
self.Connect_Card_Buttons(Card_Box)

self.Set_Drag_Destination(List_Box)
Expand Down
1 change: 1 addition & 0 deletions src/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#-- - Updated Start_Interface header.
#-- - Deleted Quit_Application and Get_Builder methods as they are never
#-- used anywhere in the project.
#--
#---------------------------------------------------------------------------

import gi
Expand Down

0 comments on commit 75772db

Please sign in to comment.