utils

package
v0.7.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginPageTitleColor = tcell.ColorOrange

	LoginFormBorderColor = tcell.ColorGrey
	LoginFormLabelColor  = tcell.ColorWhite
)
View Source
const (
	MainPageGridTitleColor   = tcell.ColorOrange
	MainPageGridBorderColor  = tcell.ColorLightGrey
	MainPageTableTitleColor  = tcell.ColorLightSkyBlue
	MainPageTableBorderColor = tcell.ColorGrey

	LoggedMainPageTitleColor     = tcell.ColorLightGoldenrodYellow
	LoggedMainPagePubStatusColor = tcell.ColorSandyBrown

	GuestMainPageTitleColor = tcell.ColorOrange
	GuestMainPageDescColor  = tcell.ColorLightGrey
	GuestMainPageTagColor   = tcell.ColorLightSteelBlue
)
View Source
const (
	MangaPageGridTitleColor   = tcell.ColorOrange
	MangaPageGridBorderColor  = tcell.ColorLightGrey
	MangaPageTableTitleColor  = tcell.ColorLightSkyBlue
	MangaPageTableBorderColor = tcell.ColorGrey

	MangaPageInfoViewTitleColor  = tcell.ColorLightSkyBlue
	MangaPageInfoViewBorderColor = tcell.ColorLightGrey

	MangaPageChapNumColor      = tcell.ColorLightYellow
	MangaPageTitleColor        = tcell.ColorLightSkyBlue
	MangaPageDownloadStatColor = tcell.ColorPowderBlue
	MangaPageReadStatColor     = tcell.ColorOrange
	MangaPageScanGroupColor    = tcell.ColorDarkSalmon
	MangaPageHighlightColor    = tcell.ColorMediumSpringGreen
)
View Source
const (
	SearchPageGridTitleColor   = tcell.ColorOrange
	SearchPageGridBorderColor  = tcell.ColorLightGrey
	SearchPageTableTitleColor  = tcell.ColorLightSkyBlue
	SearchPageTableBorderColor = tcell.ColorGrey

	SearchFormLabelColor = tcell.ColorWhite
)
View Source
const (
	LoginPageID  = "login_page" // Page IDs
	MainPageID   = "main_page"
	MangaPageID  = "manga_page"
	HelpPageID   = "help_page"
	SearchPageID = "search_page"

	LoginLogoutCfmModalID        = "logout_modal" // Modal IDs
	StoreCredentialErrorModalID  = "store_cred_error_modal"
	DownloadChaptersModalID      = "download_chapters_modal"
	DownloadFinishedModalID      = "download_error_modal"
	ToggleReadChapterModalID     = "toggle_read_chapters_modal"
	ToggleFollowMangaModalID     = "toggle_follow_manga_modal"
	ToggleFollowMangaDoneModalID = "toggle_follow_manga_done_modal"
	GenericAPIErrorModalID       = "api_error_modal"
	NotLoggedInErrorModalID      = "not_logged_in_error_modal"
	OffsetErrorModalID           = "offset_error_modal"
)
View Source
const (
	HelpPageBorderColor = tcell.ColorLightGrey
)
View Source
const (
	ModalColor = tcell.ColorDarkSlateGrey
)

Variables

This section is empty.

Functions

func NewGrid

func NewGrid(row, col []int) *tview.Grid

NewGrid : Create a new grid with specified rows and columns.

Types

type ContextWrapper

type ContextWrapper struct {
	Ctx    context.Context
	Cancel context.CancelFunc
}

ContextWrapper : A wrapper around a context and its corresponding Cancel function.

func (*ContextWrapper) ResetContext

func (c *ContextWrapper) ResetContext() (context.Context, context.CancelFunc)

ResetContext : Sets the new context, and return the old context, which the caller can use to cancel the previous context.

func (*ContextWrapper) ToCancel

func (c *ContextWrapper) ToCancel(ctx context.Context) bool

ToCancel : Helper function to check if the previous context should be cancelled. Note that this does not check the current context stored in the wrapper.

type SelectorWrapper

type SelectorWrapper struct {
	Selection map[int]struct{} // Keep track of which chapters have been selected by user.
	All       bool             // Keep track of whether user has selected All or not.
}

SelectorWrapper : A wrapper to store selections. Used by the manga page to keep track of selections.

func (*SelectorWrapper) AddSelection

func (s *SelectorWrapper) AddSelection(row int)

AddSelection : Add a row to the Selection.

func (*SelectorWrapper) CopySelection

func (s *SelectorWrapper) CopySelection(row int) map[int]struct{}

CopySelection : Returns a copy of the current Selection.

func (*SelectorWrapper) HasSelection

func (s *SelectorWrapper) HasSelection(row int) bool

HasSelection : Checks whether the current row is selected.

func (*SelectorWrapper) HasSelections

func (s *SelectorWrapper) HasSelections() bool

HasSelections : Checks whether there are currently selections.

func (*SelectorWrapper) RemoveSelection

func (s *SelectorWrapper) RemoveSelection(row int)

RemoveSelection : Remove a row from the Selection. No-op if row is not originally in Selection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL