Как отправить сообщение в Gwibber из python?

В Ubuntu это можно решить следующим образом:

Нажмите на значок Gear на панели запуска Unity (панель в левой части экрана). Значок отмечен «Системные настройки»

. Посмотрите в разделе «Оборудование» и щелкните значок «Дисплеи»

Отключить зеркальные отображения (необязательно)

Нажмите на один из дисплеев прямоугольники и перетаскивать дисплеи в любом порядке, который вы предпочитаете

Установите любые другие нужные параметры. Например, вы можете установить Launcher только для отображения на одном дисплее

Нажмите «Применить»

Теперь вы будете иметь основную настройку монитора - все без использования командной строки, как указано в ваш вопрос.

6
задан 19 June 2012 в 10:06

7 ответов

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 25 July 2018 в 18:25

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 2 August 2018 в 00:37

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 4 August 2018 в 16:07

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 6 August 2018 в 00:45

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 7 August 2018 в 18:11

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 10 August 2018 в 06:56

Вы действительно должны использовать API, основанный на GIR, вот более современный пример:

from gi.repository import Gwibber

s = Gwibber.Service ()
s.send_message ("This is the content to post", None, None, None)

Это сообщение будет отправлено всем учетным записям, которые в настоящее время разрешены для отправки. Вот параметры для send_message:

"""
  send_message: Posts a message
  @message: The message to post to Gwibber as a string or None
  @id: The gwibber message id or None
  @action: The action or None (reply, private)
  @account_id: The ID of the account to post from or None
"""

Итак, если вы хотите публиковать сообщения только из определенной учетной записи, вы можете сделать что-то вроде этого:

from gi.repository import Gwibber
accounts_service = Gwibber.Accounts.new ()
s = Gwibber.Service ()

accts = accounts_service.list () # A list of Gwibber.Account objects
for acct in accts:
    print "Gwibber ID: %s, Service: %s, Username: %s, Send: %s" % (acct.props.id, acct.props.service, acct.props.username, "True" if acct.props.send_enabled == "1" else "False")
    #add code to check if this is the account you want to post from, like if you want to post from all twitter accounts you would do this
    if acct.props.service == "twitter":
        s.send_message ("Whatever you want to post", None, None, acct.props.id)
6
ответ дан 15 August 2018 в 18:54

Другие вопросы по тегам:

Похожие вопросы: