How to use setHost method in pyatom

Best Python code snippet using pyatom_python

birthdayparty.py

Source:birthdayparty.py Github

copy

Full Screen

...37 // ![3]38 public:39 BirthdayParty(QObject *parent = 0);40 Person *host() const;41 void setHost(Person *);42 QDeclarativeListProperty<Person> guests();43 int guestCount() const;44 Person *guest(int) const;45 private:46 Person *m_host;47 QList<Person *> m_guests;48 };49 // ![3]50 #endif // BIRTHDAYPARTY_H51-------------------------52Original Class Definition53-------------------------54#include "birthdayparty.h"55 BirthdayParty::BirthdayParty(QObject *parent)56 : QObject(parent), m_host(0)57 {58 }59 // ![0]60 Person *BirthdayParty::host() const61 {62 return m_host;63 }64 void BirthdayParty::setHost(Person *c)65 {66 m_host = c;67 }68 QDeclarativeListProperty<Person> BirthdayParty::guests()69 {70 return QDeclarativeListProperty<Person>(this, m_guests);71 }72 int BirthdayParty::guestCount() const73 {74 return m_guests.count();75 }76 Person *BirthdayParty::guest(int index) const77 {78 return m_guests.at(index);79 }80 // ![0]81"""82#include <QObject>83from PySide.QtCore import QObject84#include <QDeclarativeListProperty>85from PySide.QtDeclarative import ListProperty86# There are a number of macros used in Qt that are replaced with classes in PySide87# Property is used instead of Q_PROPERTY88# Signal is required for WRITE methods, to alert other elements that the property has changed89from PySide.QtCore import Property90from PySide.QtCore import Signal91#include "person.h"92from person import Person93class BirthdayParty(QObject):94 """95 Use unicode instead of QString96 """97 # * birthdayparty.h *98 # private:99 # Person *m_host;100 # QList<Person *> m_guests;101 # * birthdayparty.cpp *102 #.h BirthdayParty(QObject *parent = 0);103 #.cpp BirthdayParty::BirthdayParty(QObject *parent) : QObject(parent), m_host(0) {}104 def __init__(self, parent=None):105 # these are automatic constructors in C++106 # : QObject(parent), m_host(0)107 super(BirthdayParty, self).__init__(parent)108 # Person *m_host;109 # : QObject(parent), m_host(0)110 # None is the python keyword for a null object vs C++ using 0 to set a null pointer111 self._host = None112 # QList<Person *> m_guests;113 # PySide seems to replace QLists with its own native lists. (see QtCore/qlist_conversions.h)114 self._guests = []115 #.h Person *host() const;116 #.cpp Person *BirthdayParty::host() const {return m_host;}117 def getHost(self):118 return self._host119 # to avoid namespace collision with the property, host -> setHost120 #.h Person *host() const;121 #.cpp void BirthdayParty::setHost(Person *c) { m_host = c; }122 def setHost(self, c):123 self._host = c124 # Q_PROPERTY(Person *host READ host WRITE setHost)125 host = Property(Person, getHost, setHost)126 #.h int guestCount() const;127 #.cpp int BirthdayParty::guestCount() const { return m_guests.count(); }128 def guestCount(self):129 return len(self._guests)130 #.h Person *guest(int) const;131 #.cpp Person *BirthdayParty::guest(int index) const132 def guest(self, index):133 return self._guests[index]134 #.h QDeclarativeListProperty<Person> guests();135 #.cpp QDeclarativeListProperty<Person> BirthdayParty::guests() {136 # return QDeclarativeListProperty<Person>(this, m_guests); }...

Full Screen

Full Screen

config.py

Source:config.py Github

copy

Full Screen

1import operator2from qutebrowser.api import interceptor, message3# general settings4config.load_autoconfig(False)5c.auto_save.session = True6c.completion.height = '40%'7c.completion.scrollbar.width = 88c.content.autoplay = False9c.content.user_stylesheets = ['user.css']10c.content.notifications.enabled = False11c.downloads.position = 'bottom'12c.downloads.remove_finished = 300013c.editor.command = [ 'st', '-e', 'nvr', '{}' ]14c.fonts.default_size = '10.5pt'15c.input.insert_mode.auto_load = False16c.url.default_page = 'about:blank'17c.url.start_pages = 'about:blank'18c.scrolling.bar = 'always'19c.statusbar.padding = {'bottom': 5, 'left': 0, 'right': 5, 'top': 5}20c.tabs.padding = {'bottom': 5, 'left': 5, 'right': 5, 'top': 5}21c.tabs.indicator.padding = {'bottom': 2, 'left': 0, 'right': 4, 'top': 2}22c.tabs.indicator.width = 023c.tabs.favicons.show = 'never'24c.tabs.select_on_remove = 'prev'25c.content.blocking.method = "both"26# fingerprinting27c.content.webgl = False28c.content.canvas_reading = False29c.content.webrtc_ip_handling_policy = 'disable-non-proxied-udp'30# bindings31config.bind('J', 'tab-prev')32config.bind('K', 'tab-next')33config.bind('zi', 'zoom-in')34config.bind('zo', 'zoom-out')35config.bind('zz', 'zoom')36config.bind('j', 'scroll-px 0 30')37config.bind('k', 'scroll-px 0 -30')38config.bind('<Ctrl-r>', 'config-source ;; message-info "configuration reloaded"')39config.bind('<Ctrl-Shift-r>', 'restart')40config.bind('<Ctrl-Right>', 'tab-move +')41config.bind('<Ctrl-Left>', 'tab-move -')42# unbind keys43config.unbind('m')44config.unbind('M')45config.unbind('b')46config.unbind('B')47config.unbind('wb')48config.unbind('gb')49config.unbind('gB')50config.unbind('wB')51# aliases52c.aliases = {53 "mpv": "spawn --userscript open-in-mpv",54 "bookmark": "spawn --userscript bookmark-page"55}56# search engines57c.url.searchengines = { 58 #'DEFAULT': 'https://paulgo.io/search?q={}',59 'DEFAULT': 'http://localhost:80/search?q={}',60 'searxng': 'http://localhost:80/search?q={}',61 'duckduckgo': 'https://duckduckgo.com/?q={}',62 'google': 'https://www.google.com/search?hl=en&q={}',63 'archwiki': 'https://wiki.archlinux.org/?search={}',64 'aur': 'https://aur.archlinux.org/packages?K={}',65 'github': 'https://github.com/search?q={}',66 'wikipedia': 'https://wikiless.org/?search={}',67}68# cookies69c.content.cookies.accept = 'no-3rdparty'70# colors71c.colors.webpage.darkmode.enabled = False72c.colors.webpage.bg = 'black'73c.colors.completion.odd.bg = '#191b28'74c.colors.completion.even.bg = '#191b28'75c.colors.completion.category.bg = 'black'76c.colors.completion.category.border.top = 'black'77c.colors.completion.item.selected.fg = '#e0dbd2'78c.colors.completion.item.selected.bg = '#563d7c'79c.colors.completion.item.selected.border.top = '#563d7c'80c.colors.completion.item.selected.border.bottom = '#563d7c'81c.colors.statusbar.private.bg = 'darkslategray'82c.colors.statusbar.command.private.bg = 'darkslategray'83c.colors.tabs.bar.bg = '#444444'84c.colors.tabs.odd.bg = '#444444'85c.colors.tabs.even.fg = 'white'86c.colors.tabs.even.bg = '#555555'87c.colors.tabs.selected.odd.bg = '#563d7c'88c.colors.tabs.selected.even.bg = '#563d7c'89# redirect given sites to other urls90REDIRECT_MAP = {91 "wikipedia.org": operator.methodcaller('setHost', 'wikiless.org'),92 "en.wikipedia.org": operator.methodcaller('setHost', 'wikiless.org'),93 "www.wikipedia.org": operator.methodcaller('setHost', 'wikiless.org'),94 "medium.com": operator.methodcaller('setHost', 'scribe.rip'),95 "youtube.com": operator.methodcaller('setHost', 'piped-material.ftp.sh'),96 "www.youtube.com": operator.methodcaller('setHost', 'piped-material.ftp.sh'),97 "youtu.be": operator.methodcaller('setHost', 'piped-material.ftp.sh'),98 "reddit.com": operator.methodcaller('setHost', 'teddit.net'),99 "www.reddit.com": operator.methodcaller('setHost', 'teddit.net'),100 "instagram.com": operator.methodcaller('setHost', 'bibliogram.art'),101 "www.instagram.com": operator.methodcaller('setHost', 'bibliogram.art'),102 "twitter.com": operator.methodcaller('setHost', 'nitter.net'),103 "www.twitter.com": operator.methodcaller('setHost', 'nitter.net'),104 "www.imgur.com": operator.methodcaller('setHost', 'rimgo.pussthecat.org'),105 "imgur.com": operator.methodcaller('setHost', 'rimgo.pussthecat.org'),106 "i.imgur.com": operator.methodcaller('setHost', 'rimgo.pussthecat.org'),107 "www.odysee.com": operator.methodcaller('setHost', 'librarian.pussthecat.org'),108 "odysee.com": operator.methodcaller('setHost', 'librarian.pussthecat.org'),109}110def int_fn(info: interceptor.Request):111 """Block the given request if necessary."""112 if (info.resource_type != interceptor.ResourceType.main_frame or113 info.request_url.scheme() in {"data", "blob"}):114 return115 url = info.request_url116 redir = REDIRECT_MAP.get(url.host())117 if redir is not None and redir(url) is not False:118 message.info("Redirecting to " + url.toString())119 info.redirect(url)...

Full Screen

Full Screen

redirect.py

Source:redirect.py Github

copy

Full Screen

1import operator2from qutebrowser.api import interceptor, message3# Any return value other than a literal 'False' means we redirected4REDIRECT_MAP = {5 "reddit.com": operator.methodcaller('setHost', 'old.reddit.com'),6 "www.reddit.com": operator.methodcaller('setHost', 'old.reddit.com'),7 "youtube.com": operator.methodcaller('setHost', 'yewtu.be'),8 "www.youtube.com": operator.methodcaller('setHost', 'yewtu.be'),9 "youtu.be": operator.methodcaller('setHost', 'yewtu.be'),10 "twitter.com": operator.methodcaller('setHost', 'nitter.net'),11 "www.twitter.com": operator.methodcaller('setHost', 'nitter.net'),12 "termbin.com": operator.methodcaller('setHost', 'l.termbin.com'),13} # type: typing.Dict[str, typing.Callable[..., typing.Optional[bool]]]14def int_fn(info: interceptor.Request):15 """Block the given request if necessary."""16 if (info.resource_type != interceptor.ResourceType.main_frame or17 info.request_url.scheme() in {"data", "blob"}):18 return19 url = info.request_url20 redir = REDIRECT_MAP.get(url.host())21 if redir is not None and redir(url) is not False:22 message.info("Redirecting to " + url.toString())23 info.redirect(url)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful