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,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<author>Kovid Goyal</author> <author>Kovid Goyal</author>
<class>MainWindow</class> <class>MainWindow</class>
@ -6,12 +7,12 @@
<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>
@ -33,7 +34,7 @@
<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>
@ -110,7 +111,7 @@
<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>
@ -195,7 +196,7 @@
<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>
@ -204,10 +205,10 @@
<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>
@ -273,7 +274,7 @@
<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>
@ -335,7 +336,7 @@
<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>
@ -375,7 +376,7 @@
<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>
@ -413,7 +414,7 @@
<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>
@ -482,15 +483,16 @@
<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="action_view"/>
<addaction name="action_news"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_sync"/> <addaction name="action_sync"/>
<addaction name="action_save"/> <addaction name="action_save"/>
<addaction name="action_del"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_news" /> <addaction name="action_preferences"/>
<addaction name="action_convert" />
<addaction name="action_view" />
</widget> </widget>
<widget class="QStatusBar" name="statusBar"> <widget class="QStatusBar" name="statusBar">
<property name="mouseTracking"> <property name="mouseTracking">
@ -665,6 +667,21 @@
<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>

View File

@ -9,12 +9,18 @@ _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:
ipaddr = socket.gethostbyname(socket.gethostname())
except:
ipaddr = '127.0.0.1'
if ipaddr == '127.0.0.1':
try: try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('google.com', 0)) s.connect(('google.com', 0))
return s.getsockname()[0] ipaddr = s.getsockname()[0]
except: except:
return '127.0.0.1' 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: