def init_actions(self): actionCollection = self.actionCollection() # File menu. self.action_open_directory = util.create_action( 'action_open_directory', 'Open directory...', self.slot_open_directory, 'document-open-folder', 'Ctrl+F') self.action_quit = kdeui.KStandardAction.quit(self.slot_really_quit, actionCollection) # Help menu. self.action_about = kdeui.KStandardAction.aboutApp( kdeui.KAboutApplicationDialog(None, self).show, actionCollection) self.action_about.setShortcutConfigurable(False) # Other. self.action_toggle_window = util.create_action( 'action_toggle_window', 'Show/Hide window', self.systray.toggleActive, global_shortcut='Ctrl+Alt+M') self.action_preferences = kdeui.KStandardAction.preferences( self.slot_preferences, actionCollection) self.action_preferences.setShortcutConfigurable(False)
def init_actions(self): actionCollection = self.actionCollection() # File menu. self.action_quit = kdeui.KStandardAction.quit(self.slot_really_quit, actionCollection) # Help menu. self.action_about = kdeui.KStandardAction.aboutApp( kdeui.KAboutApplicationDialog(None, self).show, actionCollection ) self.action_about.setShortcutConfigurable(False) # Other. self.action_toggle_window = util.create_action( "action_toggle_window", "Show/Hide window", self.systray.toggleActive, global_shortcut="Ctrl+Alt+M" ) self.action_preferences = kdeui.KStandardAction.preferences(self.slot_preferences, actionCollection) self.action_preferences.setShortcutConfigurable(False)
def __init__(self, *args): kdeui.KStatusBar.__init__(self, *args) self.seek_to = None self.timer = util.QTimerWithPause(self) self.blink_timer = QtCore.QTimer(self) self.blink_timer_flag = True # Used in slot_blink(). self.repeat = RepeatLabel(self) self.random = RandomLabel(self) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.label1 = TimeLabel(self) self.label2 = NegativeTimeLabel(self) self.slider.setTracking(False) self.slider.setMaximumWidth(150) self.slider.setFocusPolicy(QtCore.Qt.NoFocus) self.setContentsMargins(0, 0, 4, 0) self.addPermanentWidget(self.repeat, 0) self.addPermanentWidget(self.random, 0) self.addPermanentWidget(self.label1, 0) self.addPermanentWidget(self.slider, 0) self.addPermanentWidget(self.label2, 0) self.slot_stop() self._connect_timer() self.connect(self.blink_timer, QtCore.SIGNAL('timeout()'), self.slot_blink) self.connect(self.slider, QtCore.SIGNAL('sliderPressed()'), lambda: self.handle_slider_event(self.SLIDER_PRESSED)) self.connect(self.slider, QtCore.SIGNAL('sliderMoved(int)'), lambda x: self.handle_slider_event(self.SLIDER_MOVED, x)) self.connect(self.slider, QtCore.SIGNAL('sliderReleased()'), lambda: self.handle_slider_event(self.SLIDER_RELEASED)) self.connect(minirok.Globals.playlist, QtCore.SIGNAL('new_track'), self.slot_start) self.connect(minirok.Globals.engine, QtCore.SIGNAL('status_changed'), self.slot_engine_status_changed) self.connect(minirok.Globals.engine, QtCore.SIGNAL('seek_finished'), self.slot_engine_seek_finished) # Actions self.action_next_repeat_mode = util.create_action( 'action_next_repeat_mode', 'Change repeat mode', self.repeat.mousePressEvent, QtGui.QIcon(util.get_png('repeat_track_small')), 'Ctrl+T') self.action_toggle_random_mode = util.create_action( 'action_toggle_random_mode', 'Toggle random mode', self.random.mousePressEvent, QtGui.QIcon(util.get_png('random_small')), 'Ctrl+R')
def __init__(self, *args): QtGui.QWidget.__init__(self, *args) self.tree_view = tree_view.TreeView() self.tree_search = QtGui.QWidget(self) self.combo_toolbar = kdeui.KToolBar(None) layout = QtGui.QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(4, 4, 4, 0) layout.addWidget(self.tree_search) layout.addWidget(self.combo_toolbar) layout.addWidget(self.tree_view) self.setLayout(layout) self.button_action = 'Enable' self.search_button = QtGui.QPushButton(self.button_action) self.search_widget = tree_view.TreeViewSearchLineWidget() self.search_widget.setEnabled(False) layout2 = QtGui.QHBoxLayout() layout2.setSpacing(0) layout2.setContentsMargins(0, 0, 0, 0) layout2.addWidget(self.search_widget) layout2.addWidget(self.search_button) self.tree_search.setLayout(layout2) self.path_combo = MyComboBox(self.combo_toolbar) self.combo_toolbar.addWidget(self.path_combo) self.combo_toolbar.setIconDimensions(16) self.combo_toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) # XXX-KDE4: This should be "stretchabe" or however it's called. # self.combo_toolbar.setItemAutoSized(0) self.action_refresh = util.create_action( 'action_refresh_tree_view', 'Refresh tree view', self.tree_view.slot_refresh, 'view-refresh', 'F5') self.combo_toolbar.addAction(self.action_refresh) self.action_focus_path_combo = util.create_action( 'action_path_combo_focus', 'Focus path combobox', self.path_combo.slot_focus, shortcut='Alt+O') ## self.search_widget.searchLine().setTreeWidget(self.tree_view) self.connect(self.tree_view, QtCore.SIGNAL('scan_in_progress'), self.slot_tree_view_does_scan) self.connect(self.search_button, QtCore.SIGNAL('clicked(bool)'), self.slot_do_button) self.connect(self.search_widget.searchLine(), QtCore.SIGNAL('search_finished'), self.tree_view.slot_search_finished) self.connect(self.search_widget.searchLine(), QtCore.SIGNAL('returnPressed(const QString &)'), self.tree_view.slot_append_visible) self.connect(self.path_combo, QtCore.SIGNAL('new_directory_selected'), self.tree_view.slot_show_directory) ## if self.path_combo.currentText(): # This can't go in the MyComboBox constructor because the signals # are not connected yet at that time. self.path_combo.slot_set_url(self.path_combo.currentText()) else: text = 'Enter a directory here' width = self.path_combo.fontMetrics().width(text) self.path_combo.setEditText(text) self.path_combo.setMinimumWidth(width + 30) # Add pixels for arrow.