def changeStylesheet(*args):
     mw.setStyleSheet('''
         QMainWindow::separator
     {
         width: 0px;
         height: 0px;
     }
     ''')
def nmc():
    """Checks whether Night_Mode is disabled:
        if so, we remove the separator here."""
    global nm
    if not failed:
        nm = Night_Mode.nm_state_on
    if not nm:
        mw.setStyleSheet('''
        QMainWindow::separator
    {
        width: 0px;
        height: 0px;
    }
    ''')
Exemple #3
0
def nmApplyStyle() -> None:
    """Checks whether Night_Mode is disabled:
        if so, we remove the separator here."""
    global nmStyleApplied
    if not nmUnavailable:
        nmStyleApplied = Night_Mode.nm_state_on
    if not nmStyleApplied:
        mw.setStyleSheet('''
        QMainWindow::separator
    {
        width: 0px;
        height: 0px;
    }
    ''')
Exemple #4
0
def nm_append_to_styles(bottom='', body='', top='', decks='',
                        other_bottoms='', overview='', menu='',
                        waiting_screen=''):
    """
    This function changes CSS style of most objects. In basic use,
    it only reloads original styles and refreshes interface.

    All arguments are expected to be strings with CSS styles.
    """
    # Invert images and latex if needed
    if nm_invert_image:
        body += nm_css_iimage
    if nm_invert_latex:
        body += nm_css_ilatex

    # Apply styles to Python objects or by Qt functions.

    mw.setStyleSheet(nm_default_css_menu + menu)
    mw.toolbar._css = nm_default_css_top + top
    mw.reviewer._bottomCSS = nm_default_css_bottom + bottom

    if not appVersion.startswith('2.1'):
        mw.reviewer._css = nm_default_css_body + body
    else:
        mw.reviewer._revHtml = nm_default_reviewer_html + '<style>' + body + '</style>'

    mw.deckBrowser._css = nm_default_css_decks + decks
    mw.deckBrowser.bottom._css = nm_default_css_decks_bottom + other_bottoms
    mw.overview._css = nm_default_css_overview + overview
    mw.overview.bottom._css = nm_default_css_overview_bottom + other_bottoms
    mw.sharedCSS = nm_default_css_waiting_screen + waiting_screen

    # Reload current screen.
    if mw.state == "review":
        mw.reviewer._initWeb()
    if mw.state == "deckBrowser":
        mw.deckBrowser.refresh()
    if mw.state == "overview":
        mw.overview.refresh()

    # Redraw toolbar (should be always visible).
    mw.toolbar.draw()
def nm_append_to_styles(bottom='', body='', top='', decks='',
						other_bottoms='', overview='', menu='',
						waiting_screen=''):
	"""
	This function changes CSS style of most objects. In basic use,
	it only reloads original styles and refreshes interface.

	All arguments are expected to be strings with CSS styles.
	"""
	# Invert images and latex if needed
	if nm_invert_image:
		body += nm_css_iimage
	if nm_invert_latex:
		body += nm_css_ilatex

	# Apply styles to Python objects or by Qt functions.

	mw.setStyleSheet(nm_default_css_menu + menu)
	mw.toolbar._css = nm_default_css_top + top
	mw.reviewer._bottomCSS = nm_default_css_bottom + bottom
	mw.reviewer._css = nm_default_css_body + body
	mw.deckBrowser._css = nm_default_css_decks + decks
	mw.deckBrowser.bottom._css = nm_default_css_decks_bottom + other_bottoms
	mw.overview._css = nm_default_css_overview + overview
	mw.overview.bottom._css = nm_default_css_overview_bottom + other_bottoms
	mw.sharedCSS = nm_default_css_waiting_screen + waiting_screen
	
	# Reload current screen.
	if mw.state == "review":
		mw.reviewer._initWeb()
	if mw.state == "deckBrowser":
		mw.deckBrowser.refresh()
	if mw.state == "overview":
		mw.overview.refresh()

	# Redraw toolbar (should be always visible).
	mw.toolbar.draw()
 def restoreStylesheet(*args):
     mw.setStyleSheet("")
Exemple #7
0
    'maxLife': 120,
    'recover': 5,
    'barPosition': POSITION_OPTIONS.index('Bottom'),
    'barHeight': 15,
    'barBgColor': '#f3f3f2',
    'barFgColor': '#489ef6',
    'barBorderRadius': 0,
    'barText': 0,
    'barTextColor': '#000',
    'barStyle': STYLE_OPTIONS.index('Default'),
    'stopOnAnswer': False,
    'disable': False
}

# Hide separator strip
mw.setStyleSheet('QMainWindow::separator { width: 0px; height: 0px; }')


# Saving data inside a class to access it as lifeDrain.config
class LifeDrain(object):  # pylint: disable=too-few-public-methods
    '''
    Contains the state of the life drain.
    '''
    config = {}
    deckBarManager = None
    timer = None
    status = {'reviewed': False, 'newCardState': False, 'screen': None}
    stopOnAnswer = False
    disable = None