Skip to content

Commit

Permalink
Implement simple tabbed workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cipres authored and cipres committed Aug 22, 2020
1 parent 1437473 commit 812438a
Show file tree
Hide file tree
Showing 34 changed files with 1,413 additions and 637 deletions.
2 changes: 1 addition & 1 deletion galacteek/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# ..............................................................................
#

__version__ = '0.4.31'
__version__ = '0.4.32'

from galacteek.core.asynclib import * # noqa
from galacteek.core import glogger
Expand Down
2 changes: 2 additions & 0 deletions galacteek/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ def setupTranslator(self):

def createMainWindow(self, show=True):
self.mainWindow = mainui.MainWindow(self)
self.mainWindow.setupWorkspaces()

if show is True:
self.mainWindow.show()

Expand Down
2 changes: 1 addition & 1 deletion galacteek/docs/manual/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__manual_en_version__ = '20200704'
__manual_en_version__ = '20200820'
18 changes: 18 additions & 0 deletions galacteek/docs/manual/en/editing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _editing:

Editing documents
=================

Linking IPFS files
------------------

When writing a blog post or editing a markdown file, you may
want to create a hyperlink to a file that is stored on the
IPFS network.

From the text editor or blog post writer, right-clicking shows
a submenu which allows you to create markdown links for the
files referenced in the clipboard manager. First copy to the
clipboard the object you want to link, then from the editor
right-click and link this file, or hit **Ctrl-v** to create
a link for the latest item in the clipboard stack.
2 changes: 2 additions & 0 deletions galacteek/docs/manual/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ galacteek's manual (english)

Settings <settings>
Toolbars <toolbars>
Workspaces <workspaces>
Using the clipboard <clipboard>
Decentralized Identity <did>
Connection status <status>
Shortcuts <shortcuts>
Hashmarks <hashmarks>
File manager <filemanager>
Browsing <browsing>
Editing <editing>
Pinning <pinning>
Pyramids <pyramids>
Atom feeds <atom>
Expand Down
42 changes: 42 additions & 0 deletions galacteek/docs/manual/en/workspaces.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _workspaces:

Workspaces
==========

From the main toolbar you can access the different workspaces.
Each workspace has a different purpose and contains a tabbed
widget (some tabs are long-lived and non-closable, like the
filemanager).

Files workspace
---------------

This workspace contains the filemanager. Anything opened by the
filemanager will appear on this workspace.

Core workspace
--------------

This workspace is for browsing mainly.

Search workspace
----------------

This workspace is dedicated to IPFS searching.

Edition workspace
-----------------

This workspace contains tools (text editor, blog post writer)
to write documents stored on IPFS.

Network workspace
-----------------

This workspace shows the connected peers. From here you
can open the Atom feeds reader and connect to chat rooms.

Multimedia workspace
--------------------

This workspace is dedicated to the mediaplayer.
7 changes: 6 additions & 1 deletion galacteek/dweb/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@


def markitdown(text):
return markdown.markdown(text, extensions=[CodeBlockExtension()])
return markdown.markdown(
text, extensions=[
CodeBlockExtension(),
'attr_list'
]
)
21 changes: 21 additions & 0 deletions galacteek/ipfs/ipfsops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,27 @@ async def list(self, path, resolve_type=True):
except BaseException:
pass

async def listStreamed(self, path, resolve_type=True):
"""
Lists objects in a given path and yields them (streamed)
"""
try:
async for listing in self.client.core.ls_streamed(
await self.objectPathMapper(path),
headers=True,
resolve_type=resolve_type):

objects = listing.get('Objects', [])

for obj in objects:
await self.sleep()
yield obj
except aioipfs.APIError as e:
raise e
except BaseException as err:
self.debug(str(err))
raise err

async def objStat(self, path, timeout=30):
try:
stat = await self.waitFor(
Expand Down
9 changes: 5 additions & 4 deletions galacteek/ipfs/pubsub/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,12 @@ async def periodic(self, ipfsop):
while True:
await asyncio.sleep(90)

profile = ipfsop.ctx.currentProfile
channelsDag = profile.dagChatChannels
if ipfsop.ctx.currentProfile:
channelsDag = ipfsop.ctx.currentProfile.dagChatChannels

msg = ChatChannelsListMessage.make(channelsDag.channelsSorted)
await self.send(msg)
await self.send(
ChatChannelsListMessage.make(channelsDag.channelsSorted)
)


def chatChannelTopic(channel):
Expand Down
3 changes: 3 additions & 0 deletions galacteek/ui/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,9 @@ def createPageOpsButton(self):

@ipfsOp
async def createPageOpsMfsMenu(self, ipfsop):
if not ipfsop.ctx.currentProfile:
return

self.mfsMenu = ipfsop.ctx.currentProfile.createMfsMenu(
title=iLinkToMfsFolder(), parent=self
)
Expand Down
5 changes: 4 additions & 1 deletion galacteek/ui/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from galacteek import partialEnsure
from galacteek.core.modelhelpers import UneditableStringListModel

from .dwebspace import WS_PEERS
from .helpers import getIcon
from .helpers import inputTextCustom
from .helpers import questionBoxAsync
Expand Down Expand Up @@ -139,7 +140,8 @@ async def onJoinChannel(self, ipfsop, channel):
self.app.mainWindow.registerTab(
widget, name=channel,
icon=getIcon('qta:mdi.chat-outline'),
current=True
current=True,
workspace=WS_PEERS
)


Expand Down Expand Up @@ -366,6 +368,7 @@ async def onChatMessageReceived(self, key, message):
if message.chatMessageType == ChatRoomMessage.CHATMSG_TYPE_MESSAGE:
if not self.isVisible():
self.setTabIcon(getIcon('chat-active.png'))
self.tabActiveNotify()
else:
self.setTabIcon(getIcon('qta:mdi.chat-outline'))

Expand Down
11 changes: 11 additions & 0 deletions galacteek/ui/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
from .helpers import runDialog
from .helpers import disconnectSig
from .helpers import sizeFormat
from .helpers import playSound
from .widgets import PopupToolButton
from .widgets import DownloadProgressButton
from .dialogs import ChooseProgramDialog
Expand Down Expand Up @@ -624,6 +625,9 @@ def onOpenWithDefaultApp(self):
def mimeDetected(self, mType):
if self.loadingClip.state() == QMovie.Running:
self.loadingClip.stop()

playSound('mime-detected.wav')

ensure(self.updateButton())

def tooltipMessage(self):
Expand Down Expand Up @@ -1009,3 +1013,10 @@ def getStackItem(self, itemNo):

if itemIdx > 0:
return self.widget(itemIdx)

def items(self, count=None):
for idx in reversed(range(
max(0, self.count() - count) if count else 0, self.count())):
clipItemButton = self.widget(idx)
if clipItemButton and clipItemButton.item:
yield idx, clipItemButton.item
Loading

0 comments on commit 812438a

Please sign in to comment.