diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 2f21a3746b..3ed4b59f75 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -237,6 +237,7 @@ class Main(MainWindow, Ui_MainWindow): 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.action_preferences, SIGNAL('triggered(bool)'), self.do_config) QObject.connect(self.advanced_search_button, SIGNAL('clicked(bool)'), self.do_advanced_search) ####################### Library view ######################## @@ -1252,7 +1253,7 @@ class Main(MainWindow, Ui_MainWindow): ############################### Do config ################################## - def do_config(self): + def do_config(self, *args): if self.job_manager.has_jobs(): d = error_dialog(self, _('Cannot configure'), _('Cannot configure while there are running jobs.')) d.exec_() diff --git a/src/calibre/gui2/main.ui b/src/calibre/gui2/main.ui index ad8c450d1a..c4bea8d886 100644 --- a/src/calibre/gui2/main.ui +++ b/src/calibre/gui2/main.ui @@ -1,149 +1,150 @@ - + + Kovid Goyal MainWindow - - + + 0 0 - 865 + 1012 822 - - + + 0 0 - + Qt::NoContextMenu - + __appname__ - - + + :/library:/library - - - - + + + + - - - + + + 0 0 - + 16777215 100 - + Qt::ScrollBarAlwaysOff - + Qt::ScrollBarAsNeeded - + true - + true - + 40 40 - + QListView::Static - + QListView::LeftToRight - + 175 90 - + QListView::ListMode - + true - - + + PointingHandCursor - + ... - - + + :/images/donate.svg:/images/donate.svg - + 64 64 - + true - + - - - + + + 0 0 - + 16777215 90 - + - + Qt::RichText - + true - + - - + + Output: - - + + Set the output format that is used when converting ebooks and downloading news @@ -154,99 +155,99 @@ - - - + + + 6 - + 0 - - + + Advanced search - + ... - - + + :/images/search.svg:/images/search.svg - + Alt+S - - + + &Search: - + search - - + + true - - + + 1 0 - + false - - Search the list of books by title or author<br><br>Words separated by spaces are ANDed + + Search the list of books by title or author<br><br>Words separated by spaces are ANDed - - Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed + + Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed - + false - + - + true - - + + Reset Quick Search - + ... - - + + :/images/clear_left.svg:/images/clear_left.svg - - + + Qt::Vertical - + Qt::Horizontal - + 20 20 @@ -255,77 +256,77 @@ - - + + Configuration - + ... - - + + :/images/config.svg:/images/config.svg - - - - + + + + 100 100 - + 0 - - + + - + - + - - + + Match any - + false - - + + Match all - + true - - + + Sort by &popularity - - + + true - + true - + true - + true @@ -333,35 +334,35 @@ - - - + + + 100 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false @@ -370,76 +371,76 @@ - - - - - - + + + + + + 100 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false - - - - - - + + + + + + 10 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false @@ -450,221 +451,237 @@ - - + + 0 0 - + Qt::PreventContextMenu - + false - + Qt::Horizontal - + 48 48 - + Qt::ToolButtonTextUnderIcon - + TopToolBarArea - + false - - - - - - - - - - + + + + + + + + + + + - - + + true - - - + + + :/images/add_book.svg:/images/add_book.svg - + Add books - + A - + false - - - + + + :/images/trash.svg:/images/trash.svg - + Remove books - + Remove books - + Del - - - + + + :/images/edit_input.svg:/images/edit_input.svg - + Edit meta information - + E - + false - - + + false - - + + :/images/sync.svg:/images/sync.svg - + Send to device - - - + + + :/images/save.svg:/images/save.svg - + Save to disk - + S - - - + + + :/images/news.svg:/images/news.svg - + Fetch news - + F - - - + + + :/images/convert.svg:/images/convert.svg - + Convert E-books - + C - - - + + + :/images/view.svg:/images/view.svg - + View - + V - - - + + + :/images/document_open.svg:/images/document_open.svg - + Open containing folder - - - + + + :/images/dialog_information.svg:/images/dialog_information.svg - + Show book details - - - + + + :/images/user_profile.svg:/images/user_profile.svg - + Books by same author - - - + + + :/images/books_in_series.svg:/images/books_in_series.svg - + Books in this series - - - + + + :/images/publisher.png:/images/publisher.png - + Books by this publisher - - - + + + :/images/tags.svg:/images/tags.svg - + Books with the same tags - - - + + + :/images/book.svg:/images/book.svg - + Send specific format to device + + + + :/images/config.svg:/images/config.svg + + + Preferences + + + Configure calibre + + + Ctrl+P + + @@ -694,7 +711,7 @@ - + @@ -703,11 +720,11 @@ search clear() - + 787 215 - + 755 213 diff --git a/src/calibre/utils/mdns.py b/src/calibre/utils/mdns.py index 022f9c1407..f941446202 100644 --- a/src/calibre/utils/mdns.py +++ b/src/calibre/utils/mdns.py @@ -10,11 +10,17 @@ _server = None def get_external_ip(): 'Get IP address of interface used to connect to the outside world' try: - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - s.connect(('google.com', 0)) - return s.getsockname()[0] + ipaddr = socket.gethostbyname(socket.gethostname()) 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(): 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 into the TXT record. ''' + port = int(port) server = start_server() hostname = socket.gethostname() if add_hostname: