Check-in [0edaf9402f]
Overview
Comment: | New mime/app configuration screen in an editable ListStore. Players, recording hook and browser are now mixed up in conf.play{} |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0edaf9402f680d128b95730e0b082f30 |
User & Date: | mario on 2014-05-14 23:44:07 |
Other Links: | manifest | tags |
Context
2014-05-15
| ||
19:45 | and conf.pyquery default, so it's not forgotten by config_dialog.save_config check-in: bc473dc5da user: mario tags: trunk | |
2014-05-14
| ||
23:44 | New mime/app configuration screen in an editable ListStore. Players, recording hook and browser are now mixed up in conf.play{} check-in: 0edaf9402f user: mario tags: trunk | |
2014-05-13
| ||
23:55 | narrower options in settings dialog check-in: d6fb6f5d65 user: mario tags: trunk | |
Changes
Modified action.py from [5d3890f993] to [9506eb9e76].
︙ | ︙ | |||
43 44 45 46 47 48 49 | # media formats mf = {"mp3":"audio/mpeg", "ogg":"audio/ogg", "aac":"audio/aac"} # web @staticmethod def browser(url): | > | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # media formats mf = {"mp3":"audio/mpeg", "ogg":"audio/ogg", "aac":"audio/aac"} # web @staticmethod def browser(url): bin = conf.play.get("url/http", "sensible-browser") __print__( dbg.CONF, bin ) action.run(bin + " " + action.quote(url)) # os shell cmd escaping @staticmethod def quote(s): if conf.windows: |
︙ | ︙ | |||
86 87 88 89 90 91 92 | os.system(cmd + " &") # streamripper @staticmethod def record(url, audioformat="audio/mpeg", listformat="text/x-href", append="", row={}): __print__( dbg.PROC, "record", url ) | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | os.system(cmd + " &") # streamripper @staticmethod def record(url, audioformat="audio/mpeg", listformat="text/x-href", append="", row={}): __print__( dbg.PROC, "record", url ) cmd = conf.record.get(audioformat, conf.play.get("record", None)) try: action.run( action.interpol(cmd, url, row) + append ) except: pass # save as .m3u @staticmethod def save(row, fn, listformat="audio/x-scpls"): |
︙ | ︙ |
Modified config.py from [c89ffe92b8] to [0b8fb92b93].
︙ | ︙ | |||
55 56 57 58 59 60 61 | else: self.save("settings") self.firstrun = 1 # some defaults def defaults(self): | < < < | > > > < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | else: self.save("settings") self.firstrun = 1 # some defaults def defaults(self): self.play = { "audio/mpeg": "audacious ", # %u for url to .pls, %g for downloaded .m3u "audio/ogg": "audacious ", "audio/*": "totem ", "video/*": "vlc --one-instance %srv", "record": "x-terminal-emulator -e streamripper %srv", # x-terminal-emulator -e streamripper %srv -d /home/***USERNAME***/Musik "url/http": "sensible-browser", } self.record = { } self.plugins = { "bookmarks": 1, # built-in plugins, cannot be disabled "shoutcast": 1, "xiph": 1, "file": 0, # disable per default "punkcast": 0, # disable per default |
︙ | ︙ |
Modified gtk2.xml from [722d740b7e] to [286f15081e].
1 2 3 4 5 6 7 8 9 10 11 | <?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.20"/> <!-- interface-naming-policy toplevel-contextual --> <object class="GtkDialog" id="search_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="title" translatable="yes">station search</property> <property name="window_position">center-on-parent</property> <property name="type_hint">dialog</property> <property name="deletable">False</property> | > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.20"/> <!-- interface-naming-policy toplevel-contextual --> <object class="GtkListStore" id="config_play"> <columns> <!-- column-name type --> <column type="gchararray"/> <!-- column-name app --> <column type="gchararray"/> <!-- column-name gboolean1 --> <column type="gboolean"/> </columns> </object> <object class="GtkDialog" id="search_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="title" translatable="yes">station search</property> <property name="window_position">center-on-parent</property> <property name="type_hint">dialog</property> <property name="deletable">False</property> |
︙ | ︙ | |||
131 132 133 134 135 136 137 138 139 140 141 142 143 144 | <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Which channels/directories to look through.</property> <property name="n_rows">4</property> <property name="n_columns">4</property> <property name="column_spacing">5</property> <property name="row_spacing">1</property> <property name="homogeneous">True</property> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Which channels/directories to look through.</property> <property name="n_rows">4</property> <property name="n_columns">4</property> <property name="column_spacing">5</property> <property name="row_spacing">1</property> <property name="homogeneous">True</property> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> |
︙ | ︙ | |||
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <object class="GtkEntry" id="timer_value"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> <property name="text" translatable="yes">Fri,Sat 20:00-21:00</property> <property name="primary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property> <property name="primary_icon_sensitive">True</property> <property name="secondary_icon_sensitive">True</property> </object> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> </packing> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> | > > > > > > > > > > > > > > > > > > > > > | 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <object class="GtkEntry" id="timer_value"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> <property name="text" translatable="yes">Fri,Sat 20:00-21:00</property> <property name="primary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property> <property name="primary_icon_sensitive">True</property> <property name="secondary_icon_sensitive">True</property> </object> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> </packing> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> |
︙ | ︙ | |||
1150 1151 1152 1153 1154 1155 1156 | <child> <object class="GtkViewport" id="viewport2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="border_width">15</property> <property name="shadow_type">none</property> <child> | | < < < < < < < < < < < < < < < | < < < | < < < < < < < | > < | < < < < | < < < < | < | | < < < | | < < | | < < < < < < < < < < < | | | | | | | < < < < < | | | | < < | | | | | | > > | < < < < < | < | | | | | > | | | | | | | | | < < < < | < | | | < | | > | | < < < < < < < < < < > | | | < > > | < > | > < < | < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 | <child> <object class="GtkViewport" id="viewport2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="border_width">15</property> <property name="shadow_type">none</property> <child> <object class="GtkVBox" id="vbox_cfg_player"> <property name="visible">True</property> <property name="can_focus">False</property> <child> <object class="GtkLabel" id="label_player"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes"><b>Audio player</b> and <b>recording</b> applications.</property> <property name="use_markup">True</property> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkScrolledWindow" id="scrolledwindow4"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">automatic</property> <property name="vscrollbar_policy">automatic</property> <child> <object class="GtkTreeView" id="tv_config_player"> <property name="width_request">0</property> <property name="height_request">200</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="border_width">5</property> <property name="model">config_play</property> <property name="headers_clickable">False</property> <property name="rules_hint">True</property> <property name="search_column">0</property> <property name="level_indentation">8</property> <property name="enable_grid_lines">both</property> <child> <object class="GtkTreeViewColumn" id="tvc_config_player_type"> <property name="spacing">10</property> <property name="min_width">125</property> <property name="title" translatable="yes">Format</property> <property name="sort_indicator">True</property> <child> <object class="GtkCellRendererText" id="tvcr_config_player_type"> <signal name="edited" handler="config_player_edited" swapped="no"/> </object> <attributes> <attribute name="editable">2</attribute> <attribute name="text">0</attribute> </attributes> </child> </object> </child> <child> <object class="GtkTreeViewColumn" id="tvc_config_player_app"> <property name="spacing">10</property> <property name="min_width">300</property> <property name="title" translatable="yes">Application</property> <child> <object class="GtkCellRendererText" id="tvcr_config_player_app"> <signal name="edited" handler="config_player_edited_2" swapped="no"/> </object> <attributes> <attribute name="editable">2</attribute> <attribute name="text">1</attribute> </attributes> </child> </object> </child> </object> </child> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkLabel" id="label15"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0.019999999552965164</property> <property name="yalign">0.49000000953674316</property> <property name="label" translatable="yes">Use <a href="http://fossil.include-once.org/streamtuner2/wiki?name=player">placeholders</a> such as <b>%pls</b> for Shoutcast playlists, or pass <b>%m3u</b> for players that expect mp3 playlist files, and <b>%srv</b> to use direct streaming URLs.</property> <property name="use_markup">True</property> <property name="wrap">True</property> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> <property name="position">2</property> </packing> </child> </object> </child> </object> </child> </object> |
︙ | ︙ | |||
2713 2714 2715 2716 2717 2718 2719 | <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="menu_bookmark"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">bookmark</property> <property name="use_underline">True</property> | < > < > | | | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="menu_bookmark"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">bookmark</property> <property name="use_underline">True</property> <accelerator key="F8" signal="activate"/> <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <signal name="activate" handler="bookmark" swapped="no"/> </object> </child> <child> <object class="GtkImageMenuItem" id="imagemenuitem_saveas"> <property name="label">gtk-save-as</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="F2" signal="activate"/> <signal name="activate" handler="save_as" swapped="no"/> </object> </child> <child> <object class="GtkImageMenuItem" id="gtk-edit"> <property name="label">gtk-edit</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <accelerator key="Return" signal="activate" modifiers="GDK_MOD1_MASK"/> <accelerator key="space" signal="activate" modifiers="GDK_MOD1_MASK"/> <accelerator key="F3" signal="activate"/> <signal name="activate" handler="streamedit_open" swapped="no"/> </object> </child> <child> <object class="GtkMenuItem" id="extensions0"> <property name="visible">True</property> <property name="can_focus">False</property> |
︙ | ︙ | |||
2812 2813 2814 2815 2816 2817 2818 | <child> <object class="GtkImageMenuItem" id="menuitem_delete"> <property name="label">gtk-delete</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> | < > | 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 | <child> <object class="GtkImageMenuItem" id="menuitem_delete"> <property name="label">gtk-delete</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <accelerator key="x" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="Delete" signal="activate"/> <signal name="activate" handler="delete_entry" swapped="no"/> </object> </child> <child> <object class="GtkImageMenuItem" id="imagemenuitem8"> <property name="label">gtk-find</property> <property name="visible">True</property> |
︙ | ︙ |
Modified st2.py from [a65b5708f4] to [95ed169041].
︙ | ︙ | |||
181 182 183 184 185 186 187 188 189 190 191 192 193 194 | "menu_toolbar_size_small": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)), "menu_toolbar_size_medium": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DND)), "menu_toolbar_size_large": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DIALOG)), # else "menu_properties": config_dialog.open, "config_cancel": config_dialog.hide, "config_save": config_dialog.save, "update_categories": self.update_categories, "update_favicons": self.update_favicons, "app_state": self.app_state, "bookmark": self.bookmark, "save_as": self.save_as, "menu_about": lambda w: AboutStreamtuner2(), "menu_help": action.action.help, | > > | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | "menu_toolbar_size_small": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)), "menu_toolbar_size_medium": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DND)), "menu_toolbar_size_large": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DIALOG)), # else "menu_properties": config_dialog.open, "config_cancel": config_dialog.hide, "config_save": config_dialog.save, "config_player_edited": config_dialog.edited_player_row, "config_player_edited_2": config_dialog.edited_player_row_2, "update_categories": self.update_categories, "update_favicons": self.update_favicons, "app_state": self.app_state, "bookmark": self.bookmark, "save_as": self.save_as, "menu_about": lambda w: AboutStreamtuner2(), "menu_help": action.action.help, |
︙ | ︙ | |||
743 744 745 746 747 748 749 | # aux win: settings UI class config_dialog (auxiliary_window): | | | > | | | < < | > > > > > > > > > > > > > | | > > | | > | | | > | < > > | | > | > > | | > > > > > | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | # aux win: settings UI class config_dialog (auxiliary_window): # Display win_config, pre-fill text fields from global conf. object def open(self, widget): if self.first_open: self.add_plugins() self.combobox_theme() self.first_open = 0 self.load_config(conf.__dict__, "config_") self.load_config(conf.plugins, "config_plugins_") self.win_config.show() first_open = 1 # Hide window def hide(self, *args): self.win_config.hide() return True # Load values from conf. store into gtk widgets def load_config(self, config, prefix="config_"): for key,val in config.items(): w = main.get_widget(prefix + key) if w: # input field if type(w) is gtk.Entry: w.set_text(str(val)) # checkmark elif type(w) is gtk.CheckButton: w.set_active(bool(val)) # list elif type(w) is gtk.ListStore: w.clear() for k,v in val.items(): w.append([k, v, True]) w.append(["", "", True]) __print__(dbg.CONF, "config load", prefix+key, val, type(w)) # Store gtk widget valus back into conf. dict def save_config(self, config, prefix="config_", save=0): for key,val in config.items(): w = main.get_widget(prefix + key) if w: # text if type(w) is gtk.Entry: config[key] = w.get_text() # boolean elif type(w) is gtk.CheckButton: config[key] = w.get_active() # dict elif type(w) is gtk.ListStore: config[key] = {} for row in w: if row[0] and row[1]: config[key][row[0]] = row[1] __print__(dbg.CONF, "config save", prefix+key, val) # Gtk callback to update ListStore when entries get edited def edited_player_row(self, cell, path, new_text, user_data=None, column=0): main.config_play[path][column] = new_text def edited_player_row_2(self, cell, path, new_text, user_data=None): self.edited_player_row(cell, path, new_text, column=1) # fill combobox def combobox_theme(self): # self.theme.combo_box_new_text() # find themes themedirs = (conf.share+"/themes", conf.dir+"/themes", "/usr/share/themes") |
︙ | ︙ | |||
841 842 843 844 845 846 847 | else: self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"] ) # spacer self.add_( "filler_pl_"+name, gtk.HSeparator() ) | | > > | > | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | else: self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"] ) # spacer self.add_( "filler_pl_"+name, gtk.HSeparator() ) # Put config widgets into config dialog notebook def add_(self, id, w, label=None, color=""): w.set_property("visible", True) main.widgets[id] = w if label: w.set_width_chars(11) w = self.hbox(w, self.label(label)) if color: w = mygtk.bg(w, color) self.plugin_options.pack_start(w) # Create GtkLabel def label(self, label): label = gtk.Label(label) label.set_property("visible", True) label.set_line_wrap(True) label.set_size_request(400, -1) return label # Wrap two widgets in vertical box def hbox(self, w1, w2): vbox = gtk.HBox(homogeneous=False, spacing=10) vbox.set_property("visible", True) vbox.pack_start(w1, expand=False, fill=False) vbox.pack_start(w2, expand=True, fill=True) return vbox # save config def save(self, widget): self.save_config(conf.__dict__, "config_") self.save_config(conf.plugins, "config_plugins_") self.apply_theme() conf.save(nice=1) self.hide() config_dialog = config_dialog() # instantiates itself |
︙ | ︙ |