Re-arrange buttons to put the most frequently used ones first

This commit is contained in:
Kovid Goyal 2009-03-14 16:39:56 -07:00
parent 792e993222
commit fd3c5bb7f5
3 changed files with 273 additions and 248 deletions

View File

@ -237,6 +237,7 @@ class Main(MainWindow, Ui_MainWindow):
QObject.connect(self.config_button, SIGNAL('clicked(bool)'), self.do_config) QObject.connect(self.config_button, SIGNAL('clicked(bool)'), self.do_config)
self.connect(self.preferences_action, SIGNAL('triggered(bool)'), self.do_config) self.connect(self.preferences_action, SIGNAL('triggered(bool)'), self.do_config)
self.connect(self.action_preferences, SIGNAL('triggered(bool)'), self.do_config)
QObject.connect(self.advanced_search_button, SIGNAL('clicked(bool)'), self.do_advanced_search) QObject.connect(self.advanced_search_button, SIGNAL('clicked(bool)'), self.do_advanced_search)
####################### Library view ######################## ####################### Library view ########################
@ -1252,7 +1253,7 @@ class Main(MainWindow, Ui_MainWindow):
############################### Do config ################################## ############################### Do config ##################################
def do_config(self): def do_config(self, *args):
if self.job_manager.has_jobs(): if self.job_manager.has_jobs():
d = error_dialog(self, _('Cannot configure'), _('Cannot configure while there are running jobs.')) d = error_dialog(self, _('Cannot configure'), _('Cannot configure while there are running jobs.'))
d.exec_() d.exec_()

View File

@ -1,149 +1,150 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Kovid Goyal</author> <author>Kovid Goyal</author>
<class>MainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" > <widget class="QMainWindow" name="MainWindow">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>865</width> <width>1012</width>
<height>822</height> <height>822</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string>__appname__</string> <string>__appname__</string>
</property> </property>
<property name="windowIcon" > <property name="windowIcon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/library</normaloff>:/library</iconset> <normaloff>:/library</normaloff>:/library</iconset>
</property> </property>
<widget class="QWidget" name="centralwidget" > <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout" > <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" > <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3" > <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="LocationView" name="location_view" > <widget class="LocationView" name="location_view">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>100</height> <height>100</height>
</size> </size>
</property> </property>
<property name="verticalScrollBarPolicy" > <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum> <enum>Qt::ScrollBarAlwaysOff</enum>
</property> </property>
<property name="horizontalScrollBarPolicy" > <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum> <enum>Qt::ScrollBarAsNeeded</enum>
</property> </property>
<property name="tabKeyNavigation" > <property name="tabKeyNavigation">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="showDropIndicator" stdset="0" > <property name="showDropIndicator" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>40</width> <width>40</width>
<height>40</height> <height>40</height>
</size> </size>
</property> </property>
<property name="movement" > <property name="movement">
<enum>QListView::Static</enum> <enum>QListView::Static</enum>
</property> </property>
<property name="flow" > <property name="flow">
<enum>QListView::LeftToRight</enum> <enum>QListView::LeftToRight</enum>
</property> </property>
<property name="gridSize" > <property name="gridSize">
<size> <size>
<width>175</width> <width>175</width>
<height>90</height> <height>90</height>
</size> </size>
</property> </property>
<property name="viewMode" > <property name="viewMode">
<enum>QListView::ListMode</enum> <enum>QListView::ListMode</enum>
</property> </property>
<property name="wordWrap" > <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="donate_button" > <widget class="QToolButton" name="donate_button">
<property name="cursor" > <property name="cursor">
<cursorShape>PointingHandCursor</cursorShape> <cursorShape>PointingHandCursor</cursorShape>
</property> </property>
<property name="text" > <property name="text">
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/donate.svg</normaloff>:/images/donate.svg</iconset> <normaloff>:/images/donate.svg</normaloff>:/images/donate.svg</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>64</width> <width>64</width>
<height>64</height> <height>64</height>
</size> </size>
</property> </property>
<property name="autoRaise" > <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3" > <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QLabel" name="vanity" > <widget class="QLabel" name="vanity">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>90</height> <height>90</height>
</size> </size>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="textFormat" > <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
</property> </property>
<property name="openExternalLinks" > <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2" > <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label_2" > <widget class="QLabel" name="label_2">
<property name="text" > <property name="text">
<string>Output:</string> <string>Output:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="output_format" > <widget class="QComboBox" name="output_format">
<property name="toolTip" > <property name="toolTip">
<string>Set the output format that is used when converting ebooks and downloading news</string> <string>Set the output format that is used when converting ebooks and downloading news</string>
</property> </property>
</widget> </widget>
@ -154,99 +155,99 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" > <item row="1" column="0">
<layout class="QHBoxLayout" > <layout class="QHBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin" > <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QToolButton" name="advanced_search_button" > <widget class="QToolButton" name="advanced_search_button">
<property name="toolTip" > <property name="toolTip">
<string>Advanced search</string> <string>Advanced search</string>
</property> </property>
<property name="text" > <property name="text">
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/search.svg</normaloff>:/images/search.svg</iconset> <normaloff>:/images/search.svg</normaloff>:/images/search.svg</iconset>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Alt+S</string> <string>Alt+S</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label" > <widget class="QLabel" name="label">
<property name="text" > <property name="text">
<string>&amp;Search:</string> <string>&amp;Search:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>search</cstring> <cstring>search</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="SearchBox" name="search" > <widget class="SearchBox" name="search">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="acceptDrops" > <property name="acceptDrops">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>Search the list of books by title or author&lt;br>&lt;br>Words separated by spaces are ANDed</string> <string>Search the list of books by title or author&lt;br&gt;&lt;br&gt;Words separated by spaces are ANDed</string>
</property> </property>
<property name="whatsThis" > <property name="whatsThis">
<string>Search the list of books by title, author, publisher, tags and comments&lt;br>&lt;br>Words separated by spaces are ANDed</string> <string>Search the list of books by title, author, publisher, tags and comments&lt;br&gt;&lt;br&gt;Words separated by spaces are ANDed</string>
</property> </property>
<property name="autoFillBackground" > <property name="autoFillBackground">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="frame" > <property name="frame">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="clear_button" > <widget class="QToolButton" name="clear_button">
<property name="toolTip" > <property name="toolTip">
<string>Reset Quick Search</string> <string>Reset Quick Search</string>
</property> </property>
<property name="text" > <property name="text">
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/clear_left.svg</normaloff>:/images/clear_left.svg</iconset> <normaloff>:/images/clear_left.svg</normaloff>:/images/clear_left.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line" > <widget class="Line" name="line">
<property name="orientation" > <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@ -255,77 +256,77 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="config_button" > <widget class="QToolButton" name="config_button">
<property name="toolTip" > <property name="toolTip">
<string>Configuration</string> <string>Configuration</string>
</property> </property>
<property name="text" > <property name="text">
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset> <normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0" > <item row="2" column="0">
<widget class="QStackedWidget" name="stack" > <widget class="QStackedWidget" name="stack">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch> <horstretch>100</horstretch>
<verstretch>100</verstretch> <verstretch>100</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex" > <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="library" > <widget class="QWidget" name="library">
<layout class="QVBoxLayout" name="verticalLayout_2" > <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout" > <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout" > <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QRadioButton" name="match_any" > <widget class="QRadioButton" name="match_any">
<property name="text" > <property name="text">
<string>Match any</string> <string>Match any</string>
</property> </property>
<property name="checked" > <property name="checked">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="match_all" > <widget class="QRadioButton" name="match_all">
<property name="text" > <property name="text">
<string>Match all</string> <string>Match all</string>
</property> </property>
<property name="checked" > <property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="popularity" > <widget class="QCheckBox" name="popularity">
<property name="text" > <property name="text">
<string>Sort by &amp;popularity</string> <string>Sort by &amp;popularity</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="TagsView" name="tags_view" > <widget class="TagsView" name="tags_view">
<property name="tabKeyNavigation" > <property name="tabKeyNavigation">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="alternatingRowColors" > <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="animated" > <property name="animated">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="headerHidden" > <property name="headerHidden">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
@ -333,35 +334,35 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="BooksView" name="library_view" > <widget class="BooksView" name="library_view">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch> <horstretch>100</horstretch>
<verstretch>10</verstretch> <verstretch>10</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="acceptDrops" > <property name="acceptDrops">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="dragEnabled" > <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="dragDropOverwriteMode" > <property name="dragDropOverwriteMode">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="dragDropMode" > <property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum> <enum>QAbstractItemView::DragDrop</enum>
</property> </property>
<property name="alternatingRowColors" > <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="selectionBehavior" > <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>
<property name="showGrid" > <property name="showGrid">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="wordWrap" > <property name="wordWrap">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
@ -370,76 +371,76 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="main_memory" > <widget class="QWidget" name="main_memory">
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<widget class="DeviceBooksView" name="memory_view" > <widget class="DeviceBooksView" name="memory_view">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch> <horstretch>100</horstretch>
<verstretch>10</verstretch> <verstretch>10</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="acceptDrops" > <property name="acceptDrops">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="dragEnabled" > <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="dragDropOverwriteMode" > <property name="dragDropOverwriteMode">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="dragDropMode" > <property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum> <enum>QAbstractItemView::DragDrop</enum>
</property> </property>
<property name="alternatingRowColors" > <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="selectionBehavior" > <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>
<property name="showGrid" > <property name="showGrid">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="wordWrap" > <property name="wordWrap">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page" > <widget class="QWidget" name="page">
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<widget class="DeviceBooksView" name="card_view" > <widget class="DeviceBooksView" name="card_view">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" > <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>10</horstretch> <horstretch>10</horstretch>
<verstretch>10</verstretch> <verstretch>10</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="acceptDrops" > <property name="acceptDrops">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="dragEnabled" > <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="dragDropOverwriteMode" > <property name="dragDropOverwriteMode">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="dragDropMode" > <property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum> <enum>QAbstractItemView::DragDrop</enum>
</property> </property>
<property name="alternatingRowColors" > <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="selectionBehavior" > <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>
<property name="showGrid" > <property name="showGrid">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="wordWrap" > <property name="wordWrap">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
@ -450,221 +451,237 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QToolBar" name="tool_bar" > <widget class="QToolBar" name="tool_bar">
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum> <enum>Qt::PreventContextMenu</enum>
</property> </property>
<property name="movable" > <property name="movable">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>48</width> <width>48</width>
<height>48</height> <height>48</height>
</size> </size>
</property> </property>
<property name="toolButtonStyle" > <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum> <enum>Qt::ToolButtonTextUnderIcon</enum>
</property> </property>
<attribute name="toolBarArea" > <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak" > <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="action_add" /> <addaction name="action_add"/>
<addaction name="action_del" /> <addaction name="action_edit"/>
<addaction name="action_edit" /> <addaction name="action_convert"/>
<addaction name="separator" /> <addaction name="action_view"/>
<addaction name="action_sync" /> <addaction name="action_news"/>
<addaction name="action_save" /> <addaction name="separator"/>
<addaction name="separator" /> <addaction name="action_sync"/>
<addaction name="action_news" /> <addaction name="action_save"/>
<addaction name="action_convert" /> <addaction name="action_del"/>
<addaction name="action_view" /> <addaction name="separator"/>
<addaction name="action_preferences"/>
</widget> </widget>
<widget class="QStatusBar" name="statusBar" > <widget class="QStatusBar" name="statusBar">
<property name="mouseTracking" > <property name="mouseTracking">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<action name="action_add" > <action name="action_add">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/add_book.svg</normaloff>:/images/add_book.svg</iconset> <normaloff>:/images/add_book.svg</normaloff>:/images/add_book.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Add books</string> <string>Add books</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>A</string> <string>A</string>
</property> </property>
<property name="autoRepeat" > <property name="autoRepeat">
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="action_del" > <action name="action_del">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset> <normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Remove books</string> <string>Remove books</string>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>Remove books</string> <string>Remove books</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Del</string> <string>Del</string>
</property> </property>
</action> </action>
<action name="action_edit" > <action name="action_edit">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset> <normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Edit meta information</string> <string>Edit meta information</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>E</string> <string>E</string>
</property> </property>
<property name="autoRepeat" > <property name="autoRepeat">
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="action_sync" > <action name="action_sync">
<property name="enabled" > <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/sync.svg</normaloff>:/images/sync.svg</iconset> <normaloff>:/images/sync.svg</normaloff>:/images/sync.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Send to device</string> <string>Send to device</string>
</property> </property>
</action> </action>
<action name="action_save" > <action name="action_save">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/save.svg</normaloff>:/images/save.svg</iconset> <normaloff>:/images/save.svg</normaloff>:/images/save.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Save to disk</string> <string>Save to disk</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>S</string> <string>S</string>
</property> </property>
</action> </action>
<action name="action_news" > <action name="action_news">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/news.svg</normaloff>:/images/news.svg</iconset> <normaloff>:/images/news.svg</normaloff>:/images/news.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Fetch news</string> <string>Fetch news</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>F</string> <string>F</string>
</property> </property>
</action> </action>
<action name="action_convert" > <action name="action_convert">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/convert.svg</normaloff>:/images/convert.svg</iconset> <normaloff>:/images/convert.svg</normaloff>:/images/convert.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Convert E-books</string> <string>Convert E-books</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>C</string> <string>C</string>
</property> </property>
</action> </action>
<action name="action_view" > <action name="action_view">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/view.svg</normaloff>:/images/view.svg</iconset> <normaloff>:/images/view.svg</normaloff>:/images/view.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>View</string> <string>View</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>V</string> <string>V</string>
</property> </property>
</action> </action>
<action name="action_open_containing_folder" > <action name="action_open_containing_folder">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset> <normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Open containing folder</string> <string>Open containing folder</string>
</property> </property>
</action> </action>
<action name="action_show_book_details" > <action name="action_show_book_details">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/dialog_information.svg</normaloff>:/images/dialog_information.svg</iconset> <normaloff>:/images/dialog_information.svg</normaloff>:/images/dialog_information.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Show book details</string> <string>Show book details</string>
</property> </property>
</action> </action>
<action name="action_books_by_same_author" > <action name="action_books_by_same_author">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/user_profile.svg</normaloff>:/images/user_profile.svg</iconset> <normaloff>:/images/user_profile.svg</normaloff>:/images/user_profile.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Books by same author</string> <string>Books by same author</string>
</property> </property>
</action> </action>
<action name="action_books_in_this_series" > <action name="action_books_in_this_series">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/books_in_series.svg</normaloff>:/images/books_in_series.svg</iconset> <normaloff>:/images/books_in_series.svg</normaloff>:/images/books_in_series.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Books in this series</string> <string>Books in this series</string>
</property> </property>
</action> </action>
<action name="action_books_by_this_publisher" > <action name="action_books_by_this_publisher">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/publisher.png</normaloff>:/images/publisher.png</iconset> <normaloff>:/images/publisher.png</normaloff>:/images/publisher.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Books by this publisher</string> <string>Books by this publisher</string>
</property> </property>
</action> </action>
<action name="action_books_with_the_same_tags" > <action name="action_books_with_the_same_tags">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/tags.svg</normaloff>:/images/tags.svg</iconset> <normaloff>:/images/tags.svg</normaloff>:/images/tags.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Books with the same tags</string> <string>Books with the same tags</string>
</property> </property>
</action> </action>
<action name="action_send_specific_format_to_device" > <action name="action_send_specific_format_to_device">
<property name="icon" > <property name="icon">
<iconset resource="images.qrc" > <iconset resource="images.qrc">
<normaloff>:/images/book.svg</normaloff>:/images/book.svg</iconset> <normaloff>:/images/book.svg</normaloff>:/images/book.svg</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Send specific format to device</string> <string>Send specific format to device</string>
</property> </property>
</action> </action>
<action name="action_preferences">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
</property>
<property name="text">
<string>Preferences</string>
</property>
<property name="toolTip">
<string>Configure calibre</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
@ -694,7 +711,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="images.qrc" /> <include location="images.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>
@ -703,11 +720,11 @@
<receiver>search</receiver> <receiver>search</receiver>
<slot>clear()</slot> <slot>clear()</slot>
<hints> <hints>
<hint type="sourcelabel" > <hint type="sourcelabel">
<x>787</x> <x>787</x>
<y>215</y> <y>215</y>
</hint> </hint>
<hint type="destinationlabel" > <hint type="destinationlabel">
<x>755</x> <x>755</x>
<y>213</y> <y>213</y>
</hint> </hint>

View File

@ -10,11 +10,17 @@ _server = None
def get_external_ip(): def get_external_ip():
'Get IP address of interface used to connect to the outside world' 'Get IP address of interface used to connect to the outside world'
try: try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ipaddr = socket.gethostbyname(socket.gethostname())
s.connect(('google.com', 0))
return s.getsockname()[0]
except: except:
return '127.0.0.1' ipaddr = '127.0.0.1'
if ipaddr == '127.0.0.1':
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('google.com', 0))
ipaddr = s.getsockname()[0]
except:
pass
return ipaddr
def start_server(): def start_server():
global _server global _server
@ -33,6 +39,7 @@ def publish(desc, type, port, properties=None, add_hostname=True):
:param properties: An optional dictionary whose keys and values will be put :param properties: An optional dictionary whose keys and values will be put
into the TXT record. into the TXT record.
''' '''
port = int(port)
server = start_server() server = start_server()
hostname = socket.gethostname() hostname = socket.gethostname()
if add_hostname: if add_hostname: