diff --git a/cubicweb_squareui/__pkginfo__.py b/cubicweb_squareui/__pkginfo__.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_Y3ViaWN3ZWJfc3F1YXJldWkvX19wa2dpbmZvX18ucHk=..e0683079922cc89689495fabc8c74cb2935db7ee_Y3ViaWN3ZWJfc3F1YXJldWkvX19wa2dpbmZvX18ucHk= 100644 --- a/cubicweb_squareui/__pkginfo__.py +++ b/cubicweb_squareui/__pkginfo__.py @@ -1,7 +1,7 @@ # pylint: disable=W0622 """cubicweb-squareui application packaging information""" -modname = 'squareui' -distname = 'cubicweb-squareui' +modname = "squareui" +distname = "cubicweb-squareui" numversion = (1, 6, 0) @@ -6,4 +6,4 @@ numversion = (1, 6, 0) -version = '.'.join(str(num) for num in numversion) +version = ".".join(str(num) for num in numversion) @@ -9,8 +9,8 @@ -license = 'LGPL' -author = 'LOGILAB S.A. (Paris, FRANCE)' -author_email = 'contact@logilab.fr' -description = 'data-centric user interface for cubicweb based on bootstrap' -web = 'https://forge.extranet.logilab.fr/cubicweb/cubes/%s' % distname +license = "LGPL" +author = "LOGILAB S.A. (Paris, FRANCE)" +author_email = "contact@logilab.fr" +description = "data-centric user interface for cubicweb based on bootstrap" +web = "https://forge.extranet.logilab.fr/cubicweb/cubes/%s" % distname __depends__ = { @@ -15,9 +15,9 @@ __depends__ = { - 'cubicweb': ">= 3.38.0, < 3.39.0", - 'cubicweb-bootstrap': '>= 1.3.1', + "cubicweb": ">= 3.38.0, < 3.39.0", + "cubicweb-bootstrap": ">= 1.3.1", } __recommends__ = {} classifiers = [ @@ -19,10 +19,10 @@ } __recommends__ = {} classifiers = [ - 'Environment :: Web Environment', - 'Framework :: CubicWeb', - 'Programming Language :: Python', - 'Programming Language :: JavaScript', + "Environment :: Web Environment", + "Framework :: CubicWeb", + "Programming Language :: Python", + "Programming Language :: JavaScript", ] diff --git a/cubicweb_squareui/uiprops.py b/cubicweb_squareui/uiprops.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_Y3ViaWN3ZWJfc3F1YXJldWkvdWlwcm9wcy5weQ==..e0683079922cc89689495fabc8c74cb2935db7ee_Y3ViaWN3ZWJfc3F1YXJldWkvdWlwcm9wcy5weQ== 100644 --- a/cubicweb_squareui/uiprops.py +++ b/cubicweb_squareui/uiprops.py @@ -1,1 +1,1 @@ -JAVASCRIPTS.append(data('cubes.squareui.js')) # noqa: F821 +JAVASCRIPTS.append(data("cubes.squareui.js")) # noqa: F821 diff --git a/cubicweb_squareui/views/__init__.py b/cubicweb_squareui/views/__init__.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_Y3ViaWN3ZWJfc3F1YXJldWkvdmlld3MvX19pbml0X18ucHk=..e0683079922cc89689495fabc8c74cb2935db7ee_Y3ViaWN3ZWJfc3F1YXJldWkvdmlld3MvX19pbml0X18ucHk= 100644 --- a/cubicweb_squareui/views/__init__.py +++ b/cubicweb_squareui/views/__init__.py @@ -21,8 +21,8 @@ class SimpleBoxContextFreeBoxLayout(ContextualBoxLayout): __select__ = ~contextual() - cssclass = 'contextFreeBox' - __regid__ = 'simple-layout' + cssclass = "contextFreeBox" + __regid__ = "simple-layout" def render(self, w): if self.init_rendering(): @@ -26,5 +26,5 @@ def render(self, w): if self.init_rendering(): - view = self.cw_extra_kwargs['view'] + view = self.cw_extra_kwargs["view"] view.render_body(w) diff --git a/cubicweb_squareui/views/basetemplates.py b/cubicweb_squareui/views/basetemplates.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_Y3ViaWN3ZWJfc3F1YXJldWkvdmlld3MvYmFzZXRlbXBsYXRlcy5weQ==..e0683079922cc89689495fabc8c74cb2935db7ee_Y3ViaWN3ZWJfc3F1YXJldWkvdmlld3MvYmFzZXRlbXBsYXRlcy5weQ== 100644 --- a/cubicweb_squareui/views/basetemplates.py +++ b/cubicweb_squareui/views/basetemplates.py @@ -18,8 +18,8 @@ from cubicweb_web.views.boxes import SearchBox -HTML5 = u'<!DOCTYPE html>' +HTML5 = "<!DOCTYPE html>" basetemplates.TheMainTemplate.doctype = HTML5 # options which can be changed freely @@ -22,9 +22,9 @@ basetemplates.TheMainTemplate.doctype = HTML5 # options which can be changed freely -basetemplates.TheMainTemplate.twbs_container_cls = 'container-fluid' -basetemplates.TheMainTemplate.twbs_col_cls = 'col-xs-' +basetemplates.TheMainTemplate.twbs_container_cls = "container-fluid" +basetemplates.TheMainTemplate.twbs_col_cls = "col-xs-" basetemplates.TheMainTemplate.twbs_col_size = 2 # options which require recompiling bootstrap.css from source @@ -39,10 +39,12 @@ @monkeypatch(basetemplates.TheMainTemplate) -def template_header(self, content_type, view=None, page_title='', additional_headers=()): +def template_header( + self, content_type, view=None, page_title="", additional_headers=() +): page_title = page_title or view.page_title() additional_headers = additional_headers or view.html_headers() self.template_html_header(content_type, page_title, additional_headers) @monkeypatch(basetemplates.TheMainTemplate) @@ -43,10 +45,9 @@ page_title = page_title or view.page_title() additional_headers = additional_headers or view.html_headers() self.template_html_header(content_type, page_title, additional_headers) @monkeypatch(basetemplates.TheMainTemplate) -def template_html_header(self, content_type, page_title, - additional_headers=()): +def template_html_header(self, content_type, page_title, additional_headers=()): w = self.whead self.write_doctype() @@ -51,11 +52,15 @@ w = self.whead self.write_doctype() - self._cw.html_headers.define_var('BASE_URL', self._cw.base_url()) - self._cw.html_headers.define_var('DATA_URL', self._cw.datadir_url) - w(u'<meta http-equiv="content-type" content="%s; charset=%s"/>\n' - % (content_type, self._cw.encoding)) - w(u'<meta name="viewport" content="initial-scale=1.0, ' - u'maximum-scale=1.0, width=device-width"/>') - w(u'\n'.join(additional_headers) + u'\n') - self.wview('htmlheader', rset=self.cw_rset) + self._cw.html_headers.define_var("BASE_URL", self._cw.base_url()) + self._cw.html_headers.define_var("DATA_URL", self._cw.datadir_url) + w( + '<meta http-equiv="content-type" content="%s; charset=%s"/>\n' + % (content_type, self._cw.encoding) + ) + w( + '<meta name="viewport" content="initial-scale=1.0, ' + 'maximum-scale=1.0, width=device-width"/>' + ) + w("\n".join(additional_headers) + "\n") + self.wview("htmlheader", rset=self.cw_rset) if page_title: @@ -61,7 +66,7 @@ if page_title: - w(u'<title>%s</title>\n' % xml_escape(page_title)) + w("<title>%s</title>\n" % xml_escape(page_title)) @monkeypatch(basetemplates.TheMainTemplate) def template_page_content(self, view): w = self.w @@ -63,17 +68,23 @@ @monkeypatch(basetemplates.TheMainTemplate) def template_page_content(self, view): w = self.w - self.w(u'<body>\n') - self.wview('header', rset=self.cw_rset, view=view) - w(u'<div id="page" class="%s">\n' % self.twbs_container_cls) - w(u'<div class="row">\n') - left_boxes = list(self._cw.vreg['ctxcomponents'].poss_visible_objects( - self._cw, rset=self.cw_rset, view=view, context='left')) - right_boxes = list(self._cw.vreg['ctxcomponents'].poss_visible_objects( - self._cw, rset=self.cw_rset, view=view, context='right')) + self.w("<body>\n") + self.wview("header", rset=self.cw_rset, view=view) + w('<div id="page" class="%s">\n' % self.twbs_container_cls) + w('<div class="row">\n') + left_boxes = list( + self._cw.vreg["ctxcomponents"].poss_visible_objects( + self._cw, rset=self.cw_rset, view=view, context="left" + ) + ) + right_boxes = list( + self._cw.vreg["ctxcomponents"].poss_visible_objects( + self._cw, rset=self.cw_rset, view=view, context="right" + ) + ) nb_boxes = int(bool(left_boxes)) + int(bool(right_boxes)) content_cols = self.twbs_grid_columns if nb_boxes: content_cols = self.twbs_grid_columns - self.twbs_col_size * nb_boxes @@ -76,6 +87,6 @@ nb_boxes = int(bool(left_boxes)) + int(bool(right_boxes)) content_cols = self.twbs_grid_columns if nb_boxes: content_cols = self.twbs_grid_columns - self.twbs_col_size * nb_boxes - self.nav_column(view, left_boxes, 'left') + self.nav_column(view, left_boxes, "left") self.content_column(view, content_cols) @@ -81,5 +92,5 @@ self.content_column(view, content_cols) - self.nav_column(view, right_boxes, 'right') - self.w(u'</div>\n') # closes class=row - self.w(u'</div>\n') # closes id="page" from template_page_content + self.nav_column(view, right_boxes, "right") + self.w("</div>\n") # closes class=row + self.w("</div>\n") # closes id="page" from template_page_content self.template_footer(view) @@ -85,6 +96,6 @@ self.template_footer(view) - self.w(u'</body>\n') + self.w("</body>\n") @monkeypatch(basetemplates.TheMainTemplate) # noqa: F811 def get_components(self, view, context): @@ -87,14 +98,13 @@ @monkeypatch(basetemplates.TheMainTemplate) # noqa: F811 def get_components(self, view, context): - ctxcomponents = self._cw.vreg['ctxcomponents'] - return ctxcomponents.poss_visible_objects(self._cw, - rset=self.cw_rset, - view=view, - context=context) + ctxcomponents = self._cw.vreg["ctxcomponents"] + return ctxcomponents.poss_visible_objects( + self._cw, rset=self.cw_rset, view=view, context=context + ) @monkeypatch(basetemplates.TheMainTemplate) def state_header(self): state = self._cw.search_state @@ -96,8 +106,8 @@ @monkeypatch(basetemplates.TheMainTemplate) def state_header(self): state = self._cw.search_state - if state[0] == 'normal': + if state[0] == "normal": return _ = self._cw._ @@ -102,4 +112,4 @@ return _ = self._cw._ - value = self._cw.view('oneline', self._cw.eid_rset(state[1][1])) + value = self._cw.view("oneline", self._cw.eid_rset(state[1][1])) target, eid, r_type, searched_type = self._cw.search_state[1] @@ -105,18 +115,21 @@ target, eid, r_type, searched_type = self._cw.search_state[1] - cancel_link = u'''<a href="%(url)s" role="button" - class="btn btn-default" title="%(title)s">%(title)s</a>''' % { - 'url': self._cw.build_url(str(eid), - vid='edition', __mode='normal'), - 'title': _('cancel')} - msg = ' '.join((_("searching for"), - '<strong>"%s"</strong>' % - display_name(self._cw, state[1][3]), - _("to associate with"), value, - _("by relation"), - '<strong>"%s"</strong>' % - display_name(self._cw, state[1][2], state[1][0]), - cancel_link)) - return self.w(u'<div class="alert alert-info">%s</div>' % msg) + cancel_link = """<a href="%(url)s" role="button" + class="btn btn-default" title="%(title)s">%(title)s</a>""" % { + "url": self._cw.build_url(str(eid), vid="edition", __mode="normal"), + "title": _("cancel"), + } + msg = " ".join( + ( + _("searching for"), + '<strong>"%s"</strong>' % display_name(self._cw, state[1][3]), + _("to associate with"), + value, + _("by relation"), + '<strong>"%s"</strong>' % display_name(self._cw, state[1][2], state[1][0]), + cancel_link, + ) + ) + return self.w('<div class="alert alert-info">%s</div>' % msg) @monkeypatch(basetemplates.TheMainTemplate) @@ -128,6 +141,8 @@ html = stream.getvalue() if html: # only display aside columns if html availble - self.w(u'<aside id="aside-main-%s" class="%s%s cwjs-aside">\n' % - (context, self.twbs_col_cls, self.twbs_col_size)) + self.w( + '<aside id="aside-main-%s" class="%s%s cwjs-aside">\n' + % (context, self.twbs_col_cls, self.twbs_col_size) + ) self.w(html) @@ -133,8 +148,8 @@ self.w(html) - self.w(u'</aside>\n') + self.w("</aside>\n") return len(boxes) @monkeypatch(basetemplates.TheMainTemplate) def content_column(self, view, content_cols): w = self.w @@ -135,10 +150,12 @@ return len(boxes) @monkeypatch(basetemplates.TheMainTemplate) def content_column(self, view, content_cols): w = self.w - w(u'<div id="main-center" class="%(prefix)s%(col)s" role="main">' % { - 'prefix': self.twbs_col_cls, 'col': content_cols}) - components = self._cw.vreg['components'] + w( + '<div id="main-center" class="%(prefix)s%(col)s" role="main">' + % {"prefix": self.twbs_col_cls, "col": content_cols} + ) + components = self._cw.vreg["components"] self.content_components(view, components) @@ -144,3 +161,3 @@ self.content_components(view, components) - w(u'<div id="pageContent">') + w('<div id="pageContent">') self.content_header(view) @@ -146,3 +163,3 @@ self.content_header(view) - vtitle = self._cw.form.get('vtitle') + vtitle = self._cw.form.get("vtitle") if vtitle: @@ -148,8 +165,8 @@ if vtitle: - w(u'<div class="vtitle">%s</div>\n' % xml_escape(vtitle)) + w('<div class="vtitle">%s</div>\n' % xml_escape(vtitle)) self.state_header() self.content_navrestriction_components(view, components) nav_html = UStringIO() if view and not view.handle_pagination: view.paginate(w=nav_html.write) w(nav_html.getvalue()) @@ -150,8 +167,8 @@ self.state_header() self.content_navrestriction_components(view, components) nav_html = UStringIO() if view and not view.handle_pagination: view.paginate(w=nav_html.write) w(nav_html.getvalue()) - w(u'<div id="contentmain">\n') + w('<div id="contentmain">\n') view.render(w=w) @@ -157,4 +174,4 @@ view.render(w=w) - w(u'</div>\n') # closes id=contentmain + w("</div>\n") # closes id=contentmain w(nav_html.getvalue()) self.content_footer(view) @@ -159,9 +176,9 @@ w(nav_html.getvalue()) self.content_footer(view) - w(u'</div>\n') # closes div#pageContent - w(u'</div>\n') # closes div.%(prefix)s-%(col)s + w("</div>\n") # closes div#pageContent + w("</div>\n") # closes div.%(prefix)s-%(col)s @monkeypatch(basetemplates.TheMainTemplate) def content_components(self, view, components): """TODO : should use context""" @@ -163,8 +180,8 @@ @monkeypatch(basetemplates.TheMainTemplate) def content_components(self, view, components): """TODO : should use context""" - rqlcomp = components.select_or_none('rqlinput', self._cw, rset=self.cw_rset) + rqlcomp = components.select_or_none("rqlinput", self._cw, rset=self.cw_rset) if rqlcomp: rqlcomp.render(w=self.w, view=view) @@ -169,6 +186,6 @@ if rqlcomp: rqlcomp.render(w=self.w, view=view) - msgcomp = components.select_or_none('applmessages', self._cw, rset=self.cw_rset) + msgcomp = components.select_or_none("applmessages", self._cw, rset=self.cw_rset) if msgcomp: msgcomp.render(w=self.w) @@ -177,10 +194,11 @@ def content_navrestriction_components(self, view, components): # display entity type restriction component etypefilter = components.select_or_none( - 'etypenavigation', self._cw, rset=self.cw_rset) - if etypefilter and etypefilter.cw_propval('visible'): + "etypenavigation", self._cw, rset=self.cw_rset + ) + if etypefilter and etypefilter.cw_propval("visible"): etypefilter.render(w=self.w) @monkeypatch(basetemplates.TheMainTemplate) def template_footer(self, view=None): @@ -182,10 +200,10 @@ etypefilter.render(w=self.w) @monkeypatch(basetemplates.TheMainTemplate) def template_footer(self, view=None): - self.wview('footer', rset=self.cw_rset, view=view) + self.wview("footer", rset=self.cw_rset, view=view) # main header @@ -188,6 +206,6 @@ # main header -basecomponents.ApplLogo.context = 'header-logo' +basecomponents.ApplLogo.context = "header-logo" # use basecomponents.ApplicationName.visible = False @@ -193,7 +211,7 @@ # use basecomponents.ApplicationName.visible = False -basecomponents.ApplicationName.context = 'header-left' +basecomponents.ApplicationName.context = "header-left" basecomponents.ApplLogo.order = 1 basecomponents.ApplicationName.order = 10 basecomponents.CookieLoginComponent.order = 10 basecomponents.AuthenticatedUserStatus.order = 5 SearchBox.order = -1 @@ -195,10 +213,10 @@ basecomponents.ApplLogo.order = 1 basecomponents.ApplicationName.order = 10 basecomponents.CookieLoginComponent.order = 10 basecomponents.AuthenticatedUserStatus.order = 5 SearchBox.order = -1 -SearchBox.context = 'header-right' -SearchBox.layout_id = 'simple-layout' +SearchBox.context = "header-right" +SearchBox.layout_id = "simple-layout" @monkeypatch(basetemplates.HTMLPageHeader) # noqa: F811 @@ -208,12 +226,11 @@ def get_components(self, view, context): # noqa: F811 - ctxcomponents = self._cw.vreg['ctxcomponents'] - return ctxcomponents.poss_visible_objects(self._cw, - rset=self.cw_rset, - view=view, - context=context) + ctxcomponents = self._cw.vreg["ctxcomponents"] + return ctxcomponents.poss_visible_objects( + self._cw, rset=self.cw_rset, view=view, context=context + ) basetemplates.HTMLPageHeader.get_components = get_components basetemplates.HTMLPageHeader.css = { @@ -216,15 +233,15 @@ basetemplates.HTMLPageHeader.get_components = get_components basetemplates.HTMLPageHeader.css = { - 'navbar-extra': 'navbar-default', - 'breadcrumbs': 'cw-breadcrumb', - 'container-cls': basetemplates.TheMainTemplate.twbs_container_cls, - 'header-left': '', - 'header-right': 'navbar-right', + "navbar-extra": "navbar-default", + "breadcrumbs": "cw-breadcrumb", + "container-cls": basetemplates.TheMainTemplate.twbs_container_cls, + "header-left": "", + "header-right": "navbar-right", } @monkeypatch(basetemplates.HTMLPageHeader) def main_header(self, view): w = self.w @@ -225,9 +242,9 @@ } @monkeypatch(basetemplates.HTMLPageHeader) def main_header(self, view): w = self.w - w(u'<nav class="navbar %s" role="banner">' % self.css['navbar-extra']) - w(u'<div class="%s">' % self.css['container-cls']) + w('<nav class="navbar %s" role="banner">' % self.css["navbar-extra"]) + w('<div class="%s">' % self.css["container-cls"]) self.display_navbar_header(w, view) @@ -233,8 +250,8 @@ self.display_navbar_header(w, view) - w(u'<div id="tools-group" class="collapse navbar-collapse">') - self.display_header_components(w, view, 'header-left') - self.display_header_components(w, view, 'header-right') - w(u'</div></div></nav>') + w('<div id="tools-group" class="collapse navbar-collapse">') + self.display_header_components(w, view, "header-left") + self.display_header_components(w, view, "header-right") + w("</div></div></nav>") def display_navbar_header(self, w, view): @@ -238,9 +255,10 @@ def display_navbar_header(self, w, view): - w(u'''<div class="navbar-header"> + w( + """<div class="navbar-header"> <button class="navbar-toggle" data-target="#tools-group" data-toggle="collapse" type="button"> <span class="sr-only">%(toggle_label)s</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> @@ -242,10 +260,12 @@ <button class="navbar-toggle" data-target="#tools-group" data-toggle="collapse" type="button"> <span class="sr-only">%(toggle_label)s</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> - </button>''' % {'toggle_label': self._cw._('Toggle navigation')}) - components = self.get_components(view, context='header-logo') + </button>""" + % {"toggle_label": self._cw._("Toggle navigation")} + ) + components = self.get_components(view, context="header-logo") if components: for component in components: component.render(w=w) @@ -249,7 +269,7 @@ if components: for component in components: component.render(w=w) - w(u'</div>') + w("</div>") basetemplates.HTMLPageHeader.display_navbar_header = display_navbar_header @@ -258,5 +278,5 @@ def display_header_components(self, w, view, context): components = self.get_components(view, context=context) if components: - w(u'<ul class="nav navbar-nav %s">' % self.css[context]) + w('<ul class="nav navbar-nav %s">' % self.css[context]) for component in components: @@ -262,3 +282,3 @@ for component in components: - w(u'<li>') + w("<li>") component.render(w=w) @@ -264,6 +284,6 @@ component.render(w=w) - w(u'</li>') - w(u'</ul>') + w("</li>") + w("</ul>") basetemplates.HTMLPageHeader.display_header_components = display_header_components @@ -271,5 +291,5 @@ @monkeypatch(basetemplates.HTMLPageHeader) def breadcrumbs(self, view): - components = self.get_components(view, context='header-center') + components = self.get_components(view, context="header-center") if components: @@ -275,5 +295,7 @@ if components: - self.w(u'<nav role="navigation" class="%s">' % - self.css.get('breadcrumbs', 'breadcrumbs-defaul')) + self.w( + '<nav role="navigation" class="%s">' + % self.css.get("breadcrumbs", "breadcrumbs-defaul") + ) for component in components: component.render(w=self.w) @@ -278,7 +300,7 @@ for component in components: component.render(w=self.w) - self.w(u'</nav>') + self.w("</nav>") @monkeypatch(basetemplates.HTMLContentFooter) # noqa: F811 def call(self, view, **kwargs): # noqa: F811 @@ -281,8 +303,9 @@ @monkeypatch(basetemplates.HTMLContentFooter) # noqa: F811 def call(self, view, **kwargs): # noqa: F811 - components = self._cw.vreg['ctxcomponents'].poss_visible_objects( - self._cw, rset=self.cw_rset, view=view, context='navbottom') + components = self._cw.vreg["ctxcomponents"].poss_visible_objects( + self._cw, rset=self.cw_rset, view=view, context="navbottom" + ) if components: # the row is needed here to correctly put the HTML flux @@ -287,5 +310,5 @@ if components: # the row is needed here to correctly put the HTML flux - self.w(u'<div id="contentfooter">') + self.w('<div id="contentfooter">') for comp in components: comp.render(w=self.w, view=view) @@ -290,7 +313,7 @@ for comp in components: comp.render(w=self.w, view=view) - self.w(u'</div>') + self.w("</div>") @monkeypatch(basetemplates.HTMLPageFooter) # noqa: F811 def call(self, **kwargs): # noqa: F811 @@ -293,6 +316,6 @@ @monkeypatch(basetemplates.HTMLPageFooter) # noqa: F811 def call(self, **kwargs): # noqa: F811 - self.w(u'<footer id="pagefooter" role="contentinfo">') + self.w('<footer id="pagefooter" role="contentinfo">') self.footer_content() @@ -298,5 +321,5 @@ self.footer_content() - self.w(u'</footer>\n') + self.w("</footer>\n") def registration_callback(vreg): diff --git a/cubicweb_squareui/views/component.py b/cubicweb_squareui/views/component.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_Y3ViaWN3ZWJfc3F1YXJldWkvdmlld3MvY29tcG9uZW50LnB5..e0683079922cc89689495fabc8c74cb2935db7ee_Y3ViaWN3ZWJfc3F1YXJldWkvdmlld3MvY29tcG9uZW50LnB5 100644 --- a/cubicweb_squareui/views/component.py +++ b/cubicweb_squareui/views/component.py @@ -22,6 +22,7 @@ class HideAsidesBar(HeaderComponent): - """ Hide the left bar """ - __regid__ = 'hide-left-bar' + """Hide the left bar""" + + __regid__ = "hide-left-bar" __select__ = yes() @@ -27,4 +28,4 @@ __select__ = yes() - context = 'header-right' + context = "header-right" order = 3 visible = False @@ -29,6 +30,6 @@ order = 3 visible = False - icon_css_cls = 'glyphicon glyphicon-align-justify' + icon_css_cls = "glyphicon glyphicon-align-justify" def render(self, w): define_var = self._cw.html_headers.define_var @@ -32,9 +33,10 @@ def render(self, w): define_var = self._cw.html_headers.define_var - define_var('twbs_col_cls', TheMainTemplate.twbs_col_cls) - define_var('twbs_col_size', TheMainTemplate.twbs_col_size) - define_var('twbs_grid_columns', TheMainTemplate.twbs_grid_columns) - w(u'''<button class="btn btn-default navbar-btn" id="cw-aside-toggle" + define_var("twbs_col_cls", TheMainTemplate.twbs_col_cls) + define_var("twbs_col_size", TheMainTemplate.twbs_col_size) + define_var("twbs_grid_columns", TheMainTemplate.twbs_grid_columns) + w( + """<button class="btn btn-default navbar-btn" id="cw-aside-toggle" onclick="cw.cubes.squareui.toggleLeftColumn()" title="%(label)s"> <span class="%(icon_class)s"></span> @@ -39,4 +41,5 @@ onclick="cw.cubes.squareui.toggleLeftColumn()" title="%(label)s"> <span class="%(icon_class)s"></span> - </button>''' % {'icon_class': self.icon_css_cls, - 'label': self._cw._('collapse boxes')}) + </button>""" + % {"icon_class": self.icon_css_cls, "label": self._cw._("collapse boxes")} + ) diff --git a/doc/conf.py b/doc/conf.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_ZG9jL2NvbmYucHk=..e0683079922cc89689495fabc8c74cb2935db7ee_ZG9jL2NvbmYucHk= 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -16,8 +16,8 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -20,8 +20,8 @@ # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. @@ -25,6 +25,6 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx'] +extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx"] # Add any paths that contain templates here, relative to this directory. @@ -29,5 +29,5 @@ # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. @@ -32,5 +32,5 @@ # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. @@ -35,5 +35,5 @@ # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. @@ -38,5 +38,5 @@ # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. @@ -41,7 +41,7 @@ # General information about the project. -project = u'squareui' -copyright = u'2013-2014, Logilab' +project = "squareui" +copyright = "2013-2014, Logilab" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -49,9 +49,10 @@ # # The short X.Y version. from cubicweb_squareui.__pkginfo__ import version + ##version = '0.8.4' # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -52,10 +53,10 @@ ##version = '0.8.4' # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -59,5 +60,5 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. @@ -63,5 +64,5 @@ # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -65,6 +66,6 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all documents. @@ -69,5 +70,5 @@ # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. @@ -72,6 +73,6 @@ # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). @@ -75,7 +76,7 @@ # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -79,6 +80,6 @@ # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. @@ -83,5 +84,5 @@ # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. @@ -86,9 +87,9 @@ # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -89,11 +90,11 @@ # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. @@ -96,7 +97,7 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. @@ -101,6 +102,6 @@ # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". @@ -104,6 +105,6 @@ # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. @@ -108,6 +109,6 @@ # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -111,8 +112,8 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. @@ -115,9 +116,9 @@ # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". @@ -120,8 +121,8 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -125,7 +126,7 @@ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -129,6 +130,6 @@ # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. @@ -133,6 +134,6 @@ # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. @@ -136,6 +137,6 @@ # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. @@ -140,5 +141,5 @@ # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. @@ -143,5 +144,5 @@ # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. @@ -146,5 +147,5 @@ # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. @@ -149,5 +150,5 @@ # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. @@ -152,5 +153,5 @@ # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. @@ -155,7 +156,7 @@ # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. @@ -158,7 +159,7 @@ # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). @@ -163,5 +164,5 @@ # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. @@ -166,8 +167,8 @@ # Output file base name for HTML help builder. -htmlhelp_basename = 'squareuidoc' +htmlhelp_basename = "squareuidoc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). @@ -169,8 +170,8 @@ # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). @@ -175,7 +176,7 @@ # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ @@ -178,9 +179,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'squareui.tex', u'Squareui documentation', - u'Logilab', 'manual'), + ("index", "squareui.tex", "Squareui documentation", "Logilab", "manual"), ] latex_elements = { @@ -184,10 +184,10 @@ ] latex_elements = { - 'papersize':'a4paper', - 'babel': '\\usepackage[english,french]{babel}', - 'fncychap': '\\usepackage[Sonny]{fncychap}' + "papersize": "a4paper", + "babel": "\\usepackage[english,french]{babel}", + "fncychap": "\\usepackage[Sonny]{fncychap}", } # The name of an image file (relative to this directory) to place at the top of # the title page. @@ -190,8 +190,8 @@ } # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. @@ -195,6 +195,6 @@ # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. @@ -199,5 +199,5 @@ # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. @@ -202,5 +202,5 @@ # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. @@ -205,5 +205,5 @@ # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. @@ -208,5 +208,5 @@ # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. @@ -211,9 +211,9 @@ # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). @@ -214,13 +214,10 @@ # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'squareui', u'Squareui documentation', - [u'Logilab'], 1) -] +man_pages = [("index", "squareui", "Squareui documentation", ["Logilab"], 1)] # Example configuration for intersphinx: refer to the Python standard library. @@ -224,4 +221,4 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'http://docs.python.org/': None} +intersphinx_mapping = {"http://docs.python.org/": None} diff --git a/setup.py b/setup.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_c2V0dXAucHk=..e0683079922cc89689495fabc8c74cb2935db7ee_c2V0dXAucHk= 100644 --- a/setup.py +++ b/setup.py @@ -32,9 +32,9 @@ # load metadata from the __pkginfo__.py file so there is no risk of conflict # see https://packaging.python.org/en/latest/single_source_version.html -pkginfo = join(here, 'cubicweb_squareui', '__pkginfo__.py') +pkginfo = join(here, "cubicweb_squareui", "__pkginfo__.py") __pkginfo__ = {} with open(pkginfo) as f: exec(f.read(), __pkginfo__) # get required metadatas @@ -36,14 +36,14 @@ __pkginfo__ = {} with open(pkginfo) as f: exec(f.read(), __pkginfo__) # get required metadatas -distname = __pkginfo__['distname'] -version = __pkginfo__['version'] -license = __pkginfo__['license'] -description = __pkginfo__['description'] -web = __pkginfo__['web'] -author = __pkginfo__['author'] -author_email = __pkginfo__['author_email'] -classifiers = __pkginfo__['classifiers'] +distname = __pkginfo__["distname"] +version = __pkginfo__["version"] +license = __pkginfo__["license"] +description = __pkginfo__["description"] +web = __pkginfo__["web"] +author = __pkginfo__["author"] +author_email = __pkginfo__["author_email"] +classifiers = __pkginfo__["classifiers"] @@ -49,5 +49,5 @@ -with open(join(here, 'README.rst')) as f: +with open(join(here, "README.rst")) as f: long_description = f.read() # get optional metadatas @@ -51,9 +51,9 @@ long_description = f.read() # get optional metadatas -data_files = __pkginfo__.get('data_files', None) -dependency_links = __pkginfo__.get('dependency_links', ()) +data_files = __pkginfo__.get("data_files", None) +dependency_links = __pkginfo__.get("dependency_links", ()) requires = {} for entry in ("__depends__",): # "__recommends__"): requires.update(__pkginfo__.get(entry, {})) @@ -56,10 +56,10 @@ requires = {} for entry in ("__depends__",): # "__recommends__"): requires.update(__pkginfo__.get(entry, {})) -install_requires = ["{0} {1}".format(d, v and v or "").strip() - - for d, v in requires.items()] +install_requires = [ + "{0} {1}".format(d, v and v or "").strip() for d, v in requires.items() +] setup( @@ -72,7 +72,7 @@ author_email=author_email, url=web, classifiers=classifiers, - packages=find_packages(exclude=['test']), + packages=find_packages(exclude=["test"]), install_requires=install_requires, include_package_data=True, entry_points={ @@ -76,8 +76,8 @@ install_requires=install_requires, include_package_data=True, entry_points={ - 'cubicweb.cubes': [ - 'squareui=cubicweb_squareui', + "cubicweb.cubes": [ + "squareui=cubicweb_squareui", ], }, zip_safe=False, diff --git a/test/test_squareui.py b/test/test_squareui.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_dGVzdC90ZXN0X3NxdWFyZXVpLnB5..e0683079922cc89689495fabc8c74cb2935db7ee_dGVzdC90ZXN0X3NxdWFyZXVpLnB5 100644 --- a/test/test_squareui.py +++ b/test/test_squareui.py @@ -42,6 +42,6 @@ class DefaultTC(testlib.CubicWebTC): def test_something(self): - self.skipTest('this cube has no test') + self.skipTest("this cube has no test") @@ -46,4 +46,4 @@ -if __name__ == '__main__': +if __name__ == "__main__": import unittest @@ -49,2 +49,3 @@ import unittest + unittest.main() diff --git a/test/unittest_views.py b/test/unittest_views.py index 4dcdb4ce5f396109e6402c8d15673fdbc6eb3871_dGVzdC91bml0dGVzdF92aWV3cy5weQ==..e0683079922cc89689495fabc8c74cb2935db7ee_dGVzdC91bml0dGVzdF92aWV3cy5weQ== 100644 --- a/test/unittest_views.py +++ b/test/unittest_views.py @@ -5,6 +5,5 @@ class BoostrapTheMainTemplateTC(CubicWebTC): - def test_valid_xhtml_index(self): with self.admin_access.web_request() as req: @@ -9,5 +8,5 @@ def test_valid_xhtml_index(self): with self.admin_access.web_request() as req: - self.view('index', req=req) + self.view("index", req=req) def test_valid_xhtml_error(self): @@ -12,4 +11,4 @@ def test_valid_xhtml_error(self): - valid = self.content_type_validators.get('text/html', XMLValidator)() + valid = self.content_type_validators.get("text/html", XMLValidator)() with self.admin_access.web_request() as req: @@ -15,4 +14,4 @@ with self.admin_access.web_request() as req: - valid.parse_string(self.vreg['views'].main_template(req, 'error-template')) + valid.parse_string(self.vreg["views"].main_template(req, "error-template")) @@ -17,4 +16,4 @@ -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()